Skip to content

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

  1. Log into Azure DevOps: https://dev.azure.com
  2. Click Organization Settings (gear icon in top right)
  3. Navigate to PipelinesAgent pools

Create Linux Agent Pool

  1. Click Add pool
  2. Select Self-hosted as pool type
  3. Enter pool name: Hetzner-Linux
  4. Click Create

Create Windows Agent Pool

  1. Click Add pool
  2. Select Self-hosted as pool type
  3. Enter pool name: Hetzner-Windows
  4. Click Create

Step 2: Configure Pool Settings

General Settings

For each pool:

  1. Click on the pool name (e.g., Hetzner-Linux)
  2. Go to Settings tab
  3. Configure:

  4. Auto-provision: Disabled (manual management)

  5. Pipeline permissions: Grant access to required projects
  6. Agent download: Allow agents to download from this pool

Pipeline Permissions

  1. In pool settings, go to Security tab
  2. Click Add under Project Administrators or Project Collection Administrators
  3. Add users or groups that need access
  4. Set permissions:
  5. View agent pool: Allow
  6. Use agent pool: Allow
  7. 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

  1. Navigate to Agent poolsHetzner-Linux (or Hetzner-Windows)
  2. Go to Agents tab
  3. Verify agents appear in the list
  4. Check agent status:
  5. Online (green): Agent is running and available
  6. 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

  1. Navigate to Agent poolsHetzner-LinuxAgents
  2. Click on an agent name
  3. 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

  1. In agent Capabilities tab, click Add capability
  2. 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)

  1. 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

  1. Run the pipeline
  2. Check that it uses the self-hosted agent
  3. Verify build completes successfully
  4. Review agent logs if issues occur

Step 7: Monitor Agent Health

Agent Status

Monitor agent status in Azure DevOps:

  1. Navigate to Agent poolsHetzner-LinuxAgents
  2. Check agent status indicators:
  3. Green: Online and available
  4. Gray: Offline
  5. Yellow: Running a job

Agent Statistics

View agent usage statistics:

  1. In agent pool, go to Agents tab
  2. Click on an agent
  3. View History tab for job execution history
  4. 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:

  1. Provision new Hetzner Cloud server
  2. Install agent (see Linux Setup or Windows Setup)
  3. Register to existing pool
  4. 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

  1. Separate Pools: Use separate pools for Linux and Windows
  2. Naming Convention: Use consistent agent naming
  3. Capabilities: Document all agent capabilities
  4. Monitoring: Regularly check agent health
  5. Scaling: Monitor queue times and scale agents as needed
  6. Security: Use PAT tokens with minimal required permissions
  7. Documentation: Document pool configuration and agent setup

Next Steps

References