How to Configure an Azure DevOps self hosted Pipeline Agent

Azure DevOps is a tool you can use, for free (with an existing business subscription) that allows you to do a lot of things:

  • Store code in git repos
  • Plan projects with a kanban style board
  • Automate deployments with pipelines

The third option is the most interesting. When you push your code to the repo in Azure DevOps, you can set up a pipeline that will automatically take that code and execute steps you define to deploy it.

An example would be my use case. I write a Terraform plan on my iPad, push it to the Azure DevOps git repo, and the pipeline takes that code and uses it to deploy a new virtual machine on the server in my living room.

Pipeline Punch

Pipelines are not free. You do get some free pipeline hours of execution every month, but if you go over the allotted free tier values it gets very expensive.

One solution to this is to host your own pipeline and connect it to Azure DevOps. This means that instead of paying Microsoft to run this code, you have your own server that does it. This has a few benefits:

  • You can customize your server’s software
  • You can customize your server’s connectivity (such as a VPN that connects it to your house!)
  • You have control over every aspect of the pipeline, and can configure it to your needs!

The pipeline agent doesn’t have to be anything super powerful, depending on what you’re doing. But you can beef it up if you need more power, or you can slim it down to the minimum if you just need something lightweight.

I chose to run my pipeline agent on Digital Ocean. I will now go over the process of configuring a self hosted pipeline agent.

Setting up your own Custom Agent

First, you need a Linux server. I’m using Ubuntu 22.04 hosted on Digital Ocean for $6/month. This guide assumes you know how to install and configure a Linux server, so we won’t be covering that here.

The process is pretty simple. Let’s set up Azure DevOps.

First you will need to navigate to your Azure DevOps instance and click the settings icon in the bottom left hand corner of the screen.

Once in the settings menu, on the left hand side there should be a button that reads “agent pools.”

Click on the default pool and then select the “new agent” button in the upper right hand corner. Click the “Linux” tab.

You will then be able to download the agent, or copy the link. If you copy the link, you can simply download the agent on your Linux sever using the wget command.


You will need to do all of this from a non-root user with sudo permissions.

Next execute these commands to set up the server.

mkdir myagent && cd myagent

tar zxvf ~/Downloads/vsts-agent-linux-x64-3.232.1.tar.gz

Now you will need to configure your personal access token in Azure DevOps. This PAT is going to be the password that allows your agent to receive code and commands from Azure DevOps.

Click the settings icon in the upper right hand corner of the screen by your profile icon. Then click on the “personal access tokens” link.

Click the “new token” button in the upper right hand corner. On this next blade you can define what permissions the token has. In a business environment, you want to restrict this to the bare minimum permission. If this is your first time doing this, I would allow full access with the “full access” radio button at the top of this blade.

Note that a PAT will expire after a set amount of time you can define. You can set it to never expire, but you really shouldn’t.

Take a note of your PAT, you won’t be able to see it again after this. Also, take a note of your DevOps URL, it should look like

Next, connect to your pipeline agent server over SSH. You will run the following commands.

cd myagent

This will guide you through the install process. You will be asked for your DevOps URL and PAT, so have those ready.

Once you’ve finished filling out the forum for the installer, it will be present on your system. We’re almost there!

The last thing we need to do is configure the pipeline agent to operate as a systemd service. This will allow it to run in the background on the server, so we won’t have to manually invoke it. To do that you will run the “” script in the same directory you were just in.


Now if you navigate back to Azure DevOps, go back into the agent pool settings, default pool, you should see your pipeline agent as online and ready to receive commands!


Azure DevOps is a great tool you can utilize to really automate a lot of things. The possibilities are endless – and you don’t have to pay an extra penny for it! I hope you found this guide useful and hope to make more content for you soon.

Have a great rest of your day!