Running Azure Powershell behind a proxy

Quick post for today. I needed to use PowerShell from a customer site this week and I was getting errors right after trying to login into the console. The error message was just the HTML of the proxy server blocking my attempt of connection. Turns out Powershell does not load proxy configuration from IE automatically and you need to tell it to use manually.

Run PowerShell as administrator and execute the following:

PS C:\WINDOWS\system32> netsh winhttp import proxy source=ie

Current WinHTTP proxy settings:
 Proxy Server(s) : 192.168.1.1:80
 Bypass List : (none)

And if your proxy server needs authentication:

 $webclient=New-Object System.Net.WebClient
 $creds=Get-Credential
 $webclient.Proxy.Credentials=$creds

That’s it! Enjoy your session of PowerShell over proxy.

Leave a Reply

Your email address will not be published. Required fields are marked *