Introduction
Azure DevOps pipelines require agents to run jobs. When all agents are busy, new pipeline runs queue indefinitely, blocking deployments and delaying development workflows.
Symptoms
Pipeline queued indefinitely:
# Pipeline stuck in queue
# Azure DevOps UI shows:
"Waiting for an available agent"
"0 agents available"Agent pool warning:
"This job is pending approval or waiting for available agent"
"Agent pool 'Default' has no available agents"Build timeout:
# Pipeline times out waiting for agent
##[error] The job has timed out after waiting for 60 minutes to be picked up by an agent.Common Causes
- 1.Not enough agents - Pool size too small for workload
- 2.Agents offline - Agents disconnected or disabled
- 3.Long-running jobs - Jobs blocking agents for hours
- 4.Parallel job limit - Exceeded Microsoft-hosted parallel jobs
- 5.Stuck pipelines - Cancelled jobs still holding agents
- 6.Agent health issues - Agents unhealthy but not removed from pool
- 7.Demand mismatch - No agents matching job demands
Step-by-Step Fix
- 1.Check logs for specific error messages
- 2.Verify configuration settings
- 3.Test network connectivity
- 4.Review recent changes
- 5.Apply corrective action
- 6.Verify the fix
Step 1: Check Agent Pool Status
```bash # List agent pools az pipelines pool list
# Get agents in pool az pipelines agent list --pool-id 1 --query "[].{Name:name,Status:status,Enabled:enabled}"
# Check via Azure DevOps UI: # Organization Settings > Agent pools > [Pool name] > Agents ```
Step 2: Identify Running Jobs
```bash # List running pipelines az pipelines run list --org https://dev.azure.com/ORG --project PROJECT --status inProgress
# Check which jobs are using agents # Azure DevOps > Pipelines > Runs > [Select run] > Job details ```
Step 3: Cancel Stuck Pipelines
```bash # Cancel stuck pipeline run az pipelines run cancel --run-id 123 --org https://dev.azure.com/ORG --project PROJECT
# Cancel all stuck runs az pipelines run list --status inProgress --query "[?createdDate < '2024-01-01'].id" -o tsv | \ xargs -I {} az pipelines run cancel --run-id {} ```
Step 4: Scale Self-Hosted Agents
```bash # Add more agents to pool # Option 1: Scale agent VMs az vmss scale \ --name my-agent-vmss \ --resource-group my-rg \ --new-capacity 10
# Option 2: Add agents manually # Download agent from Azure DevOps # Project Settings > Agent pools > [Pool] > New agent
# Configure agent ./config.sh --unattended \ --url https://dev.azure.com/ORG \ --auth pat \ --token YOUR_PAT \ --pool "Default" \ --agent "agent-$(hostname)" \ --acceptTeeEula ```
Step 5: Increase Microsoft-Hosted Parallel Jobs
```bash # For Microsoft-hosted agents, request more parallel jobs # Organization Settings > Billing > Change billing # Or Azure Portal > Azure DevOps > [Organization] > Billing
# Free tier: 1 parallel job # Paid: Up to 10 parallel jobs per organization
# Check current usage az devops user show --user user@example.com --query 'accessLevel' ```
Step 6: Configure Pipeline Demands
```yaml # Ensure pipeline runs on agents with required capabilities pool: name: 'Default' demands: - agent.os -equals Linux - Docker - java
# Check agent capabilities # Azure DevOps > Agent pools > [Pool] > [Agent] > Capabilities ```
Step 7: Optimize Pipeline Duration
```yaml # Reduce job duration to free agents faster
# Use job timeouts jobs: - job: Build timeoutInMinutes: 30 # Default is 60 cancelTimeoutInMinutes: 5
# Use parallel jobs strategy: parallel: 4 # Run 4 parallel jobs
# Use matrix strategy strategy: matrix: linux: os: linux windows: os: windows maxParallel: 2 # Limit concurrent ```
Step 8: Fix Offline Agents
```bash # Check agent status az pipelines agent show --pool-id 1 --agent-id 1
# Common causes of offline agents: # 1. Agent service stopped (Windows: sc start vstsagent, Linux: sudo ./svc.sh start) # 2. VM deallocated # 3. Network connectivity issues # 4. PAT token expired
# Restart agent service # On agent machine: sudo ./svc.sh stop sudo ./svc.sh start
# Or on Windows: net stop vstsagent.account.project.pool net start vstsagent.account.project.pool ```
Step 9: Set Up Auto-Scaling
```yaml # Use Azure VMSS with auto-scale # Create scale set with custom script extension
# scale-policy.json { "name": "autoscale", "properties": { "enabled": true, "profiles": [{ "name": "ScaleOut", "capacity": { "minimum": "2", "maximum": "20", "default": "5" }, "rules": [{ "metricTrigger": { "metricName": "Percentage CPU", "operator": "GreaterThan", "threshold": 70 }, "scaleAction": { "direction": "Increase", "type": "ChangeCount", "value": "2" } }] }] } }
az monitor autoscale create \ --resource-group my-rg \ --resource /subscriptions/SUB/resourceGroups/my-rg/providers/Microsoft.Compute/virtualMachineScaleSets/my-vmss \ --autoscale-policy @scale-policy.json ```
Step 10: Monitor Agent Pool Health
```bash # Create alert for agent availability az monitor metrics alert create \ --name ado-agent-pool-alert \ --resource-group my-rg \ --scopes /subscriptions/SUB/resourceGroups/my-rg/providers/Microsoft.Compute/virtualMachineScaleSets/my-vmss \ --condition "avg Percentage CPU > 80" \ --window-size 5m
# Monitor pipeline queue times # Azure DevOps > Analytics views > Pipeline runs # Filter by queue duration ```
Agent Pool Configuration Checklist
| Setting | Recommendation |
|---|---|
| Pool size | >= expected concurrent jobs |
| Agent version | Latest stable |
| Job timeout | Reasonable for workload |
| Demands | Match agent capabilities |
| Parallel jobs | Scale to workload |
Verification
```bash # After scaling or fixing agents, run test pipeline az pipelines run --name test-pipeline --branch main
# Check run status az pipelines run show --run-id 123 --query 'status'
# Should show "inProgress" or "completed" instead of "queued"
# Check agent availability az pipelines agent list --pool-id 1 --query "[?status=='online'].{Name:name,Status:status}"
# Should show available online agents ```
Related Issues
- [Fix Azure DevOps Service Connection Failed](/articles/fix-azure-devops-service-connection-failed)
- [Fix Azure DevOps Pipeline Variable Not Found](/articles/fix-azure-devops-pipeline-variable-not-found)
- [Fix Azure DevOps Check Failed](/articles/fix-azure-devops-check-failed)
Related Articles
- [Technical troubleshooting: Fix Cicd Artifact Upload Failed Storage Issue in C](cicd-artifact-upload-failed-storage)
- [Technical troubleshooting: Fix Cicd Code Quality Gate Failed Sonarqube Issue ](cicd-code-quality-gate-failed-sonarqube)
- [Technical troubleshooting: Fix Cicd Deployment Failed Health Check Issue in C](cicd-deployment-failed-health-check)
- [Technical troubleshooting: Fix Cicd Github Actions Workflow Queue Timeout in ](cicd-github-actions-workflow-queue-timeout)
- [Technical troubleshooting: Fix Cicd Gitlab Runner Stuck Pending Issue in CI/C](cicd-gitlab-runner-stuck-pending)
<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Fix Azure DevOps Agent Pool Full", "description": "Troubleshoot Azure DevOps agent pool full errors. Scale agents, fix stuck jobs, and optimize pipeline parallelism.", "url": "https://www.fixwikihub.com/fix-azure-devops-agent-pool-full", "publisher": { "@type": "Organization", "name": "FixWikiHub", "url": "https://www.fixwikihub.com" }, "author": { "@type": "Person", "name": "FixWikiHub Editorial Team" }, "datePublished": "2026-04-02T14:40:35.269Z", "dateModified": "2026-04-02T14:40:35.269Z" } </script>