This article can help you set up fully automated deployment of Azure DevOps build agents. It explains step-by-step instructions on how to set up automated deployment of self-hosted agents using Azure DevOps Pipelines.

It is based on article VSTS/TFS automated build agent provisioning.


Setup and maintenance of build agents may be a daunting task. It requires configuration of Windows OS, installation of different development tools (like Visual Studio), etc. And then, when it is done, from time to time it is required to update the software, or install new software, or install security patches. This may be very time consuming.


Very easy solution

Microsoft provides Microsoft-hosted agents with different configurations. These agents are ready to use. Microsoft simply does all the hard work for you.

Custom solution

There might be situations where it’s not possible to use Microsoft-hosted agents. For example:

  • Custom software or special configuration is required on the agent.
  • Agent must be in Azure Virtual Network to have access to specific resources or VPN.
  • Agent must have pre-installed certification keys (bad practice).
  • Your product must comply with regulations of complete reproducibility, meaning that every build of your software must be reproducible by using the exactly same version of tools, operating system and patches. This is not possible with Microsoft-hosted agents because they are upgraded every month.

In such a case, you have to maintain your self-hosted agent by yourself. And this is what you need before you start:

  1. Azure DevOps organisation – I assume you already have this. And therefore, you need a build agent.
  2. Azure subscription – This article helps you to deploy agents in Microsoft Azure. If you want to use a different cloud provider or your own datacenter, you may use some scripts from here, but some parts must be implemented by yourself.

And there you have it! These are the tasks for setting up automated deployment of self-hosted build agents. Following tasks refer to GitHub repository that contains scripts for deployment.

  1. Set up Azure Resource Group
  2. Set up Azure DevOps project
  3. Create build agent image
  4. Deploy build agent

After the automated deployment is set up, it is very easy to upgrade or redeploy the build agent. First, upgrade the configuration source code for Packer. Then queue new build Build Agent Image. Finally, create new release Azure DevOps Build Agent.

News from ERNI

In our newsroom, you find all our articles, blogs and series entries in one place.

  • 27.09.2023.

    Unveiling the power of data: Part III – Navigating challenges and harnessing insights in data-driven projects

    Transforming an idea into a successful machine learning (ML)-based product involves navigating various challenges. In this final part of our series, we delve into two crucial aspects: ensuring 24/7 operation of the product and prioritising user experience (UX).

  • 13.09.2023.

    Exploring Language Models: An overview of LLMs and their practical implementation

    Generative AI models have recently amazed with unprecedented outputs, such as hyper-realistic images, diverse music, coherent texts, and synthetic videos, sparking excitement. Despite this progress, addressing ethical and societal concerns is crucial for responsible and beneficial utilization, guarding against issues like misinformation and manipulation in this AI-powered creative era.

  • 01.09.2023.

    Peter Zuber becomes the new Managing Director of ERNI Switzerland

    ERNI is setting an agenda for growth and innovation with the appointment of Peter Zuber as Managing Director of the Swiss business unit. With his previous experience and expertise, he will further expand the positioning of ERNI Switzerland, as a leading consulting firm for software development and digital innovation.

  • data230.08.2023.

    Unveiling the power of data: Part II – Navigating challenges and harnessing insights in data-driven projects

    The second article from the series on data-driven projects, explores common challenges that arise during their execution. To illustrate these concepts, we will focus on one of ERNI’s latest project called GeoML. This second article focuses on the second part of the GeoML project: Idea2Proof.

  • 16.08.2023.

    Unveiling the power of data: Part I – Navigating challenges and harnessing insights in data-driven projects

    In this series of articles (three in total), we look at data-driven projects and explore seven common challenges that arise during their execution. To illustrate these concepts, we will focus on one of ERNI’s latest project – GeoML, dealing with the development of a machine learning algorithm capable of assessing road accident risks more accurately than an individual relying solely on their years of personal experience as a road user, despite limited resources and data availability.


  • 09.08.2023.

    Collaborative robots revolutionising the future of work

    The future of work involves collaboration between robots and humans. After many years of integrating technology into work dynamics, the arrival of collaborative robots, or cobots, is a reality, boosting not only safety in the workplace but also productivity and efficiency in companies.

  • 19.07.2023.

    When the lid doesn’t fit the container: User Experience Design as risk minimisation

    Struggling with a difficult software application is like forcing a lid onto a poorly fitting container. This article explores the significance of user experience (UX) in software development. Discover how prioritising UX improves efficiency and customer satisfaction and reduces risks and costs. Join us as we uncover the key to successful software applications through user-centric design.

  • 21.06.2023.

    How does application security impact your business?

    With the rise of cyber threats and the growing dependence on technology, businesses must recognize the significance of application security as a fundamental pillar for protecting sensitive information and preserving operational resilience.