Configuring Self-hosted Windows agents to build your code or deploy your software using Azure Pipelines

Oladipupo Olimene
4 min readOct 16, 2022


Many teams opt for a self hosted agent majorly due to performance and the ability to manage the infrastructure themselves.

An agent is computing infrastructure with installed agent software that runs one job at a time. Similarly, an agent that you set up and manage on your own to run jobs is a self-hosted agent.

You can install the agent on Linux, macOS, or Windows machines. You can also install an agent on a Docker container.

Before you install a self-hosted agent you might want to consider your options as mentioned above and also understand the prerequisites as it pertains to the machine.

For this guide, we are going to be installing the agent on a Windows machine, so you can find more information about the prerequisites here or check below.

Make sure your machine has these prerequisites:

  • Windows 7 SP1 ESU, 8.1, 10, or 11 (if using a client OS)
  • Windows 2012 or higher (if using a server OS)
  • PowerShell 3.0 or higher
  • .NET Framework 4.6.2 or higher


Once you are able to ascertain your machine checks all the prerequisites above prior, then you can proceed.

Create Personal Access Token (PAT) for authentication

Sign in with the valid user account (Make sure the user account that you’re going to use has permission to register the agent) in your Azure DevOps organisation.

From your home page, open your user settings, and then select Personal access tokens.

Personal Access Tokens

Create a new personal access token (PAT)

For the scope, select Show all scopes at the bottom of the Create a new personal access token window to see the complete list of scopes. Then select Agent Pools (Read & Manage) and make sure all the other boxes are unchecked to limit access to only the scope required.

Then create and copy the token for use later because if you close that window, you will not be able to get it again.

Download and configure the agent

Navigate to the Agent pools tab

Optionally, you can add a new pool or select the Default pool.

Whichever option you go for above, select the Agents tab, and click New agent.

On the Get the agent dialog box, choose Windows.

On the left pane, select the processor architecture of the installed Windows OS version on your machine.

Follow the instructions on the page to download the agent.

You can simply click the copy icon and paste in the browser of the Windows machine to download the agent.

Unpack the agent into the directory of your choice. Make sure that the path to the directory contains no spaces because tools and scripts don’t always properly escape spaces. A recommended folder is C:\agents.

Then run config.cmd. This will ask you a series of questions to configure the agent.
Your server URL —{your-organization-name}, Authentication type — PAT,
Then the PAT Value — The
PAT token you created above.

Once you have those information handy, then you can proceed to run config.cmd.

Follow through with the prompt until connection have been established and the agent successfully added.

If you configured the agent to run as a service, follow this step to restart the agent.

Once configured properly, your Agent should be online and available to be used when creating and running your pipeline.

If you found this guide helpful, please consider following me on Twitter and connecting on LinkedIn. Don’t forget to give this article a 👏 if you enjoyed reading it as a show of support. Thanks! ✌️



Oladipupo Olimene

Azure - Cloud, DevOps, IAC, Security, Automation & Monitoring