How To Create Custom Agent for Azure Pipeline

In this article, we will learn how we can create custom agent for our azure pipeline. We can use this agent in the auto deployment process to VM machine.

This agent are the one which I mentioned in the article here Auto Deploy To Azure VM Using TFS Portal (Part 1) – The Code Hubs. So, it will simply build your code from the connected repository and publish it to the VM machine.


The device which we are using as agent must have all the application which are required to build the project. For example, if you want to deploy the .Net Core project then the agent machine must have the .Net frameworks.

Step 1:

Go to the Organization Setting > Agent Pool. Click the new agent button to create the agent.


Step 2:

Download the zip file using the download button in the popup


Step 3:

Once the download is completed. Open power shell (“Run as Administrator”) in the agent device. Move to the root folder using cd.. command. Then fire the below command. First command will create the agent folder.

mkdir agent ; cd agent

Step 4:

Then once the directory is created, fire the below command to extract the downloaded files.

Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$HOME\Downloads\", "$PWD")

Step 5:

After than we need to configure the agent. So, fire the below command to configure it.


Step 6:

Once you fire the above command it will ask few questions. First is to enter the server url. It will be your azure devops service url.{your-organization}

Step 7:

Then it will ask for authentication type. Just press enter to move forward. It will take PAT (Personal Access Token) as default

Step 8

Now, you will need a personal access token to move forward. So, we need to generate it from the setting section.

Step 9

Click “New Token” button and enter the name for the token. I have used “Agent” as the name, as I am creating this key for agent. Select full access for scope.

Step 10

Once you create the token it will give a long string. Copy the string and save it in your system. Please save it as we won’t get it again from the system.

Step 11

Use the token we get from above step to move forward.

Step 12:

Once you enter the token, it will connect to the server. After that it will ask for agent registration. Press enter for agent pool question as we are creating agent in default agent pool. Then, it will ask for agent name. Enter the agent name which you want for that device. It will be displayed in our Azure devOps Agent section.

Step 13:

Then it will scan for capabilities. Once the agent is successfully added, it will ask for the work folder. This will be the folder name where the build files will be saved. To use the default folder (_work) just press enter. Then again press enter for N in the unzip question

After that it will ask to run agent as service. We need to give ‘Y’ for this question as we want our agent to be available without user interaction.

Step 14:

After that it will ask for account to use for service. Just press enter for the default login. Once the authentication setting is saved then agent created sucessfully.

Step 15:

We can check the agent in the devOps agent list. It will show as online if the process is successfully done.


Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories