To build your code or deploy your solution, you need an agent. Agents can be self-hosted or hosted by some other entity in the cloud, such as Microsoft. Microsoft-hosted agents have their benefits, such as no maintenance. Similarly, self-hosted agents have the benefit of allowing you to have greater control over your agent and install specific software. One issue that both types of agents experience is scalability. This problem can be solved by using Azure Virtual Machine Scale Set agents.

Use Cases

Azure Virtual Machine Scale Set agents are a form of self-hosted agents that can be scaled automatically to meet your needs. This means that the management of your self-hosted agents will be simplified. For example, you’ll be able to de-provision agent machines instead of running them around the clock, therefore cutting down on costs.

Because they are self-hosted, you have control over the size and the image of the machines on which the agents run. Scale set agents can also be helpful if you have specific requirements, such as the need to restrict network connectivity of agent machines or running configuration warmups before the agent begins accepting jobs.

As a note, you can only run Windows or Linux agents using scale sets.

Creating the scale set

First, you must create a Virtual Machine Scale Set in the Azure portal. This is what will allow you to create and manage a group of load-balanced virtual machines that will be your agents. Azure Pipelines will manage your VMSS agents by making sure there is always the appropriate number of agents available for jobs. The number of VM instances will increase or decrease based on demand or a defined schedule. Therefore, you must configure settings such as autoscaling and overprovisioning to ensure Pipelines can determine how to do this effectively.

After your Virtual Machine Scale Set is created, you need to then create and configure the scale set agent pool in Azure Pipelines. This is where you can decide if you want to do things like automatically tear down the virtual machine after each use or have virtual machines run interactive tests. Additionally, you’ll set the number of agents you want on standby for jobs, as well as the maximum number of agents allowed in the scale set.

Using a scale set agent pool is just like using any other agent pool. So, with your scale set agent pool successfully created, you’re ready to use it in your build, release, or YAML pipelines. For more information, or to get started today, contact our team of experts here at PRAKTIK.