Share via

Managed DevOps Pool agent error: Exit Code 2 in azure devops pipelines

Jurriën de Gelder 20 Reputation points
2026-05-20T13:17:39.6833333+00:00

Hello community,

Since a day or two my Managed DevOps pools is causing problems: it is trying to get a agent from the pool but it seems like it cannot fetch an agent. I tried many times: one time the pipeline will fail within seconds and the other time a pipeline will fail after 15 minutes. Either way, in the MDP I see provisioned agents AND agents that are ready, but as soon as allocation starts a few seconds after the state will become returned and the pipeline will give exit code 2 and cancel. Some things to mention:

  • Last week the agents worked just fine
  • I checked quota limit and did not exceed
  • I checked image version but it is still the same
  • It is in private network and al steps are taken to make the pools work: ingested in vnet with a subnet, firewall rules are set (and as mentioned before last week they did work)

Wanted to add:

  • maximum agents did not exceed
  • parallel jobs did not exceed
  • no error has been shown in de MDP pool overview error code

Behavior I see is: Agent is ready -> Allocated -> Returned

Who can help me with this issue??

enter image description here

Azure DevOps

Answer accepted by question author

Pravallika KV 16,945 Reputation points Microsoft External Staff Moderator
2026-05-20T14:00:17+00:00

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:

  1. Validate your network connectivity
  1. Check firewall/NSG/DNS/UDRs
  1. 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: true so you get verbose agent initialization logs in the pipeline run.
  1. Consider pre-provisioned (standby) or stateful agents
  1. Double-check quotas & image settings

Hope this helps!


If the resolution was helpful, kindly take a moment to click on User's imageand click on Yes for was this answer helpful. And, if you have any further query do let us know.

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.