Skip to content

Commit

Permalink
Update azuredeploy.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Dec 21, 2023
1 parent d986639 commit d2aff79
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions Templates/SharePoint-ADFS/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1719,41 +1719,7 @@
}
],
"source": {
"script": "
param(
[string]$proxyIp = '10.1.5.4',
[string]$proxyHttpPort = '8080',
[string]$proxyHttpsPort = '8443',
[string]$localDomainFqdn = 'contoso.local'
)
$proxy = 'http={0}:{1};https={0}:{2}' -f $proxyIp, $proxyHttpPort, $proxyHttpsPort
$bypasslist = '*.{0};<local>' -f $localDomainFqdn

# Set WinHTTP proxy
netsh winhttp set proxy proxy-server=$proxy bypass-list=$bypasslist

# Set WinINET proxy
# Based on https://blog.workinghardinit.work/2020/03/06/configure-wininet-proxy-server-with-powershell/
# Edit the variables below to fit your environment
$proxyEnabled = 1

# Enable machine wide proxy settings (0: per-machine proxy / 1 (or not set): per-user)
New-ItemProperty -Path 'HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' -Name 'ProxySettingsPerUser' -PropertyType DWORD -Value 0 -Force
$proxyBytes = [system.Text.Encoding]::ASCII.GetBytes($proxy)
$bypassBytes = [system.Text.Encoding]::ASCII.GetBytes($bypasslist)
$defaultConnectionSettings = [byte[]]@(@(70, 0, 0, 0, 0, 0, 0, 0, $proxyEnabled, 0, 0, 0, $proxyBytes.Length, 0, 0, 0) + $proxyBytes + @($bypassBytes.Length, 0, 0, 0) + $bypassBytes + @(1..36 | % { 0 }))

$registryPaths = @('HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings', 'HKLM:\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Internet Settings')
foreach ($registryPath in $registryPaths) {
Set-ItemProperty -Path $registryPath -Name ProxyServer -Value $proxy
Set-ItemProperty -Path $registryPath -Name ProxyEnable -Value $proxyEnabled
Set-ItemProperty -Path $registryPath -Name ProxyOverride -Value $bypasslist
Set-ItemProperty -Path '$registryPath\\Connections' -Name DefaultConnectionSettings -Value $defaultConnectionSettings
}

# Running Bitsadmin is required for the WS-Management service to actually use the proxy to download the DSC config
Bitsadmin /util /setieproxy localsystem MANUAL_PROXY $proxy $bypasslist
"
"scriptUri": "https://gist.github.com/Yvand/c403b946349de1bc64dc0f89658eedd8/raw/set-proxy.ps1"
},
"timeoutInSeconds": 300,
"treatFailureAsDeploymentFailure": true
Expand Down

0 comments on commit d2aff79

Please sign in to comment.