Automation
Azure Managed DevOps Pools: diagnose image drift before pinning tools
A production runbook for tying a pipeline failure to the image version that actually ran, canarying the repair, and choosing promotion or rollback without hiding drift.
An Azure DevOps pipeline that worked yesterday suddenly fails because a command is missing, an SDK version is incompatible, or a certificate is no longer trusted. The repository and YAML did not change. The quick response is often to install the missing tool in the job or pin every version inside the pipeline.
That workaround may recover one run, but it moves image ownership into every pipeline and hides the cause. In Azure Managed DevOps Pools, the job may have received a new image version, a different image from the pool, a retained stateful agent, or a fresh machine whose provisioning did not produce the intended contract.
The running case is a pool named mdp-platform-prod with two images. After an update, some jobs find the expected SDK and others do not. The goal is to prove which image actually ran, isolate the change, test a candidate version, and choose promotion, rollback, or a provisioning repair.
Freeze one run and its execution contract
Keep one failed run and the last known good run. Record their commit, template, pool, demands, agent, image, image version, UTC timestamp, and first divergent command. Do not compare application logs alone: the execution contract starts before the first business step.
pool: mdp-platform-prod
failed_run: 18432
healthy_run: 18397
commit: 9d6f2c1
expected:
image_alias: ubuntu-24.04-gen2
image_version: 20261001.1.0
dotnet: 9.0.x
node: 24.x
observed:
agent_name: mdp-platform-prod-7f2a
first_failure: dotnet SDK not found
queue_delay_seconds: 38
containment:
production_deployments: paused
pipeline_tool_install: forbidden_until_root_cause
retry: one_diagnostic_canary_only Add a short, non-sensitive inventory at the start of the canary: Agent.Name, Agent.OS, Agent.Version, ImageOverride, tool paths, runtime versions, and a fingerprint for the expected certificate. This is diagnostic evidence, not permission to dump every variable or the full environment.
Prove which image the scheduler selected
When a pool contains several images, a pipeline without an explicit selection uses the first configured image. An ImageOverride demand routes the job to the matching alias. An ImageVersionOverride demand selects one version and starts an on-demand machine when standby agents do not match it.
Inspect the rendered YAML, including templates and parameters. A demand in an unused template, an alias with different casing, or a reordered image list can create drift that is invisible in the application commit.
pool:
name: mdp-platform-prod
demands:
- ImageOverride -equals ubuntu-24.04-gen2
- ImageVersionOverride -equals 20261001.1.0
steps:
- bash: |
set -euo pipefail
echo "agent=$AGENT_NAME os=$AGENT_OS version=$AGENT_VERSION"
command -v dotnet
dotnet --info
command -v node
node --version
displayName: Inventory candidate image Use the override as a canary control, not a silent permanent fix. It lets you compare the previous image and the candidate with the same commit and inputs. The useful result is a reproducible difference tied to the version, not one lucky pass.
Separate image, provisioning, and retained state
The base image is only one layer. A provisioning script can install a corporate CA, set environment variables, or prepare tooling before the agent receives a job. A managed identity that cannot read the script blob, an incomplete download, or a script that exits without checking postconditions can leave the machine outside its intended contract.
For every tested version, separate four facts:
- image configured on the pool;
- image version observed on the agent;
- provisioning result and its logs;
- tools and certificates available when the job starts.
For a stateful pool, also determine whether the job reused an existing agent. A cache, work folder, or tool installed by an earlier job can create a false pass. Run at least one test on a fresh agent and make the diagnosis independent of a warm cache.
Fresh agent, previous version, pass
Regression probably belongs to the new image or its provisioning
Fresh agent, both versions fail
Check the template, external dependency, network, and job contract
Stateful agent passes, fresh agent fails
Find inherited tooling, certificate, cache, or persistent work folder
Expected image, provisioning fails
Check pool identity, blob access, outbound path, and script logs
Unexpected image
Check image order, aliases, and rendered demands Read the pool as a capacity chain
A tool error may be preceded by a provisioning problem. Review agent states and pool metrics by image and image version. Separate active demand, ready agents, not-ready agents, provisioning failures, and allocation time.
If a machine reaches allocated state but never joins Azure DevOps, verify outbound access to the Managed DevOps Pools service endpoints, its control queue, and the agent download path. For agents injected into an existing VNet, also check subnet delegation, UDRs, firewall, proxy, and DNS. Opening all Internet egress does not prove which flow was missing.
Build one timeline across the image update, first allocation of the new version, first failed run, FailureStage, ErrorCode, agent, and pipeline. Without that join, a queue delay and a tooling regression can look like one incident even when they have different causes.
Test the contract, not only the broken command
Create a qualification job with no deployment effect. It verifies required tools, certificate trust, read access to feeds, resolution of private dependencies, and one negative control. It publishes no artifact and receives no production service connection with write permissions.
Image contract
Alias and image version match the approved candidate
Required runtimes and CLIs resolve from expected paths
Trust store contains the approved corporate CA
Dependency contract
Package feed is readable with the canary identity
Private dependency resolves to the expected address
Denied destination remains unreachable
Execution contract
Fresh agent passes twice with the same manifest
Stateful agent does not depend on inherited tools
Provisioning logs contain no ignored failure
No production write credential is exposed Then test a representative read-only pipeline and a bounded deployment to a canary environment. Promotion should not depend on one happy pipeline. Select several job families when the pool serves different stacks.
Decide promotion, hold, or rollback
Promote the new version when fresh agents expose the same contract, provisioning is auditable, pool metrics show no new degradation, and positive and negative controls pass. Hold when the executed image remains ambiguous or success depends on a stateful agent.
Rollback by restoring the previous image version in the pool configuration, then recycle agents carrying the faulty version. Remove the canary override after confirming default selection. If a temporary tool installation was added to YAML, remove it as well; it must not survive the return to a trustworthy image contract.
Retain the run, version, provisioning logs, and before-and-after matrix. Rollback is complete when two fresh agents run the qualification pipeline on the restored version, the default demand selects the expected image, and the negative control remains denied.
Conclusion
Image drift in Managed DevOps Pools is not just a tool-version problem. It crosses scheduler selection, image content, provisioning, retained agent state, and the network required to start the worker.
A reliable diagnosis compares a good run with a failed run, forces a version only for the canary, qualifies a fresh agent, and ends with an explicit decision. The team can then promote the image, repair its provisioning, or restore the previous version without turning every pipeline into an agent rebuild script.