azureazure-devopsazure-pipelinesazure-pipelines-yamlazure-pipelines-release-task

Assign specific agent on Azure DevOps YAML Pipelines


I am trying to assign a specific agent on my agent pool but I don't know how to do it. Does anyone know it?

I tried with this but doesn't work:

- stage: Deploy
  pool: alm-aws-pool
    agent.name: deploy-05-agent1

Solution

  • The pool name needs to be added to the name field, then you could add demands and check the agent name with the equals operator. You may try the following Yaml Code:

    stages:
    - stage: Deploy
      pool: 
       name: <agent-pool-name>
       demands:
        - Agent.Name -equals <agent-name>
      jobs:
      - job: BuildJob
        steps:
        - script: echo Building!
    

    Please check if it works.