How to add an Agent in the Azure DevOps Pipeline

female engineer controlling flight simulator
Reading Time: 3 minutes

What is Agent?

An agent is a service that runs the jobs of your pipeline in other words we can say it is a computing infrastructure (maybe any VM or local machine) with installed agent software to run the pipeline jobs.

When you build and deploy code using ADO Pipelines you need at least one agent.

There are two types of Agent in ADO

  • Microsoft-hosted agents
  • Self-hosted agents

Here I am going to show how Self-hosted agents link to your ADO Pipelines

Steps to Connect Agent

Step 1: Go to the ADO portal and select the project inside the project go to the project setting and select the Agent pools. In the below image, you can see the Agent pools section and click on Add pool.

Step 2: After that, you select the self-hosted and give the Name section to give the agent name. Here I am given permission to all pipelines.

Step 3: You can install agents on different machines, I install agents on my Linux machine that it shows the commands to install agents on my Linux machine.

here I am installing it on my local machine you can install it on VM also.

After the download, you can create a directory and extract the files

Step 4: After extracting the files, run the shell script ./config.sh which helps to configure Azure pipelines.

Enter the Y to accept the license agreement.

To connect the pipeline you need to Enter the server URL, and a personal access token (PAT) you can get the personal access token inside the user setting in the ADO portal. After that enter the agent pool name that we have given in the ADO portal in my case I give the agent-local.If you want to give an agent name you can give one else it fetches the default name.

Step5: After configuration, you run the agent by the shell script ./run.sh

To verify the agent is running you can go to the agent section and here the show green light means it is running.

Now, these are the steps to link the Self-hosted agent into your ADO pipeline.

References

Official Doc

Written by 

Harshit Gupta is a Software Consultant at knoldus Inc having few year experience in DevOps . He always eager to learn new technology and helping to others .

Leave a Reply