Set-DscLocalConfigurationManager and Proxy awareness

I ran into this issue myself there connecting my sandbox servers to Azure due to a requirement by the security team. There is a workaround, Set up the internet explorer proxy on the local system account. You will need to setup the proxy I use the following code and reg files to setup my proxy with psexec.exe which can execute as local system which might be frowned on by your security team.

$regkey = @'
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
"DefaultConnectionSettings"=EXPORT YOUR OWN PROXY SETTINGS to a reg file after setting up your proxy on your user account!.
'@

$ProxyKeys = @'
@echo off
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t reg_sz /d "yourproxyserver.com:80" /f
regedit /s c:\source\proxy\proxy.reg
powershell.exe -file c:\source\proxy\proxy.ps1
exit 0
'@

#force the proxy settings to reload so we can avoid a reboot
$proxyRefresh = @'
function refresh-system() {
$signature = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@

    $INTERNET_OPTION_SETTINGS_CHANGED   = 39
    $INTERNET_OPTION_REFRESH            = 37
    $type = Add-Type -MemberDefinition $signature -Name wininet -Namespace pinvoke -PassThru
    $a = $type::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
    $b = $type::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
    return $a -and $b
}
refresh-system
'@


new-item -path c:\source\proxy -type Directory -force
$proxyrefresh | Out-file -filepath c:\source\proxy\proxy.ps1 -Encoding ASCII 
$proxyKeys | Out-file -filepath c:\source\proxy\proxy.bat -Encoding ASCII
$regkey | Out-File -filepath c:\source\proxy\proxy.reg -Encoding ASCII
#psexec.exe -accepteula -s cmd.exe "/c c:\source\proxy\proxy.bat"

$Process = Start-Process -FilePath psexec.exe -ArgumentList "-accepteula -s cmd.exe /c c:\source\proxy\proxy.bat" -Wait -PassThru -NoNewWindow -Verbose
Write-Output "ExitCode: $($Process.ExitCode)"
If ($Process.ExitCode -ne 0) {
    Throw "Proxy setup failed"
    exit 1
}