MicrosoftTeams-image (32)

Azure DevOps Self Hosted Build Agents

Reading Time: 4 minutes

Agent is a server with the appropriate Operating System and the tools installed and configured.

Azure DevOps Supports below two agents :

  • Microsoft agents – These Agents are totally manages by azure
  • Self-Hosted Agents – These agents are configured by the user according to their needs.

In this Section We will see how to configure a self hosted agent for Windows And Linux VM

Creating a Personal Access Token (PAT)

Before We start configuring agents we need to create a PAT token.

Step 1. Login to Azure DevOps organization, open user settings, and select “Personal access tokens”

Step 2. In Personal Access Token Page, click on new token to Create the new token

Step 3. Provide the details Name of the token Expiration Date and permissions to this token

Note: Make sure to give full access for pipelines

Step 4. Once the token is generated, save it and use it in configuring agents.

Installing & configuring the agents

We have created the token so now we can start configuring the self hosted agents

Below are the steps to create a self hosted agents

Step 1. Navigate to the organization setting and then click on Agents pools.

Step 2. Select the Default Pool or You can create your own pool By clicking Add Pool

Step 3. Now Click on new agent and follow the steps mentioned in that

Step 4. You can select the desired operating system also

Windows Installation

Step 1. First Download the agent it will create a zip file

Step 2. Now extract the zip file to the target location( it is recommended to save in C: drive)

# Create directory and navigate to the directory

New-Item -Path “C:” -Name “agents” -ItemType “directory”

Set-Location -Path “C:agents”

# Extract the downloaded zip file

Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory(“”, “$PWD”)

# Verify the extraction


Step 3. Start configuring the agent by below command


It will ask you some question which are mentioned below

  • Enter the URL:{your-organization}
  • Enter the authentication type (press enter for PAT) – Press enter for this step.
  • Enter personal access token. – Paste the PAT generated earlier
  • Enter Agent Pool – Press Enter if you are creating an agent in the default Agent pool, otherwise, provide the name of the Agent Pool
  • Enter Agent Name – Provide the Agent Name
  • Enter run agent as Service – Press Y for this in order to install & Run the Agent as a service in the Virtual Machine.

Step 4. Now Go back to the agent pool and now you can see the agent under the pool

Linux Installation

Installing and configuring the pipeline agent in Linux is similar to Windows. So, here we can see how to install Linux Agent

Step 1. Download the agent


Step 2. Create a folder and extract the downloaded tar.gz file.

# Create directory and navigate to the directory

mkdir agent

cd agent

# Extract the downloaded zip file

tar zxf ~/Downloads/vsts-agent-linux-x64-2.195.1.tar.gz

# Verify the extraction


Step 3. Start configuring the giving below command


Similar to Windows configuration, the users will be asked to enter the server details, authentication type, and the authentication token we created earlier. Then configure the agent details, and finally, the user can start the agent by running the script.

Step 4 (Optional). You can configure the agent to run as a system service using the script located in the agent directory. Specify the user and use the install command to configure the service.

sudo ./ install [user name]

sudo ./ start

Step 5. Now go back to the agent Pool and under this pool you will get the agent running

Share on facebook
Share on twitter
Share on linkedin
Share on google
Share on whatsapp
Share on email
Tags: No tags

Add a Comment

You must be logged in to post a comment