DEV Community

Alexey Ryazhskikh
Alexey Ryazhskikh

Posted on

Link between Azure VM Scale Set and Azure DevOps Agent Pool

This article describes link between Azure VM Scale Set and Azure DevOps agent pool.

Azure DevOps allows to create Agent Pool based on Azure VM Scale Set. With this setup Azure DevOps Agent Pool manages Azure ScaleSet to scale up or down number of agents depend on how many agents required for pipelines in particular moment.

Azure Agent Pool and VM Scale Set interaction

The scale set creates new instances of virtual machines with Azure Devops agent installed on it. Agent is able to interact with the pool after it is created.

There are two actions happen in time of Pool creation:

  • Azure DevOps adds tag __AzureDevOpsElasticPool="pool-name" to Azure Scale Set to identify scale set linked to it.
  • Azure DevOps adds Azure Pipelines Agent extension to virtual machine scale set and configures it with required PAT token. This extension is being called by scale set to install agent software to just created virtual machine. (Check Lifecycle of a Scale Set Agent manual) VM Scale Set extensions If you recreate vm scale set without __AzureDevOpsElasticPool tag or delete this tag you will see the following error in Diagnostics tab of your pool in Azure Devops UI: The Resource 'Microsoft.Compute/virtualMachineScaleSets/test-vmss' under resource group 'test-vmss-rg' was not found. For more details please go to Pool Error If you recreate VM scale set with __AzureDevOpsElasticPool tag, but without the Azure Pipelines Agent extension, you will have no agents connected to the Pool, bu Azure DevOps will upscale the number of VM instances.

The only way I know to add the Agent extension to scale set is to recreate Pool.
But here is an issue: you can't create pool with existing scale set if this scale set already has __AzureDevOpsElasticPool tag on it.

Top comments (0)