Skip to content
Latchkey

How to Run on Self-Hosted Agents in Azure Pipelines

Name a self-hosted pool instead of a Microsoft-hosted vmImage to run jobs on agents you control.

Register agents into a pool, then set pool.name to that pool. Add demands to require capabilities so a job only runs on an agent that advertises them.

Steps

  • Create an agent pool and register one or more self-hosted agents.
  • Set pool.name to the pool instead of vmImage.
  • Add demands to require specific capabilities.

Pipeline

azure-pipelines.yml
pool:
  name: linux-builders
  demands:
    - docker
    - Agent.OS -equals Linux
steps:
  - script: docker build -t app .
    displayName: Build on a self-hosted agent

Gotchas

  • A job stays queued indefinitely if no online agent satisfies its demands.
  • Capabilities come from the agent environment; set custom ones in the pool UI.
  • Self-hosted agents preserve disk state between runs, so clean workspaces yourself if needed.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →