2

When configuring a local build agent on a Windows 2016 server, I use the following proxy config settings:

.\config.cmd --proxyurl http://192.3.4.5:8080 --sslskipcertvalidation

This allows the build server to connect to Azure DevOps behind the proxy without issues, however the powershell build is having trouble connecting out to the internet. I solved this by setting an environmental variable at the beginning of the build command as such:

$env:http_proxy = "192.3.4.5:8080"

The final issue is a step in the build requires to winrm to a VM hosted directly on the build server and it cannot connect. I've tried configuring the agent's .proxybypass file as such:

localhost
192\.3\.4\.*

This has failed to solve the issue however. Any ideas on how to set the proxy bypass in the build step? Is there another powershell env variable I could set?

3
  • The proxy settings ensure the agent can call out. The tasks rely on a lot of different technologies and each use different proxy cofnigurations, IP masks and whitelists. As such, if your agent is behind a proxy, you may need to configure a lot of different proxy settings on said machine. It's a pain. Even for task authors, like me, who can't just take the agent config and copy it one-to-one to the technology each task relies on. Commented May 1, 2019 at 21:05
  • 1
    Powershell relies on the Windows internet settings proxy configuration for the user running the task. You can also override the .NET proxy configuration Powershell relies on the .NET proxy settings, how to change those on the fly is listed here: stackoverflow.com/a/209072/736079 Commented May 1, 2019 at 21:08
  • The comment above has helped solve this issue. Just needed to use the .NET class in the powershell build - eg; [net.webrequest]::defaultwebproxy = new-object net.webproxy "http://$env:proxy_ip" and then add [system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true Commented May 2, 2019 at 13:10

1 Answer 1

1

The proxy settings ensure the agent can call out. The tasks rely on a lot of different technologies and each use different proxy configurations, IP masks and whitelists. As such, if your agent is behind a proxy, you may need to configure a lot of different proxy settings on said machine. It's a pain. Even for task authors, like me, who can't just take the agent config and copy it one-to-one to the technology each task relies on.

Powershell relies on the Windows internet settings proxy configuration for the user running the task. You can also override the .NET proxy configuration Powershell relies on the .NET proxy settings, how to change those on the fly is listed here: https://stackoverflow.com/a/209072/736079

Use the .NET class in the powershell build:

[net.webrequest]::defaultwebproxy = new-object net.webproxy "http://$env:proxy_ip" 

and then add

[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.