Hi @Jurriën de Gelder ,
It looks like your pool is provisioning agents but then immediately returning them (or timing out) so your jobs end with exit code 2. That usually means the VM never fully boots up or can’t reach Azure DevOps to register.
Please try below and confirm:
- Validate your network connectivity
- Run the MDP connectivity script on a VM in your subnet: https://learn.microsoft.com/azure/devops/managed-devops-pools/configure-networking?view=azure-devops&tabs=azure-portal#validate-endpoint-connectivity
- Make sure it can reach the Azure DevOps control plane, the CDN (
download.agent.dev.azure.com), agent-package URLs and storage endpoints.
- Check firewall/NSG/DNS/UDRs
- Ensure outbound HTTPS (TCP 443) to all required Azure DevOps IPs and domains is allowed: https://learn.microsoft.com/azure/devops/organizations/security/allow-list-ip-url
- Review any custom DNS servers or user-defined routes that might block or redirect traffic.
- Review pool diagnostics & agent logs
- In the Azure portal, go to your MDP pool’s Diagnostics tab—grab the logs around the failure and look for agent startup errors.
- In your YAML, set
variables: system.debug: trueso you get verbose agent initialization logs in the pipeline run.
- Consider pre-provisioned (standby) or stateful agents
- If you have Standby agent mode off, new agents can take up to ~15 minutes to spin up—and the pool times out if they aren’t ready. See delays here: https://learn.microsoft.com/azure/devops/managed-devops-pools/troubleshooting?view=azure-devops#delays-in-pipeline-startup
- Either switch to manual/automatic standby agents or use a stateful pool with a short grace period so agents remain online between jobs.
- Double-check quotas & image settings
- Verify you haven’t hit the per-SKU core quota: https://learn.microsoft.com/azure/devops/managed-devops-pools/prerequisites?view=azure-devops#review-managed-devops-pools-quotas
- If you’re using a custom image and pre-caching the agent, ensure your sentinel file (
.complete) is in place per: https://learn.microsoft.com/azure/devops/managed-devops-pools/configure-images?view=azure-devops
Hope this helps!
If the resolution was helpful, kindly take a moment to click on and click on Yes for was this answer helpful. And, if you have any further query do let us know.