Unable to Access Internet from Azure DevOps Server 2022 Self-Hosted Agent Behind Proxy

SR 20 Reputation points
2025-10-22T23:07:28.66+00:00

I am running Azure DevOps Server 2022 in an environment that uses a proxy to access the internet. Multiple projects depend on various Node packages. While I can successfully download these packages through a browser using the configured proxy, the issue occurs when running pipelines on a self-hosted agent.

The agent installation completes successfully, but the pipeline fails during execution, seemingly due to lack of internet access.

Is there a way to configure the proxy settings specifically for the self-hosted agent so that it can access the internet during pipeline runs?

Azure DevOps
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Rohikar 2,790 Reputation points Microsoft External Staff Moderator
    2025-10-23T09:54:45.8333333+00:00

    Hello SR,

    Solution / Workarounds:

    1. Configure Proxy for the Self-Hosted Agent

    You can configure proxy settings for the Azure DevOps agent either during setup or by defining environment variables.

    Option A – During Agent Setup: When configuring the agent using config.cmd or config.sh, specify proxy parameters:

     ./config.cmd --proxyurl http://proxyserver:port --proxyusername "user" --proxypassword "password"
    

    This securely stores proxy credentials in the agent configuration.

    Option B – Using Environment Variables:

    You can configure the proxy settings for the Azure DevOps agent by setting environment variables on the machine where the agent is running. The agent uses these environment variables to connect to the internet.

    Here’s how to configure them:

    • Set the following environment variables on the agent machine:
      • http_proxy=http://your_proxy:port
      • https_proxy=http://your_proxy:port
      • no_proxy=*.yourcompany.com (optional, if you need to exclude certain domains from the proxy)

    On Windows, you can set these environment variables by going to Control Panel > System and Security > System > Advanced system settings > Environment Variables and adding the above variables.

    For Linux agents, add the same variables in the shell profile (e.g., .bashrc, .bash_profile, or .profile).

    2. Configure npm for Proxy Access

    If your pipeline tasks depend on Node.js or npm packages, configure npm as follows:

    npm config set proxy http://your_proxy:port
    npm config set https-proxy http://your_proxy:port
    

    You can also authenticate npm tasks with DevOps artifacts using the npmAuthenticate@0 task when behind a proxy. With these documentations : 1. Connect to an Azure Artifacts feed - npm 2. npmAuthenticate@0

    3. Verify Firewall / Connectivity

    If everything is configured properly and you’re still encountering issues, ensure that the network firewall isn't blocking outbound traffic for the self-hosted agent. Sometimes corporate firewalls or network monitoring tools can block connections that are not from a browser.

    Documentation:

    I hope the above helps. Let us know if you have any further questions. Thanks!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.