In Azure Devops, let’s say you have three self-hosted agents that run on three different Windows Servers and they are all part of the Default agent pool. When you create a build you’re only able to specify what agent pool to pull from. If your wanting to create the build to run a specific agent (windows server) where do you specify this or how does it know to grab the right agent?? If you could please provide and explanation on how this works.
Thank you
2
Answers
Firstly, you can add different capabilities for each of those Agents (even if they are in the same pool). Add them as User defined capabilities.
See : https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#configure-agent-capabilities
And then in your azure pipelines yaml, you can add that user defined capability as a demand under the pool used : https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/pool?view=azure-pipelines#pool-name-demands-vmimage
Azure will then only use an agent in that pool that matches all your demands.
According to your description, we suppose that the definition for agent pool demands of yaml schema could work for your scenario
If you are using classic pipeline editor, you could also define your self-hosted agent pools demands to specify the specific capabilities for the agents.