Member-only story

Run Self-Hosted Containerised Build Agents using Azure Container Instance and Azure DevOps

Alberto De Natale
3 min readApr 15, 2021

--

Running build agent in containers is a great solution for achieving flexibility and reducing the costs of maintaining build agents.

In this article, I will run through all the steps needed to start one.

Set up your Dockerfile

The first step is creating a folder containing a Dockerfile.

Create an Azure Container Registry

We then create an Azure Container Registry.

az group create --name buildagent --location uksouth
az acr create --resource-group buildagent --name alberto --sku Basic

Build the Dockerfile in the Cloud with a Task

We build our image using an Azure Registry Task.

az acr build --registry alberto -t buildagent:v1.0 --platform windows .

Create a Personal Access Token in Azure DevOps

In azure DevOps we create a personal access token that has “Read&Manage” permissions for “Agent Pools” and “Read&Execute” permission for “Build”.

We copy the token on a temporary location, we will need it soon!

Create an Agent Pool in Azure DevOps

Under “Organisation Settings” -> “Agent Pools” we create a new self-hosted agent.

Enable the Admin User in Azure Container Registry

The admin user can be enabled by running:

--

--

Alberto De Natale
Alberto De Natale

Written by Alberto De Natale

Alberto De Natale is a passionate tech-enthusiast software developer.

No responses yet

Write a response