Azure DevOps Agent Pools Configuration¶
Overview¶
Agent pools in Azure DevOps organize and manage build agents. This guide covers creating and configuring agent pools for self-hosted agents on Hetzner Cloud.
Prerequisites¶
- Azure DevOps organization administrator access
- Self-hosted agents installed and configured (see Linux Setup or Windows Setup)
Step 1: Create Agent Pools¶
Navigate to Agent Pools¶
- Log into Azure DevOps: https://dev.azure.com
- Click Organization Settings (gear icon in top right)
- Navigate to Pipelines → Agent pools
Create Linux Agent Pool¶
- Click Add pool
- Select Self-hosted as pool type
- Enter pool name:
Hetzner-Linux - Click Create
Create Windows Agent Pool¶
- Click Add pool
- Select Self-hosted as pool type
- Enter pool name:
Hetzner-Windows - Click Create
Step 2: Configure Pool Settings¶
General Settings¶
For each pool:
- Click on the pool name (e.g., Hetzner-Linux)
- Go to Settings tab
-
Configure:
-
Auto-provision: Disabled (manual management)
- Pipeline permissions: Grant access to required projects
- Agent download: Allow agents to download from this pool
Pipeline Permissions¶
- In pool settings, go to Security tab
- Click Add under Project Administrators or Project Collection Administrators
- Add users or groups that need access
- Set permissions:
- View agent pool: Allow
- Use agent pool: Allow
- Manage agent pool: Allow (for administrators)
Step 3: Register Agents to Pools¶
Agents are registered during installation (see Linux Setup or Windows Setup).
Verify Agent Registration¶
- Navigate to Agent pools → Hetzner-Linux (or Hetzner-Windows)
- Go to Agents tab
- Verify agents appear in the list
- Check agent status:
- Online (green): Agent is running and available
- Offline (gray): Agent is not running or cannot connect
Manual Agent Registration (if needed)¶
If an agent was not registered during installation:
Linux¶
cd ~/azagent
./config.sh \
--url https://dev.azure.com/ConnectSoft \
--auth pat \
--token <PAT_TOKEN> \
--pool "Hetzner-Linux" \
--agent "hetzner-linux-01" \
--replace
Windows¶
cd C:\azagent
.\config.cmd `
--url https://dev.azure.com/ConnectSoft `
--auth pat `
--token <PAT_TOKEN> `
--pool "Hetzner-Windows" `
--agent "hetzner-windows-01" `
--replace
Step 4: Configure Agent Capabilities¶
Agent capabilities help pipelines select the right agent for their requirements.
View Agent Capabilities¶
- Navigate to Agent pools → Hetzner-Linux → Agents
- Click on an agent name
- Go to Capabilities tab
System Capabilities¶
These are automatically detected:
- Agent.OS: Linux or Windows_NT
- Agent.OSArchitecture: X64, ARM, etc.
- Agent.Version: Agent version number
Add Custom Capabilities¶
- In agent Capabilities tab, click Add capability
- Add capabilities:
For Linux Agents:
- Docker: true (if Docker installed)
- DotNet: 9.0.x (if .NET SDK installed)
- Node: 20.x (if Node.js installed)
For Windows Agents:
- DotNet: 9.0.x (if .NET SDK installed)
- VisualStudio: true (if Visual Studio Build Tools installed)
- Node: 20.x (if Node.js installed)
- Click Save
Step 5: Configure Pipeline Demands¶
Update Pipeline YAML¶
Update your pipeline YAML files to use the agent pools:
# Linux Pipeline
pool:
name: 'Hetzner-Linux'
demands:
- Agent.OS -equals Linux
- DotNet -equals 9.0.x # Optional: require specific .NET version
# Windows Pipeline
pool:
name: 'Hetzner-Windows'
demands:
- Agent.OS -equals Windows_NT
- DotNet -equals 9.0.x # Optional: require specific .NET version
Demand Options¶
- Exact match:
Agent.OS -equals Linux - Contains:
Agent.OS -contains Linux - Version comparison:
DotNet -gtVersion 8.0.0 - Multiple demands: All must be satisfied (AND logic)
Step 6: Test Agent Pools¶
Create Test Pipeline¶
Create a simple test pipeline:
trigger: none
pool:
name: 'Hetzner-Linux' # or 'Hetzner-Windows'
demands:
- Agent.OS -equals Linux
steps:
- script: |
echo "Running on self-hosted agent"
uname -a
df -h
displayName: 'Test Agent'
Verify Execution¶
- Run the pipeline
- Check that it uses the self-hosted agent
- Verify build completes successfully
- Review agent logs if issues occur
Step 7: Monitor Agent Health¶
Agent Status¶
Monitor agent status in Azure DevOps:
- Navigate to Agent pools → Hetzner-Linux → Agents
- Check agent status indicators:
- Green: Online and available
- Gray: Offline
- Yellow: Running a job
Agent Statistics¶
View agent usage statistics:
- In agent pool, go to Agents tab
- Click on an agent
- View History tab for job execution history
- Check Capabilities tab for installed tools
Step 8: Manage Multiple Agents¶
Load Balancing¶
Azure DevOps automatically distributes jobs across available agents in a pool.
Agent Naming Convention¶
Use consistent naming:
- Linux: hetzner-linux-01, hetzner-linux-02, etc.
- Windows: hetzner-windows-01, hetzner-windows-02, etc.
Scaling Agents¶
To add more agents:
- Provision new Hetzner Cloud server
- Install agent (see Linux Setup or Windows Setup)
- Register to existing pool
- Agent will automatically appear in pool
Troubleshooting¶
Agent Not Appearing in Pool¶
- Verify agent configuration points to correct pool name
- Check PAT token has Agent Pools (Read & Manage) permission
- Review agent installation logs
- Ensure agent service is running
Pipeline Cannot Find Agent¶
- Verify pool name matches exactly (case-sensitive)
- Check agent demands match agent capabilities
- Ensure agent is online and available
- Review pipeline logs for demand matching errors
Agent Offline¶
- Check agent service is running
- Verify network connectivity to Azure DevOps
- Review agent logs for errors
- Check firewall rules allow outbound HTTPS (443)
Best Practices¶
- Separate Pools: Use separate pools for Linux and Windows
- Naming Convention: Use consistent agent naming
- Capabilities: Document all agent capabilities
- Monitoring: Regularly check agent health
- Scaling: Monitor queue times and scale agents as needed
- Security: Use PAT tokens with minimal required permissions
- Documentation: Document pool configuration and agent setup
Next Steps¶
- Set up monitoring and maintenance procedures
- Review troubleshooting guide for common issues
- Configure pipeline updates to use agent pools