1

I am unable to get Powershell Core 6.1.0 on Linux to access a proxy successfully. Our corporate proxy utilizes IP based authentication and not user based.

So when I attempt to Invoke-WebRequest a bad URL, it will return the HTML of the proxy server rejecting the URL. When I attempt to iwr a genuine allowed URL (one, for example, I am able to browse from firefox on my Ubuntu server).

This is all an attempt to download modules from Powershell Gallery, again browsable from the VM, but cannot access the gallery from powershell even though it knows to use the proxy.

I get a common error on Invoke-WebRequests of 'No such device or address'.

Ramhound
  • 44,080
ourkid
  • 11

1 Answers1

1

To get through your proxy correctly I advise you to export your proxy env variable from your Linux layer. This way:

export HTTP_PROXY=http://your-proxy:3128 
export HTTPS_PROXY=http://your-proxy:3128

Be careful about the uri, do not put the trailing / at the end of your proxy (cf. this post )

Then on your PowerShell layer you should be able to set the default repository with this:

Register-PSRepository -Default

You could try the last command from this topic that I've tried before PowerShell crash me something like

If you want to register the default PSRepository PSGallery use Register-PSRepository -Default

Thibault
  • 111