Self-hosted agent
What it is
A self-hosted agent is the pipeline execution software you install and register on a machine you control (on-prem VM, a cloud VM, a container, or your laptop). It joins an agent pool and runs jobs there instead of on Microsoft/GitHub-hosted compute.
Why it exists
Microsoft-hosted/GitHub-hosted agents give convenience but no control: you can’t install custom tools, keep secrets on-prem, meet compliance/network requirements, or avoid per-minute billing. Self-hosted agents let you bring your own runtime while staying part of the same pipeline engine.
Key ideas
- Azure Pipelines: install the agent (
./config.sh), configure with a PAT + pool/agent name, register, and start (./run.sh). Agent needs outbound HTTPS to Azure DevOps; uses polling for jobs. - Registered at organization (pool) or project scope; jobs select it via
pool: <poolName>. - Capabilities/
demands:— declare tools (e.g.java,dotnet) so jobs request capable agents. - GitHub Actions: self-hosted runners added at repo/org/enterprise level, chosen with
runs-on: [self-hosted, linux, x64]. - Agents are single-job at a time (one agent = one concurrent job) unless you register multiples.
Exam notes
- Self-hosted agent requires outbound internet to Azure DevOps / GitHub; no inbound required (agents poll).
- Use a PAT with the correct scope (
Agent Pools: Read & manage) when configuring. - Demand/capability matching is a classic exam item.
- Managed agents simplify upgrades; self-hosted means you patch and maintain the machine.
Related
agent-pool · azure-pipelines · github-actions
📘 Source: Microsoft Learn — Self Hosted Agent