Hi,
I'm trying to run powershell cmdlets through a proxy server. If I just run the cmdlet I get a 407 error message.
Clearly some proxy server credentials are required.
The only way I found to pass the credentials to the Azure cmdlets is to create a 'powershell.exe.config' file at the following locations:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0
C:\Windows\System32\WindowsPowerShell\v1.0
I've tried two diffierent .config files. The first contains:
<system.net> <defaultProxy enabled="true" useDefaultCredentials="true"> <proxy/> <bypasslist/> <module/> </defaultProxy> </system.net>
The second option I tried was:
<configSections> <sectionGroup name="proxyGroup"> <section name="basicProxy" type="Proxy.Configuration.CustomProxySection, Proxy" /> </sectionGroup> </configSections> <system.net> <defaultProxy enabled="true" useDefaultCredentials="false"> <module type="Proxy.CustomProxy, Proxy"/> </defaultProxy> </system.net> <proxyGroup> <basicProxy proxyHostAddress="Auto" proxyUserName="MyName" proxyUserPassword="MyPassword" /> </proxyGroup>
I've used these successfully before with Visual Studio apps but with the Azure cmdlets both options returned the following error message when I ran a powershell script containing a simple Azure cmdlet:
Get-OSVersions : The type initializer for 'System.ServiceModel.DiagnosticUtility' threw an exception. At C:\Users\******.******\Desktop\azureconnect.ps1:3 char:15 + get-osversions <<<< -subscriptionid****** -certificate C:\Users\******.******\******.cer + CategoryInfo : CloseError: (:) [Get-OSVersions], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedServices.GetOSVersionsCommand
So the error 407 has gone, but now i'm stuck. I can't find much about this anywhere online.
I know that the powershell script works as I have tried running it successfully on a non-proxied machine.
Does anyone have any ideas as to why this isn't working?
Or any other suggestions for running the Azure Powershell cmdlets from behind a proxy server?
Many Thanks for your time


