Azure DevOps Hour 7: Deep Troubleshooting, Optimization and Advanced Topics

From “the pipeline is red” to “the pipeline is fast and cheap”: systematic troubleshooting, elastic agent pools, performance and cost optimization, REST API automation, and the full approach to migrating to GitHub
system.debug · _diagManaged DevOps PoolsAgent 5.282.0REST · TSTUGEI · Actions ImporterVerified against official docs · 2026-11-15
Overall learning objectives
  • Master a troubleshooting method of “locate the stage first, then check the evidence, then change one thing”: learn to turn on system.debug, download full logs, and read the agent _diag the Agent/Worker logs under it, and use the REST timeline to pinpoint the failing step.
  • Be able to independently diagnose the 7 most common failures: no trigger, YAML compile errors, “The pipeline is not valid”, unauthorized resources, queuing due to insufficient parallelism, task-version or image retirement, and missing history from shallow clones.
  • Be able to install, upgrade and run self-hosted agents as a service, and package agents into containers (including --once single-use agents), and understand VMSS elastic pools and Managed DevOps Pools the scaling mechanics, configuration and security-isolation differences of
  • Use parallel jobs, caching, right-sized agents, lean checkouts and incremental builds to cut a CI run from over ten minutes to a few minutes, and explain the trade-off of each.
  • State accurately the free tiers and prices of Microsoft-hosted and self-hosted parallel jobs (verified 2026-11), analyze queuing with the pool consumption report, and estimate the monthly cost of Managed DevOps Pools.
  • Build automated integrations with the REST API (versions, paging, rate limits and TSTU response headers) and service hooks (Webhook / Slack / Teams), and understand the development workflow for Marketplace extensions.
  • Plan a migration from Azure DevOps to GitHub: what GitHub Enterprise Importer can and cannot migrate, migration paths for Boards and Pipelines, and the audit → dry-run → migrate workflow of GitHub Actions Importer.

1-hour time allocation

#TimeModuleCore contentAnimation / interactionLab
0Before classPrep: fault-injection projectmyapp-lab project, baseline pipeline myapp-ci,faults/ fault-injection scripts, az devops CLI and Entra token—Push the baseline and get one green run
100–06Troubleshooting methodology and diagnostic logsseven-stage locating method, Error analysis page,system.debug / Enable system diagnostics, download logs,_diag,Agent environment resources, REST timelinestep-by-step animation of “drilling down through log layers”Rerun with debug on and use REST to find the failing task
206–14Deep dive into common pipeline failuresNo trigger, YAML compilation, The pipeline is not valid, resource authorization, queuing, task/image deprecation, shallow clone“Which stage did it fail in?” classifierReproduce and fix 4 kinds of failure
314–23Self-hosted agents, VMSS and MDPinstall/upgrade/run as a service, SP registration, container agents and --once, VMSS pools, Managed DevOps Pools (dev center, standby, stateless/stateful), isolationElastic agent pool scaling simulator (core animation)Deploy a self-hosted container agent; optional MDP
423–30Performance: parallelism, caching and agent sizingParallel jobs / matrix / test slicing, Cache@2, Docker layer caching, agent sizing, lean checkout, incremental buildsPipeline duration calculatorBefore/after comparison of the same pipeline
530–37Parallel jobs and cost optimizationBilling for hosted and self-hosted parallel jobs, changes in how free tiers are obtained, pool consumption report, MDP cost formula, on-demand scalingMonthly cost estimatorExport 30 days of queue data for capacity recommendations
637–45REST API, service hooks and extensionsapi-version, Entra tokens, paging, TSTU and X-RateLimit headers, service hooks, Marketplace extensionsPaging + rate-limit simulatorFailed build → Webhook notification
745–52Migration: Azure DevOps to GitHubGEI (ado2gh): what it can and cannot migrate, Boards integration, rewire-pipeline, GitHub Actions ImporterMigration asset mapperActions Importer dry-run
852–60Comprehensive fault mystery box8 randomly injected faults, in-browser simulator, interactive troubleshooting treeMystery box simulator + troubleshooting treeMystery box challenge (real project)
—After classCheat sheet · Capstone labFault mystery box challenge + performance/cost optimization report + optional self-hosted container agentFinal quiz: 12 questionsAcceptance checklist: 12 items

Knowledge Coverage Matrix

Target skillModuleKey commands / settingsLabProduction case
Diagnostic logs and evidence collectionM1system.debug=true, Download logs,_diag/Agent_*.log,Worker_*.log,./run.sh --diagnostics✓✓
Locate the failing step via the APIM1 · M6_apis/build/builds/{id}/timeline,az devops invoke✓✓
Trigger / compile / authorization failuresM2trigger,paths, Override YAML trigger, Permit, Open access✓✓
Queuing and parallelismM2 · M5Parallel jobs page, Pool consumption report, demands✓✓
Checkout and Git historyM2 · M4fetchDepth,fetchTags,fetchFilter,sparseCheckoutDirectories✓✓
Self-hosted agent lifecycleM3config.sh --unattended,svc.sh install, Update all agents,--auth SP✓✓
Container agents and single-use agentsM3AZP_URL/AZP_TOKEN/AZP_POOL,run.sh --once✓✓
Elastic agent poolM3az vmss create --disable-overprovision --upgrade-policy-mode manual,az mdp pool createoptional✓
Build performanceM4Cache@2,strategy: parallel/matrix,dependsOn, path filters✓✓
Cost optimizationM5Parallel job purchase, standby plans, stateless/stateful✓✓
REST / service hooks / extensionsM6api-version,x-ms-continuationtoken,X-RateLimit-*,_apis/hooks/subscriptions,tfx extension create✓✓
Migration to GitHubM7gh ado2gh migrate-repo,rewire-pipeline,integrate-boards,gh actions-importer audit/dry-run/migrate✓✓
Comprehensive troubleshootingM8All✓✓

What this lesson does not cover

TopicReasonWhere to learn it
YAML syntax, triggers, and basic writing of stages/jobs/stepsCovered in Lesson 2; this lesson only covers “what to do when it breaks”Lesson 2
Details of creating service connections and workload identity federationCovered in Lessons 3/4; this lesson only covers authorization and troubleshootingLesson 3 · Lesson 4
extends templates, approvals and checksCovered in Lessons 5/6Lesson 5 · Lesson 6
GitHub Actions syntax and runnersTopic of the GitHub courseGitHub 8-hour course
Writing Dockerfiles, slimming imagesTopic of the Docker courseDocker 8-hour course
A complete plan for scaling container agents with KEDA on AKSBeyond 1 hour; only the approach is givenKubernetes 8 + 1-hour course + KEDA docs, azure-pipelines scaler

How to use this courseware

10 pages per module
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · narration · video. Read “principles + animation” first, then do the “lab” in the myapp-lab project.
Learning progress
A quiz score ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (storage key ado60-part7-progress-v1).
Two lab routes
Main route: free organization + Microsoft-hosted agents (linking an Azure subscription per M5 is required to get the free tier). Alternative: a self-hosted container agent on one Ubuntu 24.04 machine (M3 lab), with 1 free self-hosted parallel job and no time limit.
Version notes This lesson is based on Azure DevOps Services as of 2026-11-15. Latest Azure Pipelines agent 5.282.0 (2026-10-30, based on .NET 10; the official docs body still describes 4.x / .NET 8; for both, the GitHub release page is authoritative). Microsoft-hosted images ubuntu-latest = Ubuntu 24.04,windows-latest = Windows Server 2025 (Microsoft says it will switch to the VS 2026 version soon). Managed DevOps Pools is GA; resource provider Microsoft.DevOpsInfrastructure, ARM apiVersion example is 2025-09-20; GitHub Enterprise Importer CLI v1.35.0 (2026-10-28). Prices come from the Azure DevOps pricing page (USD); the live content of the official page is authoritative.

Module 0 · Prep: fault-injection project

Reuse the myapp-lab project from earlier lessons and set up a “known-green” baseline pipeline and a repeatable set of fault-injection scripts. The prerequisite for troubleshooting practice is being able to return to a healthy state at any time.
Before class ≈ 20 minaz CLI ≥ 2.57 · azure-devops extension · git · jq
Prerequisites
  • Completed Lessons 1–6: organization https://dev.azure.com/<org> has a project myapp-lab, repository myapp (the Flask + gunicorn + Redis app from the Docker course, including /healthz), pipeline myapp-ci (created in Lesson 2).
  • You are a Project Administrator, able to change pipeline settings, agent pool security and service hooks; operations in M5 that involve purchasing require Project Collection Administrators (in this lesson you only view, you do not buy).
  • One Linux lab machine (Ubuntu 24.04, either the Azure VM from the Docker course or WSL2), with Docker Engine, git, jq and Azure CLI installed.
  • Microsoft-hosted agent free tier: Since 2026, the organization must set up billing (link a valid Azure subscription) before it is granted automatically, which is 1 parallel job for private projects, up to 1 hour per run and 1,800 minutes per month. Without an Azure subscription, use the self-hosted container agent route from M3 (1 free self-hosted parallel job, no time limit).

1. Connections from the previous lesson (reused variables and resources)

NameValue (example)Source
Organization / projecthttps://dev.azure.com/contoso-lab / myapp-labLesson 1
Repository / pipelinemyapp / myapp-ci (YAML: azure-pipelines.yml)Lesson 2
ARM service connectionsc-azure-lab (workload identity federation)Lesson 3
Azure resource group / regionrg-ado-lab / canadacentralLesson 3
Created in this lessonSelf-hosted pool lab-selfhosted; optional MDP pool mdp-myapp-<random>, dev center dc-ado-labM3

2. Configure the CLI and token (prefer an Entra token, do not use a PAT)

az login
az extension add --name azure-devops --upgrade
export ORG=https://dev.azure.com/contoso-lab PROJECT=myapp-lab
az devops configure --defaults organization=$ORG project=$PROJECT

# The Entra resource ID for Azure DevOps is fixed at 499b84ac-1321-427f-aa17-267ca6975798
export ADO_TOKEN=$(az account get-access-token \
  --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/_apis/projects?api-version=7.1" | jq -r '.value[].name'
myapp-lab
Why not use a PAT Official guidance is to prefer Entra tokens, managed identities or service principals. Global PATs are being retired (the official retirement date is written inconsistently: the release notes say 2026-12-01, the top of the PAT doc says 2027-01-27; follow the latest release notes). Entra access tokens expire in about 1 hour, so have the script fetch a fresh one each time. Only a few scenarios (such as the container agent example in M3 of this lesson, and GitHub Actions Importer) still need a PAT; there, use the minimum scope and the shortest lifetime.

3. Baseline pipeline (get one green run first)

Adjust azure-pipelines.yml at the repository root to the baseline below (adjust paths to the myapp structure you imported in Lesson 2: this lesson assumes the code is in app/, and tests are in app/tests/):

# azure-pipelines.yml — Lesson 7 baseline (known green)
trigger:
  branches:
    include: [ main, 'fault/*' ]
  paths:
    include: [ app/*, azure-pipelines.yml ]

pool:
  vmImage: ubuntu-24.04          # pin the version explicitly to avoid -latest drift

variables:
  - name: pythonVersion
    value: '3.12'

steps:
- checkout: self
  fetchDepth: 0                  # full history and tags are needed to compute the version number
  fetchTags: true
- script: git describe --tags      # deliberately no --always: fails when there are no tags, to expose the shallow-clone problem
  displayName: Version
- task: UsePythonVersion@0
  inputs:
    versionSpec: $(pythonVersion)
- script: |
    pip install -r app/requirements.txt pytest
    pytest -q app/tests
  displayName: Test
git switch main && git pull
git tag -a v1.0.0 -m "baseline" 2>/dev/null || true
git add azure-pipelines.yml && git commit -m "ci: lesson 7 baseline" && git push --follow-tags
az pipelines runs list --pipeline-ids $(az pipelines show --name myapp-ci --query id -o tsv) --top 1 -o table
Run ID    Number      Status       Result     Pipeline ID    Pipeline Name    Source Branch
--------  ----------  -----------  ---------  -------------  ---------------  ---------------
412       20261115.1  completed    succeeded  12             myapp-ci         refs/heads/main

4. Fault-injection scripts faults/inject.sh

Each fault is injected on a separate branch fault/<number> , and main always stays green. The scripts only change YAML or repository content and do not change organization-level settings (F4/F5 require you to manually change one permission or parallelism setting in the UI as prompted, and restore it after the drill).

mkdir -p faults && cat > faults/inject.sh <<'EOF'
#!/usr/bin/env bash
# Usage: faults/inject.sh <1-8|random>    injects one fault on new branch fault/N and pushes it
set -euo pipefail
n="${1:?usage: inject.sh <1-8|random>}"
[ "$n" = random ] && { n=$(shuf -i 1-8 -n 1); echo "$n" | base64 > .fault-answer; echo "Mystery box injected (answer encoded and saved in .fault-answer)"; }
git switch -C "fault/$n" main
y=azure-pipelines.yml
case "$n" in
  1) sed -i 's#include: \[ app/\*, azure-pipelines.yml \]#include: [ src/* ]#' "$y" ;;          # path filter does not match → no trigger
  2) sed -i 's/^steps:/step:/' "$y" ;;                                                          # unknown key → YAML compile error
  3) printf -- "- template: templates/lint.yml\n" >> "$y" ;;                                      # template does not exist → The pipeline is not valid
  4) cat >> "$y" <<'Y'
- task: AzureCLI@2
  inputs:
    azureSubscription: sc-azure-prod     # service connection that does not exist or is not authorized
    scriptType: bash
    scriptLocation: inlineScript
    inlineScript: az group list -o table
Y
  ;;
  5) sed -i 's/^  vmImage: ubuntu-24.04.*/  name: lab-selfhosted\n  demands: [ gpu ]/' "$y" ;;      # no agent satisfies demands → queued forever
  6) sed -i 's/ubuntu-24.04/ubuntu-20.04/' "$y" ;;                                              # retired image
  7) sed -i 's/fetchDepth: 0 .*/fetchDepth: 1/; s/fetchTags: true/fetchTags: false/' "$y" ;;    # shallow clone → describe fails
  8) sed -i 's#pytest -q app/tests#fallocate -l 20G /tmp/fill.bin \&\& pytest -q app/tests#' "$y" ;;  # disk full
  *) echo "unknown fault $n"; exit 2 ;;
esac
git commit -qam "fault: inject #$n"
git push -q -u origin "fault/$n" --force
echo "Pushed fault/$n — go to the Pipelines page and observe the symptom"
EOF
cat > faults/reset.sh <<'EOF'
#!/usr/bin/env bash
# Delete all fault/* branches (local and remote) and return to main
set -euo pipefail
git switch main
for b in $(git branch --format='%(refname:short)' | grep '^fault/' || true); do git branch -D "$b"; done
for b in $(git ls-remote --heads origin 'fault/*' | awk '{print $2}' | sed 's#refs/heads/##'); do git push -q origin --delete "$b"; done
rm -f .fault-answer; echo "reset done"
EOF
chmod +x faults/*.sh
echo ".fault-answer" >> .gitignore
git add faults .gitignore && git commit -m "chore: fault injection scripts" && git push
Note F7 requires the repository to have at least one annotated tag (from the previous step v1.0.0) and main to have several commits before the difference shows up. F8 fails on Microsoft-hosted agents because only about 10 GB of space is available, but it may not fail on your own large-disk agent; this is exactly what shows that “the same YAML behaves differently on different agents.” The F5 lab-selfhosted pool is created in M3; if you do M8 early, you can create an empty pool by hand first.

5. Self-check list

Module 1 · Troubleshooting Methodology and Diagnostic Logs

00:00 – 06:00 · First determine “which stage is broken,” then collect evidence by level: run summary → task log → debug log → agent diagnostic log → API
6 minsystem.debug · Agent.Diagnostic★★★★★ Foundation for all later modules
Learning objectives
  • Use the “seven-stage locating method” (trigger → compile → authorize → queue → agent → checkout → task) to determine within 1 minute which stage a failure belongs to.
  • Use the Error analysis page, View raw log and Download logs, and know system.debug the difference between and the scope of “Enable system diagnostics”.
  • Know the self-hosted agent _diag directory contents: the Agent and Worker log types, and how to use Agent.Diagnostic,VSTS_AGENT_HTTPTRACE,./run.sh --diagnostics.
  • Use REST (timeline + logs) or az devops invoke to precisely find the failing stage/job/task and its logs in a script.
Prerequisites: Lesson 2 (pipeline structure). Importance:★★★★★

What: what pipeline troubleshooting is actually locating

A YAML pipeline run goes through seven stages: ①Trigger (a push, PR, schedule, manual run or resource trigger starts a run) → ② Compile (reads the YAML, expands templates and expressions, and generates the job plan) → ③ Authorize (checks the protected resources the run uses: service connections, agent pools, variable groups, secure files, environments, other repositories) → ④ Queue (waits for a parallel-job slot and an agent that satisfies demands) → ⑤ Agent (the agent picks up the job, downloads tasks and prepares the working directory) → ⑥checkout (fetches the source) → ⑦ Task (runs scripts and tasks step by step, uploads logs and artifacts). Each stage fails with a completely different “symptom”: when the first three stages fail,there are no job logs at all, only the last four stages produce them.

Why: why segment first

The most common inefficient troubleshooting is “see red, go edit the script.” In practice, many problems are not in the script at all: no trigger (①), invalid YAML (②), a service connection not authorized (③), or no free parallel job (④). Segmenting first lets you rule out 80% of the wrong directions immediately.

StageTypical symptomWhere the evidence isCommon tools
① TriggerNo new run at all after a pushPipeline Triggers settings, trigger/paths in the YAML, YAML version on the branchCompare with a manual run,az pipelines runs list
② CompileRun fails immediately, with a YAML line and column numberError at the top of the run summary; Validate on the Edit pageEditor Validate, Download full YAML
③ Authorize“needs permission to access a resource” or The pipeline is not valid … not authorizedRun summary, resource's Security / Pipeline permissionsPermit, Open access, audit log
④ QueueJob stays Queued for a long timeQueue explanation in the job panel, Parallel jobs pagePool consumption report, View in-progress jobs
⑤ Agent“We stopped hearing from agent”, Initialize job failsInitialize job log, agent _diagAgent Capabilities,run.sh --diagnostics
⑥checkoutGit fetch failed with exit code 128, TF401019Checkout step loggit trace under system.debug
⑦ Task##[error] and a non-zero exit codeTask log, uploaded custom logsError analysis, local reproduction commands

How: the five levels of logs

  1. Run summary and Error analysis page: hover over the error line and click View analysis to see runtime details and the task description (About this task); self-hosted agents can jump straight to View agent.
  2. Task log: click a task to view its log; View raw log shows the raw text and is searchable. By default it is a non-verbose log.
  3. Debug log: check it for a single run Run pipeline → Enable system diagnostics; to apply it to all runs, define the variable system.debug: true. Once enabled, the log gains ##[debug] lines, and each step injects Agent environment resources - Disk … Memory … CPU … resource utilization lines; it also automatically sets Agent.Diagnostic to true, which collects network diagnostic files (cloudinit, BrokenPackages, environment.txt, etc.; agent ≥ 2.200.0).
  4. Full log package: run page … → Download logs, which yields a zip with one file per step, including environment.txt (run environment) and capabilities.txt (agent capabilities).
  5. Agent diagnostic logs (self-hosted only): under the agent directory _diag/: Agent_<time>-utc.log (configuration and listener process: connects to the organization and picks up jobs) and Worker_<time>-utc_<pid>.log (execution details of a single job). You can also set VSTS_AGENT_HTTPTRACE=true to log HTTP headers, or run ./run.sh --diagnostics for a self-check.

When: when to use the API

When you need bulk analysis (for example, “which task did each of the last 20 failures die in”), need to attach the failing step to an alert, or need to supply context to an AI assistant (Azure DevOps MCP Server), use the REST timeline: GET {org}/{project}/_apis/build/builds/{buildId}/timeline returns Stage/Phase/Job/Task records, each with result,issues and log.id, then use _apis/build/builds/{id}/logs/{logId} to download the corresponding log.

Common misconceptions

  • “Turning on system.debug lets you see secrets.” No: secret variables are still masked as ***; however, HTTP traces and Fiddler captures may contain tokens,so do not publish them publicly.
  • “Downloading logs gives you agent logs.” No: what you download is run logs; _diag agent logs exist only on the self-hosted agent machine; Microsoft-hosted agents do not expose them.
  • “A failed run always has logs.” No: failures in the compile and authorization stages produce no job logs at all; the error appears only at the top of the run summary.
  • “Leaving system.debug on is safer.” No: log volume multiplies, slowing runs and increasing TSTU consumption (M6); turn it off once troubleshooting is done.

Seven-stage locating method and evidence sources

① Triggerpush/PR/schedule ② CompileYAML + template expansion ③ AuthorizeProtected resources ④ QueueParallelism + demands ⑤ AgentInitialize job ⑥checkoutgit fetch ⑦ TaskScripts / tasks / artifacts No job logs: check the top of the run summary / settings pageTriggers settings · Validate · resource Security · audit log Job panelParallel jobs page Job logs exist: task log → debug → Download logs → _diagError analysis · Agent environment resources · Worker_*.log Across all stages: REST timeline (result, issues, log.id of Stage/Job/Task) + audit log (who changed permissions or settings)
Figure 1-1: failures in the first three stages produce no job logs; evidence for the fourth stage is in the job panel and the Parallel jobs page; only the last three stages go into “log drill-down”

Agent directory structure (self-hosted)

~/myagent/ bin/ externals/ (agent, node, git) _diag/ Agent_*.log · Worker_*.log _work/1/s (source) a (staging) b (binaries) .agent .credentials .env .path Sensitive!.credentials / .credentials_rsaparamsLogs and _work may contain build outputsGrant access only to the agent's run user and administrators
Figure 1-2 _diag is the first place to look when troubleshooting a self-hosted agent; .credentials files like these need strict file permissions

Step-by-step animation: drilling from a “red run” down to the root cause

A myapp-ci run fails at the Test step. Follow the animation to see what question each layer of evidence answers.

Run summary#20261115.7 failed Error analysisTask + runtime details Task logView raw log system.debug rerun##[debug] + resource utilization Download logsenvironment/capabilities _diag/Worker_*.logSelf-hosted agent REST timeline + logsBulk locating · failing step attached to alerts Root cause + fixChange only one thing, then rerun to verify
Ready. Click “Play.”

1. Three ways to enable debug logs

# Method A: in YAML, applies to all runs (remember to remove it after troubleshooting)
variables:
  system.debug: true

# Method B: UI single run: Run pipeline → check "Enable system diagnostics" → Run
# Method C: CLI single run (if it says variables cannot be set at queue time, define it in the pipeline Variables and check "Let users override")
az pipelines run --name myapp-ci --branch main --variables system.debug=true -o table

2. Find resource utilization and key lines in the log

RUN=$(az pipelines runs list --pipeline-ids 12 --top 1 --query "[0].id" -o tsv)
# Download the full log zip (REST; equivalent to the UI's Download logs)
curl -s -H "Authorization: Bearer $ADO_TOKEN" -o logs.zip \
  "$ORG/$PROJECT/_apis/build/builds/$RUN/logs?\$format=zip&api-version=7.1"
unzip -q -o logs.zip -d logs-$RUN
grep -rh "Agent environment resources" logs-$RUN | head -3
grep -rhn "##\[error\]" logs-$RUN | head
2026-11-15T09:12:03.1Z ##[debug]Agent environment resources - Disk: / Available 9876.00 MB out of 74240.00 MB, Memory: Used 1530.00 MB out of 7167.00 MB, CPU: Usage 21.40%
logs-412/Job/5_Test.txt:57:##[error]Bash exited with code '1'.

3. Pinpoint the failing step with the timeline

curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/$PROJECT/_apis/build/builds/$RUN/timeline?api-version=7.1" |
jq -r '.records[] | select(.result=="failed") |
  [.type, .name, (.log.id // "-"), ((.issues // [])[0].message // "")] | @tsv'

# Equivalent az devops invoke (no need to build the URL yourself)
az devops invoke --area build --resource timeline \
  --route-parameters project=$PROJECT buildId=$RUN --api-version 7.1 \
  --query "records[?result=='failed'].{type:type,name:name,log:log.id}" -o table
Task    Test     9    Bash exited with code '1'.
Job     Job      2
Stage   __default -   
# Download a single step's log (logId comes from the previous step)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/$PROJECT/_apis/build/builds/$RUN/logs/9?api-version=7.1" | tail -20

4. Diagnosing the self-hosted agent

cd ~/myagent
ls -t _diag | head -5                       # newest Agent_ / Worker_ logs
grep -E "Job request|completed with result" _diag/Agent_*.log | tail -5
./run.sh --diagnostics                      # self-check suite for interactive runs (stop the service first)
# HTTP header tracing: set before starting the listener; when running as a service, write it to .env in the agent directory and restart
echo "VSTS_AGENT_HTTPTRACE=true" >> .env && sudo ./svc.sh stop && sudo ./svc.sh start

5. Upload custom diagnostic files to the run logs

- bash: |
    df -h > $(Agent.TempDirectory)/disk.txt; free -m >> $(Agent.TempDirectory)/disk.txt
    echo "##vso[task.uploadfile]$(Agent.TempDirectory)/disk.txt"
  displayName: Upload disk usage
  condition: always()

Lab: enable debug → download logs → find the failing task via the API

Cause a task failure: on fault/0 branch so that the tests fail (this is not one of the 8 mystery-box faults; it is used only to practice reading logs).
git switch -C fault/0 main
echo "def test_fail(): assert 1 == 2" > app/tests/test_fail.py
git add app/tests/test_fail.py && git commit -qm "lab: failing test" && git push -u origin fault/0
Read the Error analysis: open the run, hover over the red error line, click View analysis, and record the task name, exit code and the About this task link.
Rerun with debugging on: Rerun failed jobs does not change variables, so use Run pipeline → select the branch instead fault/0 → check Enable system diagnostics. Compare the number of log lines between the two runs:
for r in $(az pipelines runs list --branch fault/0 --top 2 --query "[].id" -o tsv); do
  n=$(az devops invoke --area build --resource logs --route-parameters project=$PROJECT buildId=$r \
      --api-version 7.1 --query "value[].lineCount" -o tsv | paste -sd+ | bc); echo "run $r: $n lines"; done
run 418: 1874 lines
run 417: 412 lines
Download the full log: use the curl in section 2 of “Commands” to download the zip, and find Agent environment resources lines and ##[error] lines, and open environment.txt (if it exists).
Write a “failure summary” script: save it as faults/why.sh, take a run ID as input, and output the failing task name and the last 15 log lines. You will reuse it repeatedly in the M8 mystery box.
cat > faults/why.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
run="${1:?run id}"; tok=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)
base="$ORG/$PROJECT/_apis/build/builds/$run"
curl -s -H "Authorization: Bearer $tok" "$base?api-version=7.1" | jq -r '"status=\(.status) result=\(.result) reason=\(.reason) branch=\(.sourceBranch)"'
curl -s -H "Authorization: Bearer $tok" "$base/timeline?api-version=7.1" |
  jq -r '.records[]? | select(.result=="failed" and .type=="Task") | "\(.log.id) \(.name)"' |
  while read -r id name; do echo "== $name"; curl -s -H "Authorization: Bearer $tok" "$base/logs/$id?api-version=7.1" | tail -15; done
EOF
chmod +x faults/why.sh && faults/why.sh 418
Cleanup: faults/reset.sh will delete fault/* branches (including fault/0); confirm that no leftover system.debug: true.

Case 1: the “intermittent failure” was actually insufficient memory

Symptom: Integration tests fail two or three times a week with different errors each time; a rerun fixes them. Investigation: Enabled system.debug for a week and summarized by step Agent environment resources, and found that Memory Used in failed runs was close to 7167 MB (the hosted agent has 7 GB). Steps on the Linux hosted agent run in a cgroup that provides 6 GB of physical memory. Fix: Reduced test parallelism from 4 to 2 and moved the large integration tests to 8 GB+ agents in Managed DevOps Pools (M3/M4).

Case 2: failure notifications automatically include “which step died”

The platform team used a service hook (M6) to send build.complete events to an Azure Function. The Function calls the timeline API to get the name of the first failed Task and its last 30 log lines, then posts them to a Teams channel. On-call engineers can tell whether it is a test failure or an infrastructure problem without opening Azure DevOps, and average response time dropped from 25 minutes to 8 minutes.

Case 3: self-hosted agent “suddenly offline”

Symptom:“We stopped hearing from agent build-07”. Evidence:_diag/Agent_*.log no errors at the end; journalctl -u vsts.agent.* shows the process was ended by the OOM killer. Fix: Following the official guidance, configured a cgroup for the job processes and lowered the agent process's oom_score_adj, so that under memory pressure the job processes are reclaimed first rather than the agent itself.

Common errors and fixes

Run fails with no jobs, with the error shown only at the top

Cause: The failure occurred in the compile or authorization stage (M2). Action: Read the top error in full (it usually includes the file name and line/column or the resource name); click Validate in the editor. For authorization errors, go to the resource's Security page.

Agent environment resources not found in the downloaded log

Cause: Verbose logging was not enabled; this information is injected only in verbose mode. Azure DevOps Server requires you to collect it yourself with a script. Fix: Rerun with Enable system diagnostics.

_diag directory has only Agent logs and no Worker logs

Cause: The job was never actually dispatched to this agent (still queued, demands not satisfied, or picked up by another agent). Action: Confirm in the job panel which agent the job ran on (first line of the Initialize job log), then go look on that machine.

We stopped hearing from agent <name>. Verify the agent machine is running and has a healthy network connection.

Cause: The agent machine ran out of resources (memory, disk), was restarted, or lost network connectivity. Diagnosis: Turn on verbose to check resource utilization; for self-hosted agents, check the system logs and _diag.

journalctl -u 'vsts.agent.*' --since "1 hour ago" | tail -30
dmesg -T | grep -i -E "killed process|out of memory" | tail
timeline API returns 401 / 203 and returns login-page HTML

Cause: The token expired or the wrong resource ID was used (an Entra token must target 499b84ac-1321-427f-aa17-267ca6975798); a PAT should use Basic (empty username), not Bearer. Fix: Get a new token; in scripts, fetch one before each call.

Command-line exercise

1. Write a jq pipeline that lists all records from the timeline output result whose result is failed and whose type is Task, along with their name and log.id.

Reference answer
jq -r '.records[] | select(.type=="Task" and .result=="failed") | "\(.name)\t\(.log.id)"'

2. Upload a custom log file for a step trace.txt, so that it appears in the zip from Download logs.

Reference answer
echo "##vso[task.uploadfile]$(Agent.TempDirectory)/trace.txt"

Scenario analysis question: A developer says, “After I pushed, the pipeline turned red, and there is not a single line of log.” What three questions would you ask first?

Reference answer

① Is it a “red run” or “no run at all” (trigger vs compile/authorization)? ② What is the exact error text at the top of the run summary (YAML line/column → compile; not authorized / needs permission → authorization)? ③ Who recently changed the YAML, the template repository or resource permissions (check commit history and audit log)? These three questions pin the problem to the first three stages and keep you from editing the script.

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
Azure DevOps Tutorial for Beginners | CI/CD with Azure Pipelines — TechWorld with Nana
English · duration and upload date not verified · purpose: review where to find the pipeline run UI (logs, jobs, stages)
▶
Building and Deploying your Code with Azure Pipelines — Microsoft Visual Studio
English · recorded earlier, UI may differ from current · purpose: basic structure of run summaries and task logs

No verified video specifically explaining system.debug / _diag / timeline API was found; please rely on the official documentation and storyboard script below.

Official documentation

Video storyboard script

This courseware cannot directly generate video or MP3; a storyboard and narration script are provided instead.

Shot 1 · 0:00–0:20
Visual: Seven boxes light up from left to right: trigger, compile, authorize, queue, agent, checkout, task; the first three are labeled “no job logs” underneath.
Narration: The first step in troubleshooting is not reading logs, but determining which stage is broken.
Shot 2 · 0:20–0:50
Visual: On the run page, hovering over the error line shows View analysis; switch to the dialog with Enable system diagnostics checked.
Narration: Error analysis tells you which task and what input; when more detail is needed, rerun once with system diagnostics.
Shot 3 · 0:50–1:20
Visual: A line of Agent environment resources is highlighted in the log; then in the terminal, ls _diag shows Agent and Worker files.
Narration: Verbose logs record disk, memory and CPU for each step; self-hosted agents also let you view the agent and job logs in _diag.
Shot 4 · 1:20–1:45
Visual: The terminal runs curl on the timeline with jq and outputs only one line: Task Test failed.
Narration: For bulk analysis, use the timeline endpoint; one command finds the failing step and its log ID.
or score ≥ 70% on the quiz

Module 2 · Deep dive into common pipeline failures

06:00 – 14:00 · Seven common failure types: the real error for each, root cause, fastest diagnostic path and preventive measures
8 mintrigger · YAML · authz · queue · checkout★★★★★ Frequently asked in interviews and on-call
Learning objectives
  • List the 8 common reasons a YAML pipeline does not trigger, and know that PR validation for Azure Repos must be configured through branch policy.
  • Distinguish YAML parse errors, template expansion errors and resource errors within “The pipeline is not valid.”
  • Understand the authorization model for protected resources (Permit / Open access / pipeline permissions), and handle “needs permission to access a resource.”
  • Determine whether queuing is due to parallel-job slots, unmet demands, or offline agents.
  • Handle task version deprecation and hosted-image retirement; fix version numbers, diffs and SonarQube blame issues caused by shallow clones.
Prerequisites: M1 seven-stage locating method; Lessons 2, 3 and 5. Importance:★★★★★

1. No trigger (① Trigger stage)

CI triggers for YAML are determined by the YAML on the branch that was pushed ; PR triggers do not work for Azure Repos, so Azure Repos PR validation must be configured in the target branch's branch policy → Build validation (the pr: in YAML only applies to GitHub / Bitbucket Cloud). Common causes:

#CauseHow to confirm
1trigger.branches / paths Filter mismatch (path case-sensitive, written as src/* but the file changed is app/)Compare the files changed in this commit against paths
2the Triggers setting of the pipeline has been checked Override the YAML continuous integration trigger from here, the UI setting overrides the YAMLEdit → … → Triggers
3trigger: none, or the project setting has enabled Disable implied YAML CI trigger (when the YAML has no trigger, it no longer triggers by default)Project settings → Pipelines → Settings
4The commit message contains [skip ci],***NO_CI*** skip markers such asgit log -1
5The pipeline is set to Paused / Disabled (Settings → Processing of new run requests)Pipeline … → Settings
6Scheduled trigger: cron uses UTC; by default it does not run when the source has not changed, and needs always: true; scheduled runs read schedules only from the default branch's YAML (follow the docs)Pipeline … → Scheduled runs
7The YAML file path was changed but the pipeline definition still points to the old path, or the YAML was deleted on the new branchPipeline Settings → YAML file path
8GitHub repository: the GitHub App is not installed on the repository / the webhook was deleted / the service connection is invalidGitHub repository Settings → Integrations / Webhooks

2. YAML compile errors (② Compile stage)

Compilation has three steps: YAML parsing (indentation, colons, quotes) → templates and ${{ }} compile-time expression expansion → structural validation (unknown keys, types). Error messages include the file and line/column, for example /azure-pipelines.yml (Line: 14, Col: 1): Unexpected value 'step',While parsing a block mapping, did not find expected key,A template expression is not allowed in this context. Fastest method: In the web editor, click Validate, or on the run page click … → Download full YAML to see the fully expanded YAML (when compilation succeeds).

3. The pipeline is not valid (boundary between ② and ③)

This prefix means “the compiled plan failed validation”; it is followed by the specific cause, which broadly falls into two types:

  • Structure / template type: template file does not exist, template parameter type mismatch,extends a required template is not used (the required-template check from Lesson 5), duplicate Job/Stage names,dependsOn pointing to a job that does not exist.
  • Resource type: service connections, variable groups, agent pools, secure files, environments, repository resources: “could not be found … does not exist, has been disabled or has not been authorized for use”. Note that “not found” and “not authorized” are the same sentence; the platform deliberately does not distinguish them, to avoid revealing whether a resource exists.

4. Resource not authorized (③ Authorize stage)

Agent pools, service connections, variable groups, secure files, environments and other repositories are all protected resources. When a new pipeline uses one for the first time, the run pauses and shows This pipeline needs permission to access a resource before this run can continue; a person with permission clicks View → Permit , and the pipeline is added to the resource's authorization list. You can also turn on Open access (available to all pipelines in the project; requires a project administrator), but this weakens isolation, and it is not recommended for production service connections. Service connections also have an easily overlooked rule: they are automatically disabled after 100 consecutive days of non-use; re-enable them via Service connections → More actions → Enable (this is recorded in the audit log).

5. Queuing (④ Queue stage)

  • Parallel-job slots used up: Parallel jobs are shared at the organization level and cannot be divided by project or pool; when other projects fill the slots, your jobs can only wait. Deployments waiting for approval do not use a slot, and server jobs do not use a slot either.
  • No agent satisfies demands: The job's demands (or the implicit demands of a task) do not match the capabilities of any online agent in the pool, so the job waits until it times out. After installing new software, you must restart the agent before the new capability appears.
  • All agents are offline or disabled, or the pool is not authorized for this pipeline (the latter is actually ③).
  • Elastic pool scaling up: VMSS pools sample every 5 minutes, and one scale-up step may take 20 minutes; with MDP and no standby agent, powering on on demand takes from tens of seconds to 15 minutes (M3).

6. Task version deprecation and image retirement

Tasks are referenced by major version (UsePythonVersion@0); the platform automatically uses the latest minor version under that major version. After an old major version is marked deprecated, warnings appear in the logs, and it may eventually stop working. Agents run tasks on the Node runner, and tasks using old Node handlers are gradually phased out; the ##[warning] in the log is an early warning sign. Hosted images also have a lifecycle (status as of 2026-11): the Windows Server 2019 image was retired on 2025-12-31; Ubuntu 20.04 is retired; Ubuntu 22.04 is deprecated and scheduled for removal on 2027-04-17 (with a brownout window before that); macOS 14 has been deprecated since 2026-07-06. Pipelines that use *-latest label silently switch images when the label is repointed (for example, windows-latest is about to point to the VS 2026 version).

7. Shallow clone missing history (⑥ checkout stage)

Pipelines created after 2022-09 (sprint 209) default to shallow clone depth 1,fetchTags with fetchTags defaulting to false. Consequences: git describe reports fatal: No names found, cannot describe anything.; version tools such as GitVersion / Nerdbank compute the wrong version or fail; git diff origin/main...HEAD report fatal: ... no merge base; SonarQube shows Shallow clone detected, no blame information will be provided Fix: in the checkout step, write fetchDepth: 0 (YAML settings override the Shallow fetch setting in the UI) and, as needed, fetchTags: true; when you only need the last few commits, set fetchDepth: 50.

Common misconceptions

  • “Changing the trigger on main makes feature branches follow the new rule.” No: trigger rules read the YAML of the branch that was pushed.
  • “Writing pr: in YAML gives automatic PR validation for Azure Repos.” No: Azure Repos must use branch policy.
  • “Open access is just a convenience.” No: it lets any pipeline in the project, including a newly created malicious one, use the resource.
  • “Buying more parallel jobs will fix queuing.” No: if the cause is unmatched demands or offline agents, buying more does not help.

Which stage the seven failure types fall into

① Trigger ② Compile ③ Authorize ④ Queue ⑤ Agent ⑥checkout ⑦ Task No triggerNo run YAML errorLine/Col The pipeline is not validTemplate / resource Not authorizedPermit Stuck in queueSlots / demands Image retirement · task deprecation · shallow cloneInitialize job / checkout / warning Script failureexit code Red = symptom; the further left, the more “no logs are visible”; the further right, the more it relies on drilling into logs
Figure 2-1: “The pipeline is not valid” spans compile and authorization; the second half of the message determines which type it is

Authorization check for protected resources

Compiled planreferences sc-azure-lab Resource exists and is enabled?Disabled after 100 days unused Pipeline authorized?Pipeline permissions / Open access CheckApprovals, etc. (Lesson 6) Job queued No → The pipeline is not valid … could not be found No → needs permission … Permit
Figure 2-2: the platform merges “does not exist” and “not authorized” into one message; check both when troubleshooting

Interactive: which stage did this failure occur in?

Select a symptom and observe which of the seven stages it stops at, what evidence there is, and what to do first.

① Trigger ② Compile ③ Authorize ④ Queue ⑤ Agent ⑥checkout ⑦ Task
Click any symptom above.

1. Trigger diagnosis

git log -1 --name-only --format="%H %s"            # which files changed in this commit, and whether the message contains [skip ci]
git show origin/fault/1:azure-pipelines.yml | sed -n '1,8p'   # trigger on that branch (not the one on main)
az pipelines show --name myapp-ci --query "{path:process.yamlFilename, queueStatus:queueStatus, triggers:triggers}" -o json
{
  "path": "/azure-pipelines.yml",
  "queueStatus": "enabled",
  "triggers": [ { "settingsSourceType": 2, "triggerType": "continuousIntegration", ... } ]
}

settingsSourceType: 2 Indicates that the trigger setting comes from the YAML; if it is 1, the UI overrides the YAML (follow the REST docs). queueStatus When paused / disabled is set, no new run will start.

2. Compile validation (does not run the pipeline)

# Runs - Run Pipeline with previewRun=true: only compiles and returns finalYaml, does not queue
PID=$(az pipelines show --name myapp-ci --query id -o tsv)
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
  "$ORG/$PROJECT/_apis/pipelines/$PID/preview?api-version=7.1" \
  -d '{"previewRun":true,"resources":{"repositories":{"self":{"refName":"refs/heads/fault/2"}}}}' | jq -r '.finalYaml // .message'
/azure-pipelines.yml (Line: 14, Col: 1): Unexpected value 'step'

3. Resource authorization

# View which pipelines a service connection is authorized for (Pipeline Permissions API)
SC=$(az devops service-endpoint list --query "[?name=='sc-azure-lab'].id" -o tsv)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/$PROJECT/_apis/pipelines/pipelinePermissions/endpoint/$SC?api-version=7.1-preview.1" |
  jq '{allPipelines: .allPipelines.authorized, pipelines: [.pipelines[].id]}'
# Authorize only myapp-ci (safer than Open access)
curl -s -X PATCH -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
  "$ORG/$PROJECT/_apis/pipelines/pipelinePermissions/endpoint/$SC?api-version=7.1-preview.1" \
  -d "{\"pipelines\":[{\"id\":$PID,\"authorized\":true}]}" | jq '.pipelines'
az devops service-endpoint show --id $SC --query "{name:name,isReady:isReady,disabled:isDisabled}"

4. Queue diagnosis

az pipelines pool list --query "[].{id:id,name:name,hosted:isHosted}" -o table
az pipelines agent list --pool-id 12 --include-capabilities \
  --query "[].{name:name,status:status,enabled:enabled,ver:version,gpu:systemCapabilities.gpu}" -o table
# Organization Parallel jobs page: $ORG/_settings/buildqueue?_a=concurrentJobs  →  View in-progress jobs
# Pool Analytics tab: Pool consumption report (runs / queued / parallel limit over the last 30 days)
Name        Status    Enabled    Ver        Gpu
----------  --------  ---------  ---------  -----
azp-c1      online    True       5.282.0
azp-c2      offline   True       5.281.1

5. Checkout fix

steps:
- checkout: self
  fetchDepth: 0          # full history; YAML settings override the UI's Shallow fetch
  fetchTags: true        # turn on when git describe or version tools are needed
# Compromise when you only need to compare against main:
# - checkout: self
#   fetchDepth: 50
# - script: git fetch --no-tags origin main:refs/remotes/origin/main --depth=50

6. Find pipelines that use retired images or old tasks

git grep -n -E "vmImage: *['\"]?(ubuntu-20.04|ubuntu-22.04|windows-2019|macOS-1[34])" -- '*.yml' '*.yaml'
git grep -n -E "@[0-9]+" -- '*.yml' | grep -E "(Node|Npm|DotNetCoreCLI|AzureCLI|UsePythonVersion)@"

Lab: reproduce and fix four failures

No trigger (F1): faults/inject.sh 1. Observation: no new run appears on the Pipelines page. Use section 1 of “Commands” to confirm paths.include has become src/*, while the commit only changed azure-pipelines.yml. Fix: change paths back to [ app/*, azure-pipelines.yml ], then push and a run appears.
YAML compile error (F2): faults/inject.sh 2. Observation: the run fails immediately, and the top error contains Unexpected value 'step'. Use the preview API to reproduce the same error without running; after the fix, use preview again to confirm it returns finalYaml.
The pipeline is not valid (F3): faults/inject.sh 3. Observation: the error says the template file does not exist (templates/lint.yml). Fix: create the template or remove the reference:
mkdir -p templates && cat > templates/lint.yml <<'EOF'
steps:
- script: pip install ruff && ruff check app
  displayName: Lint
EOF
git add templates && git commit -qm "fix: add lint template" && git push
Shallow clone (F7): faults/inject.sh 7. Observation: the Version step fails fatal: No names found, cannot describe anything. (the baseline deliberately omits --always; in production, many scripts add --always, and the symptom turns into “the version number silently becomes a short SHA”, which is harder to spot). Fix: restore fetchDepth: 0 and fetchTags: true, and confirm in the log that the checkout command line no longer contains --depth=1.
(Optional) Resource not authorized (F4): faults/inject.sh 4 references a non-existent sc-azure-prod. Record the full original error text; then change it to sc-azure-lab, and in the service connection's Security → Pipeline permissions remove the myapp-ci authorization and run again, observe the “needs permission” prompt, and click Permit to restore it.
Cleanup: faults/reset.sh; confirm the service connection authorization is restored and the main run is green.

Case 1: “no deployment after merge” — UI overrides the YAML trigger

A team changed the trigger from main to release/*, but nothing happened after merging into release/2026.11. The cause: two years earlier someone had checked Override the YAML continuous integration trigger on the Triggers page and listed only main. YAML changes were completely ignored. Prevention: The platform team uses REST to periodically scan the triggers of all pipelines and files a ticket when a UI override is found; new projects turn on organization settings such as “disallow creating classic pipelines” to reduce the UI configuration surface.

Case 2: all deployments fail on Monday morning — service connection was automatically disabled

A production service connection used only for quarterly releases was unused for more than 100 days and was automatically disabled; on release day it reported “has been disabled or has not been authorized for use”. Fix: Service connections → Enable. Prevention: Run a read-only smoke deployment monthly (such as az account show) to keep the connection active, and alert on disable events in the audit stream.

Case 3: all version numbers became 0.1.0 — new pipeline defaults to shallow clone

After migrating to a new project, the re-created pipeline's default fetch depth was 1; GitVersion could not find tags, all artifact versions became 0.1.0-xxx, and NuGet pushes conflicted. Fix: Set uniformly in the template fetchDepth: 0; put the checkout into the required extends template (Lesson 5), so no pipeline can omit it.

Quick reference for error text

/azure-pipelines.yml (Line: 14, Col: 1): Unexpected value 'step'

Cause: A misspelled key or wrong indentation placed the key in a disallowed position. Fix: Change to steps; verify with the editor's Validate or the preview API.

While parsing a block mapping, did not find expected key

Cause: Mixed indentation, missing space after a colon, multi-line strings not using |. Fix: Check locally with yamllint; watch out for Tab characters.

pipx run yamllint -d relaxed azure-pipelines.yml
The pipeline is not valid. Job Job: Step AzureCLI input connectedServiceNameARM references service connection sc-azure-prod which could not be found. The service connection does not exist, has been disabled or has not been authorized for use.

Troubleshooting order: Name spelling (per project) → whether it is disabled (unused for 100 days) → whether it is authorized for this pipeline → whether it is shared across projects. See aka.ms/yamlauthz.

This pipeline needs permission to access a resource before this run can continue

Click View → Permit (requires the resource's administrator or user role); or add the pipeline to the authorization list in the resource's Security. Avoid turning on Open access whenever possible.

Could not find a pool with name lab-selfhosted. The pool does not exist or has not been authorized for use.

Cause: The project does not have this pool (organization-level pools must be added to the project) or it is not authorized. Fix: Project settings → Agent pools → Add pool → Existing, and authorize the pipeline.

No agent found in pool lab-selfhosted which satisfies the specified demands: gpu

Cause: demands do not match capabilities. Fix: Remove the demand, or set the capability on the agent (user capability or environment variable), then restart the agent. The exact error text depends on the actual run page.

Git fetch failed with exit code 128 … TF401019: The Git repository with name or identifier X does not exist or you do not have permissions

Cause: Limit job authorization scope to current project was turned on during a cross-project checkout. Fix: Turn that setting off, or grant the project build service identity read permission on the target repository (the scoped build identity from Lesson 3).

fatal: No names found, cannot describe anything.

Shallow clone or tags not fetched. Set fetchDepth: 0,fetchTags: true.

##[warning] task version deprecated / image retiring soon (jobs fail during the brownout)

Upgrade to a new major version of the task (read the change notes; input names may change); change vmImage to a supported version and pin it explicitly (for example ubuntu-24.04), and verify on a non-production branch first.

Command-line exercise

1. Write a checkout step: fetch the last 30 commits, do not fetch tags, and check out only app/ and charts/ two directories (agent ≥ 3.253.0 / 4.253.0).

Reference answer
- checkout: self
  fetchDepth: 30
  fetchTags: false
  sparseCheckoutDirectories: app charts

2. Use REST to verify without queuing whether the YAML on feature/x branch compiles.

Reference answer
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
  "$ORG/$PROJECT/_apis/pipelines/$PID/preview?api-version=7.1" \
  -d '{"previewRun":true,"resources":{"repositories":{"self":{"refName":"refs/heads/feature/x"}}}}'

Scenario analysis question: At 3 p.m. on Friday, CI in all projects in the organization has been queued for more than 30 minutes, but the self-hosted pool's agents are all online and idle. What are the possible causes, and how would you handle them?

Reference answer

Agents are idle yet jobs are queued, so the bottleneck is parallel-job slots rather than agents: the organization-level number of self-hosted parallel jobs is smaller than the number of online agents (for example, the MDP's Maximum agents is set to 10, but only 3 self-hosted parallel jobs were purchased). Go to the Parallel jobs page → View in-progress jobs to see who is using the slots (commonly a large matrix build in one project). In the short term, cancel low-priority runs; in the long term, buy slots based on the pool consumption report or limit the matrix's maxParallel.

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
Azure DevOps: Zero to Hero Tutorial — DevOps on Azure
English · duration and upload date not verified · purpose: review triggers, YAML structure and service connections
▶
Faster Azure DevOps Pipelines (#259) — Asp.Net Monsters
English · duration and upload date not verified · purpose: the effect of shallow clones and tag sync on checkout time

Official documentation

Video storyboard script

Shot 1 · 0:00–0:25
Visual: After a commit is pushed, the Pipelines page is empty; the shot zooms in on the YAML's paths: src/*.
Narration: No run is happening, so check the trigger first: branch and path filters read the YAML of the branch that was pushed.
Shot 2 · 0:25–0:55
Visual: A red banner reads Unexpected value 'step', then switches to The pipeline is not valid … not authorized.
Narration: An error with line and column numbers is a compile error; one with a resource name is most likely an authorization problem, and “not found” and “not authorized” are the same sentence.
Shot 3 · 0:55–1:25
Visual: The job is stuck at Queued; the Parallel jobs page shows 3/3 in use; the agent capabilities contain no gpu.
Narration: For queuing, distinguish between not enough slots and no agent that meets the requirements; buying more slots does not help the latter.
Shot 4 · 1:25–1:50
Visual: git describe reports No names found; after changing to fetchDepth: 0, the output is v1.0.0-5-g1a2b3c.
Narration: New pipelines default to shallow clones; when you need history and tags, always set them explicitly.
or score ≥ 70% on the quiz

Module 3 · Self-hosted agents, VMSS and Managed DevOps Pools

14:00 – 23:00 · From a long-running agent on one machine, to a single-use agent in a container, to an elastic pool that scales on demand
9 minAgent 5.282.0 · MDP GA · VMSS Uniform★★★★★ Core of this lesson
Learning objectives
  • Install self-hosted agents unattended, run them as systemd services, and upgrade and remove them; know the three registration methods: PAT, device code, and service principal.
  • Build a container agent from the official Dockerfile, and understand AZP_* environment variables, token files,--once single-use agents and the security cost of the Docker socket.
  • Explain the VMSS agent pool scaling rules (5-minute sampling, scale up by a percentage of the maximum, reclaim after 30 minutes idle) and the creation requirements.
  • Explain the Managed DevOps Pools architecture (VMs in the Microsoft subscription), prerequisites (resource providers, dev center project, quota), stateless/stateful, standby plans, and be able to create a pool with az mdp pool create .
  • Design agent isolation for pipelines of different trust levels: single-use agents, separate pools, project scoping, network isolation.
Prerequisites: M1; Docker course (images and containers). Importance:★★★★★

What: four ways to run jobs

Microsoft-hostedSelf-hosted (VM / physical machine / container)VMSS agent poolManaged DevOps Pools
Where the machines areMicrosoftAny environment you controlVMSS in your Azure subscriptionAzure subscription managed by Microsoft (can inject your VNet)
SpecsFixed: 2 cores / 7 GB / 14 GB SSD (about 10 GB free)AnyAny VM SKUAny supported SKU, default Standard D2ads v5; data disks configurable; up to 5 SKUs mixed (2026-09 Instance Mix)
Imagerunner-images (updated weekly, cannot be rolled back)Maintained by youMarketplace / custom image (do not pre-install the agent)Azure Pipelines images (same as hosted), curated Marketplace images, Compute Gallery images; multiple images allowed; image versions can be pinned
ScalingHandled by the platformHandled by youAzure Pipelines samples every 5 minutes and scales up by a percentage of the maximumIncrements by 1; supports standby plans and automatic prediction
BillingHosted parallel jobsSelf-hosted parallel jobs + your machinesSelf-hosted parallel jobs + Azure VMsSelf-hosted parallel jobs + Azure compute/storage/egress (cannot use VM reserved instances or Azure Hybrid Benefit)
Longest jobFree 1 hour / paid 31 hoursUnlimited (subject to timeout setting)Unlimited2 days

Self-hosted agent lifecycle

  1. Registration: config.sh Use an identity with pool management permission (PAT, device code, or service principal --auth SP, agent ≥ 3.227.1) to register with the organization; afterwards the agent communicates using its own generated RSA key pair and OAuth credentials (stored in .credentials,.credentials_rsaparams), and the registering identity's token is no longer used.
  2. Listening: Agent.Listener Pulls jobs from the service via HTTPS long polling (requires only outbound 443; no inbound ports).
  3. Execution: after picking up a job, it starts the Agent.Worker process, which downloads tasks, runs steps and streams logs back.
  4. Upgrade: the agent upgrades automatically when running a task that requires a newer version; you can also click Update all agents on the pool. The latest on the GitHub release page is v5.282.0 (2026-10-30, .NET 10), while the official Linux install docs still describe 4.x (.NET 8). Both auto-update; follow the release page and the version actually delivered to your organization.
  5. Removal: after stopping and uninstalling the service, ./config.sh remove; container agents automatically run remove in the exit trap.

Container agents and single-use agents

Official Dockerfiles for Ubuntu 24.04 / 22.04 / Alpine are provided, along with start.sh: at container start, use AZP_URL + token to call _apis/distributedtask/packages/agent to query the latest agent package and download it; config.sh --unattended … --replace --acceptTeeEula to register, and finally ./run.sh "$@"; on exit the trap calls config.sh remove. The new script supports service principals (AZP_CLIENTID/AZP_CLIENTSECRET/AZP_TENANTID, logging in with az to get an Entra token), writes the token to a file with 600 permissions, and via VSO_AGENT_IGNORE prevents the token variable from becoming a capability. Add docker run to the docker run command --once, the agent accepts only one job and then exits; combined with Kubernetes / Container Apps jobs / ACI to restart it, you get “one clean environment per job”. Cost: Mounting the host /var/run/docker.sock is equivalent to handing host root to pipeline code; after AKS 1.19 it uses containerd, with no Docker-in-Docker.

VMSS agent pool (elastic pool)

  • You first create the VMSS: must --disable-overprovision,--upgrade-policy-mode manual, turn off Azure autoscaling and instance protection, orchestration mode Uniform; the image must not pre-install the agent, Azure Pipelines installs the agent via a VM extension and runs it as the local user AzDevOps .
  • Pool settings: maximum VM count, standby agent count, minutes idle before removing extra agents (default 30), whether to tear down (rebuild the image) after each use, and whether to keep unhealthy agents for investigation.
  • Scaling rule: every 5 minutes it samples once; it scales up when idle agents < standby, or when jobs are queued and there is no idle agent; each step grows by a percentage of the maximum pool size, and each step may take 20 minutes; it scales down when idle exceeds standby by more than 30 minutes (configurable). The official docs note that a scale-up or scale-down cycle can take more than an hour.
  • The official guidance now recommends considering Managed DevOps Pools first for new scenarios.

Managed DevOps Pools (MDP)

  • What it is: The evolution of VMSS agent pools, a fully managed service, GA in 2024. VMs run in a Microsoft-owned subscription; in your own subscription you only see one Microsoft.DevOpsInfrastructure/pools resource; quota is independent from your subscription's compute quota (by default 5 cores for some SKU families).
  • Prerequisites: Register Microsoft.DevOpsInfrastructure and Microsoft.DevCenter; create a dev center and dev center project (can be created together when creating the pool in the portal, and can be shared across regions and subscriptions); the Azure role must be at least DevOps Infrastructure Contributor; the Azure DevOps organization must be connected to Entra ID; since 2025-10, only project-level agent pool Administrator or Creator permission on the target project is needed to create a pool (updating an existing pool still requires organization-level pool administrator).
  • Agent state: Default Stateless (fresh agent every time, one new machine per job; officially recommended to defend against supply-chain attacks); Stateful (the same agent can be used by multiple builds): reusable agents,maxAgentLifetime default and maximum 7.00:00:00,gracePeriodTimeSpan no grace period by default.
  • Standby agents: Off by default: machines are powered on when a job arrives, which may wait from tens of seconds to 15 minutes. Configurable as Manual (Start from scratch / Weekday / All week plans,resourcePredictions.daysData seven items starting Sunday, time zone defaults to UTC, counts do not reset automatically) or Automatic (based on the past 3 weeks of data, taking percentiles over 5-minute windows: MostCostEffective 10% … Balanced 50% (default) … BestPerformance 90%).
  • Other: Multiple organizations sharing one pool, Key Vault certificates, agent IP shown in the Initialize job log, Log Analytics, pinned image versions, startup scripts (2026-09), pool aliases (2026-06); roadmap: Spot VMs (TBD), manual agent reclamation (end of 2026).

Security isolation principles

  • Untrusted code (external contributor PRs, forks) runs only on Microsoft-hosted or single-use agents.
  • Keep production deployment pools separate from CI pools; authorize a pool only to the projects and pipelines that need it (do not use Open access).
  • The agent run user is not the registering user; the agent directory is accessible only to the run user and administrators; do not run the service as root on Linux.
  • Stateful and long-lived agents must be rebuilt periodically; open only the necessary outbound traffic on the network (dev.azure.com,*.dev.azure.com,download.agent.dev.azure.com,login.microsoftonline.com etc.).

Common misconceptions

  • “Setting MDP Maximum agents to 10 lets 10 jobs run concurrently.” No: the concurrency ceiling is still the number of self-hosted parallel jobs the organization purchased self-hosted parallel jobs (M5).
  • “VMSS pools scale up immediately.” No: the sampling period is 5 minutes and each step may take 20 minutes, so bursty load has to rely on standby.
  • “Pre-installing the agent in the VMSS image is faster.” No: official guidance explicitly says not to pre-install it; the agent is installed by an extension.
  • “Container agents are inherently isolated.” No: once docker.sock is mounted or privileged mode is used, they are no longer isolated.

State machine of elastic agent pools

Job queuedSlot available Scale-up decisionVMSS 5 min / MDP immediate ProvisioningVM creation + extension Register / ReadyAgent online · idle AllocatedRunning job Reclaim / rebuild imageStateless: after each job · stateful: grace period / up to 7 days Standby (warm)VMSS: fixed count · MDP: by schedule / automatic prediction
Figure 3-1: both elastic pools follow “queue → scale up → register → pick up → reclaim”; the differences are decision frequency, scale-up step size and warm-up strategy

Managed DevOps Pools architecture

Your Azure subscription Microsoft.DevOpsInfrastructure/pools resource dev center project Optional: your VNet subnet Quota (vCPUs per SKU family, independent of compute quota) Microsoft-managed subscription VMSS (Instance Mix ≤ 5 SKUs) Agent VM Agent VM Image · Key Vault certificate · startup script Azure DevOps organizationSame-named agent pool (multiple organizations possible)Self-hosted parallel job slots
Figure 3-2: MDP resources are in your subscription, VMs are in Microsoft's subscription; when injected into a VNet, the agent NICs sit in your subnet

Core animation: elastic agent pool scaling on demand

Switch between VMSS and Managed DevOps Pools, adjust standby and the maximum number of agents, then “submit jobs.” Each “next tick” advances simulated time by 1 minute. Watch: job queued → pool scales up → agent registers → picks up job → idle reclaim.

Queued jobs
Agent pool
Queued / powering onRegistered · idleRunning jobReclaiming
Time t=0 min. Click “Submit 3 jobs” to start.
What to watch① VMSS makes decisions only at the 5-minute sampling points and scales up several machines at once by a percentage of the maximum; MDP increments by 1 and starts powering on immediately. ② With standby > 0, jobs barely wait, but idle agents are billed too. ③ No matter how many agents there are, concurrently running jobs cannot exceed the “parallel job slots.” ④ Stateless pools reclaim after each job; stateful pools reuse agents within the grace period. The time constants are illustrative (official magnitudes: about 20 minutes per VMSS step, and tens of seconds to 15 minutes for MDP on-demand power-on); the simulation scales them down proportionally.

1. Self-hosted Linux agent (unattended + systemd)

sudo useradd -m -s /bin/bash azagent          # run user ≠ registering user
sudo -iu azagent bash -c '
mkdir -p ~/myagent && cd ~/myagent
curl -fsSLO https://download.agent.dev.azure.com/agent/5.282.0/vsts-agent-linux-x64-5.282.0.tar.gz
tar zxf vsts-agent-linux-x64-5.282.0.tar.gz'
cd /home/azagent/myagent && sudo ./bin/installdependencies.sh
# Method A: PAT (scope Agent Pools: Read & manage, short lifetime)
sudo -u azagent ./config.sh --unattended --url "$ORG" --auth pat --token "$PAT" \
  --pool lab-selfhosted --agent "$(hostname)-1" --work _work --replace --acceptTeeEula
# Method B: service principal (agent ≥ 3.227.1; the SP must first join the organization and become Administrator of the pool)
# sudo -u azagent ./config.sh --unattended --url "$ORG" --auth SP --clientid "$APP_ID" \
#   --tenantid "$TENANT_ID" --clientsecret "$SECRET" --pool lab-selfhosted --agent "$(hostname)-1" --acceptTeeEula
sudo ./svc.sh install azagent && sudo ./svc.sh start && sudo ./svc.sh status
>> Connect:
Connecting to server ...
>> Register Agent:
Scanning for tool capabilities.
Connecting to the server.
Successfully added the agent
Testing agent connection.
2026-11-15 10:02:11Z: Settings Saved.
● vsts.agent.contoso-lab.lab\x2dselfhosted.lab-vm-1.service - Azure Pipelines Agent (contoso-lab.lab-selfhosted.lab-vm-1)
     Active: active (running)

Configuration parameters can all be set with environment variables VSTS_AGENT_INPUT_<UPPERCASE_PARAMETER_NAME> instead (for example VSTS_AGENT_INPUT_TOKEN), to keep tokens out of shell history. After installing new software, run ./env.sh && sudo ./svc.sh stop && sudo ./svc.sh start to refresh capabilities.

2. Upgrade and removal

az pipelines agent list --pool-id 12 --query "[].{n:name,v:version,s:status}" -o table
# UI: Organization settings → Agent pools → lab-selfhosted → … → Update all agents
sudo ./svc.sh stop && sudo ./svc.sh uninstall
sudo -u azagent ./config.sh remove --unattended --auth pat --token "$PAT"

3. Container agent (official Ubuntu 24.04 example, excerpt)

# azp-agent-linux.dockerfile
FROM ubuntu:24.04
ENV TARGETARCH="linux-x64"
RUN apt update && apt upgrade -y && apt install -y curl git jq libicu74
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
WORKDIR /azp/
COPY ./start.sh ./
RUN chmod +x ./start.sh
RUN useradd -m -d /home/agent agent && chown -R agent:agent /azp /home/agent
USER agent
ENTRYPOINT [ "./start.sh" ]

start.sh Copy in full from the official document “Run a self-hosted agent in Docker” (must use LF line endings). Core steps: verify AZP_URL → load the token (PAT or SP), write it to a 600-permission file and unset it → query _apis/distributedtask/packages/agent?platform=$TARGETARCH&top=1 → download and extract → config.sh --unattended --agent … --url … --auth PAT --token … --pool … --work … --replace --acceptTeeEula → ./run.sh "$@"; trap EXIT/INT/TERM calls config.sh remove (retries up to 10 times).

docker build --tag azp-agent:linux --file ./azp-agent-linux.dockerfile .
# Long-running container agent
docker run -d --restart unless-stopped --name azp-c1 \
  -e AZP_URL="$ORG" -e AZP_TOKEN="$PAT" -e AZP_POOL=lab-selfhosted -e AZP_AGENT_NAME=azp-c1 azp-agent:linux
# Single-use agent: exits after processing one job (the orchestrator restarts it)
docker run --rm --name azp-once -e AZP_URL="$ORG" -e AZP_TOKEN="$PAT" -e AZP_POOL=lab-selfhosted azp-agent:linux --once
docker logs -f azp-c1 | sed -n '1,30p'
1. Determining matching Azure Pipelines agent...
2. Downloading and extracting Azure Pipelines agent...
3. Configuring Azure Pipelines agent...
Successfully added the agent
4. Running Azure Pipelines agent...
2026-11-15 10:20:31Z: Listening for Jobs

4. VMSS agent pool (in your subscription)

az group create -n rg-ado-lab -l canadacentral
az vmss create -n vmss-ado-agents -g rg-ado-lab --image Ubuntu2204 \
  --vm-sku Standard_D2s_v5 --storage-sku StandardSSD_LRS \
  --authentication-type SSH --generate-ssh-keys --instance-count 2 \
  --disable-overprovision --upgrade-policy-mode manual \
  --single-placement-group false --platform-fault-domain-count 1 \
  --load-balancer "" --orchestration-mode Uniform
az vmss show -g rg-ado-lab -n vmss-ado-agents --query "{over:overprovision,upgrade:upgradePolicy.mode}"
# Then: Project settings → Agent pools → Add pool → Azure virtual machine scale set
# (the person configuring it needs Owner or User Access Administrator on the subscription; only ARM service connections based on a service principal secret are supported)

5. Managed DevOps Pools (CLI)

az provider register --namespace Microsoft.DevOpsInfrastructure
az provider register --namespace Microsoft.DevCenter
az extension add --name devcenter --upgrade
az extension add --name mdp --upgrade
az devcenter admin devcenter create -n dc-ado-lab -g rg-ado-lab -l canadacentral
DEVCID=$(az devcenter admin devcenter show -n dc-ado-lab -g rg-ado-lab --query id -o tsv)
az devcenter admin project create -n dcp-ado-lab -g rg-ado-lab -l canadacentral --dev-center-id $DEVCID
DEVCPID=$(az devcenter admin project show -n dcp-ado-lab -g rg-ado-lab --query id -o tsv)

cat > agent-profile.json <<'EOF'
{ "Stateless": {},
  "resourcePredictionsProfile": { "kind": "Manual" },
  "resourcePredictions": { "timeZone": "Eastern Standard Time",
    "daysData": [ {}, {"09:00:00":1,"17:00:00":0}, {"09:00:00":1,"17:00:00":0},
                  {"09:00:00":1,"17:00:00":0}, {"09:00:00":1,"17:00:00":0}, {"09:00:00":1,"17:00:00":0}, {} ] } }
EOF
cat > fabric-profile.json <<'EOF'
{ "vmss": { "sku": { "name": "Standard_D2as_v5" },
  "images": [ { "aliases": ["ubuntu-24.04"], "buffer": "*", "wellKnownImageName": "ubuntu-24.04/latest" } ],
  "osProfile": { "secretsManagementSettings": { "observedCertificates": [], "keyExportable": false }, "logonType": "Service" },
  "storageProfile": { "osDiskStorageAccountType": "Standard", "dataDisks": [] } } }
EOF
cat > organization-profile.json <<EOF
{ "AzureDevOps": { "organizations": [ { "url": "$ORG", "projects": ["myapp-lab"], "parallelism": 2 } ],
  "permissionProfile": { "kind": "CreatorOnly" } } }
EOF
POOL=mdp-myapp-$(openssl rand -hex 3)          # pool name must be globally unique in Azure
az mdp pool create -n $POOL -g rg-ado-lab -l canadacentral --devcenter-project-id $DEVCPID \
  --maximum-concurrency 2 --agent-profile agent-profile.json \
  --fabric-profile fabric-profile.json --organization-profile organization-profile.json
# Use MDP in a pipeline (the pool name equals the Azure resource name, or use the pool alias supported since 2026-06)
pool:
  name: mdp-myapp-1a2b3c
  demands:
  - ImageOverride -equals ubuntu-24.04     # specify the image alias for multi-image pools
Costs and cleanup MDP is billed by actual Azure VM running time (in the example above, Standard_D2as_v5; one standby machine 9–17 on weekdays ≈ 40 machine-hours per week), plus self-hosted parallel jobs. When the lab is finished: az group delete -n rg-ado-lab --yes --no-wait (this also deletes the VMSS, dev center and MDP). By default only some SKU families have a 5-core quota; exceeding it reports Cores needed to complete this request is N, which exceeds the current limit …, which you must request under Quotas → Managed DevOps Pools.

Lab: deploy a self-hosted container agent and run myapp-ci on it

Cost: $0 if you use an existing lab machine; a new Azure VM (B2s, canadacentral) costs a few cents per hour, so delete it when done. Permission: Administrator of the lab-selfhosted pool in the organization. Security risk: PAT leakage — use a 1-day lifetime, scope it to Agent Pools (Read & manage) only, and revoke it immediately after finishing; do not mount docker.sock.

Create the pool: Organization settings → Agent pools → Add pool → Self-hosted, name lab-selfhosted,do not check Grant access permission to all pipelines. Then confirm in the myapp-lab project that the pool appears under Project settings → Agent pools.
Build the image: on the lab machine mkdir ~/azp-agent-in-docker && cd ~/azp-agent-in-docker, save the Dockerfile per section 3 of “Commands”, and copy in full from the official docs start.sh, then docker build.
Start two long-running agents:
read -rs PAT   # paste the short-lived PAT; it does not enter shell history
for i in 1 2; do docker run -d --restart unless-stopped --name azp-c$i \
  -e AZP_URL="$ORG" -e AZP_TOKEN="$PAT" -e AZP_POOL=lab-selfhosted -e AZP_AGENT_NAME=azp-c$i azp-agent:linux; done
unset PAT
az pipelines agent list --pool-id $(az pipelines pool list --pool-name lab-selfhosted --query "[0].id" -o tsv) -o table
Switch the pipeline: on a new branch, change pool: to name: lab-selfhosted, and push. The first run shows “needs permission … Permit”—this is exactly the resource authorization covered in M2. After Permit, observe the Agent name and Agent version in the Initialize job log. Without Python 3.12 in the container, UsePythonVersion fails (a self-hosted agent must have the matching version pre-installed in the tool cache)—either install Python in the image, or switch to script: python3 -m venv.
Try a single-use agent: docker run --rm … azp-agent:linux --once, trigger a run; the container exits automatically and is removed from the pool. Think about how to “restart as soon as a job ends” in Kubernetes (Deployment restartPolicy, KEDA azure-pipelines scaler, Container Apps jobs).
Check diagnostic logs: docker exec azp-c1 ls /azp/_diag (the agent is extracted in WORKDIR /azp), and find the Worker log for this job.
(Optional) MDP: following section 5 of “Commands,” create a stateless pool with maximum-concurrency 2, run the pipeline once, and watch Provisioning → Ready → Allocated → reclaim in the Agents view of the MDP resource in the Azure portal. Note: The number of concurrently running jobs is also limited by the organization's self-hosted parallel job slots (1 free).
Cleanup: docker rm -f azp-c1 azp-c2 (the trap deregisters the agent; if the container is force-killed, the agent is left behind as offline and must be deleted manually in the pool); revoke the PAT; optionally az group delete -n rg-ado-lab.

Case 1: VMSS pool morning-peak queue of 40 minutes → migrated to MDP

A team's VMSS pool had a maximum of 40 machines and 2 standby. Every day at 9:00, 30 PRs triggered at once; sampling every 5 minutes and scaling up 25% per step (10 machines), plus about 20 minutes of creation time per step, meant the last job waited 40 minutes. After migrating to MDP: incrementing by 1, with Automatic standby (Balanced) warming up at 8:45 based on the past 3 weeks of data, average queue time dropped to under 2 minutes; overnight, standby automatically drops to 0. Note: MDP cannot use the VM reserved instances they had purchased earlier, so costs must be re-evaluated (M5).

Case 2: an external contributor's PR ran a crypto-mining script on a long-running agent

An open-source project ran fork PR builds on long-running self-hosted agents, and the malicious PR left a scheduled task on the host _work outside the workspace. Remediation: Fork PRs use only Microsoft-hosted agents; internal CI moved to a stateless MDP pool (a fresh VM per job); the production deployment pool is authorized only to the release pipeline and requires approval (Lesson 6).

Case 3: all Docker builds failed on container agents on AKS

The team took the Deployment from the official example that mounts /var/run/docker.sock and deployed it to a new AKS cluster. All Docker@2 tasks reported that the Docker daemon could not be found—AKS has used containerd since 1.19. Switching to a BuildKit remote builder in the agent (or ACR Tasks az acr build) restored builds and also removed the security risk of mounting the host socket.

Common errors and fixes

docker logs: error: could not determine a matching Azure Pipelines agent

Cause:AZP_URL Written incorrectly (includes a project name), or the token is invalid / its scope is insufficient. Fix: The URL should stop at the organization https://dev.azure.com/<org>; the token needs Agent Pools (Read & manage).

standard_init_linux.go: exec user process caused "no such file or directory"

Cause: The file edited on Windows start.sh has CRLF line endings. Fix:dos2unix start.sh then rebuild; add to the repository .gitattributes: *.sh text eol=lf.

Must not run with sudo / Must not run interactively with sudo

The agent refuses to run as root. Run it as a regular user; if root is truly needed in a container, set AGENT_ALLOW_RUNASROOT=true (not recommended).

Agent registration reports that an agent with the same name already exists / two agents keep kicking each other offline

When using --replace the old agent shuts down after a few minutes of conflict; make sure each container has a unique AZP_AGENT_NAME (the default is the container hostname).

VMSS pool: Invalid Service Endpoint with Id <guid> and Scope <guid>

VMSS pools only support service principal secret-based ARM service connections; certificate-based or managed-identity connections fail. Use Authorize instead (select the subscription directly), create a new SP-secret connection, or evaluate migrating to MDP.

VMSS pool: This virtual machine scale set is already in use by pool <pool name>

After the pool was deleted, the _AzureDevOpsElasticPool tag on the VMSS was not cleaned up (best effort; it may linger for up to 2 hours). Wait, or delete the tag in the portal's Tags.

MDP: Cores needed to complete this request is 8, which exceeds the current limit of 0 for SKU family …

MDP quota is independent and low by default. Quotas → Managed DevOps Pools → Request adjustment; or switch to a SKU family / region that has quota.

MDP creation “succeeds” but the pool is not visible in the project

You have project-level agent pool Administrator/Creator permission but you are not a member of that project; this can fail silently. First become a project member (any role), then redeploy.

MDP: jobs queued although the pool has Ready agents that do not pick them up

The multi-image pool does not use the ImageOverride demand (defaults to the first image); or ImageVersionOverride image version differs from the standby agents; or the pipeline forces an older Agent.Version which causes the agent to be re-downloaded.

Command-line exercise

1. Write the MDP agent profile: stateful, agents live at most 1 day, 30-minute idle grace, automatic standby biased toward cost (MoreCostEffective).

Reference answer
{ "Stateful": { "maxAgentLifetime": "1.00:00:00", "gracePeriodTimeSpan": "00:30:00" },
  "resourcePredictionsProfile": { "Automatic": {}, "predictionPreference": "MoreCostEffective" } }

The JSON shape for the CLI follows az mdp pool create --help and the Azure CLI tab of the Configure scaling docs (written as in an ARM template: "kind": "Stateful" / "kind": "Automatic").

2. Start a single-job agent with one docker run command, joining the pool ci-ephemeral, using a service principal instead of a PAT.

Reference answer
docker run --rm -e AZP_URL="$ORG" -e AZP_CLIENTID="$APP_ID" -e AZP_CLIENTSECRET="$SECRET" \
  -e AZP_TENANTID="$TENANT_ID" -e AZP_POOL=ci-ephemeral azp-agent:linux --once

Scenario analysis question: The company has three types of workload: ① external contributor PRs; ② internal CI (needs access to the internal Nexus); ③ production deployment (needs access to the private AKS API). Design an agent plan.

Reference answer

① Microsoft-hosted agents (strongest isolation, no access to the internal network). ② A stateless MDP pool injected into the internal VNet, with build tools pre-installed in the image and standby scheduled on weekdays; authorized only to the CI pipeline. ③ A separate MDP (or self-hosted) pool injected into a subnet that can reach the AKS private endpoint; stateful or not as needed; authorized only to the release pipeline, with approval and branch-control checks on the environment; monitor parallel-job usage for each of the three pools separately.

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
Public Preview of Managed DevOps Pools (MDP) for Azure DevOps — Azure Power Lunch
English · recorded during the public preview; for features that have since become GA (such as project-level permission to create pools, Instance Mix), follow this lesson and the official docs
▶
EVERYTHING About the Scale Set Agents for Azure Pipelines (VMSS) — CoderDave
English · duration and upload date not verified · purpose: creating and configuring VMSS pools
▶
Learning How to Set Up an Azure Virtual Machine Scale Set Agents for Azure DevOps — Mike Douglas
English · duration and upload date not verified · purpose: VMSS agent demo
▶
Scaling Containerized Azure DevOps Agents with AKS + KEDA — Federal App Innovation Community
English · duration and upload date not verified · purpose: container agents + the idea of scaling by queue (this lesson covers only the principles)

Official documentation

Video storyboard script

Shot 1 · 0:00–0:25
Visual: On the left, three job cards turn yellow and queue; on the right, the pool has no agents.
Narration: The starting point of an elastic pool is the queue: slots available, no agents.
Shot 2 · 0:25–0:55
Visual: In VMSS mode, when the clock reaches 5 minutes, two yellow VMs appear at once; in MDP mode, one appears immediately, then another.
Narration: VMSS samples every five minutes and scales by percentage; MDP increments one machine at a time and can warm up on a schedule.
Shot 3 · 0:55–1:25
Visual: VMs turn blue (registered successfully, idle); jobs fly in and turn green; after a job completes, stateless agents turn red and are reclaimed.
Narration: Agents pick up jobs after registering; stateless pools reclaim after each job; stateful pools reuse agents within the grace period.
Shot 4 · 1:25–1:50
Visual: Six agents are in the pool, but the parallel-job slot count shows 4, and two remain idle the whole time.
Narration: No matter how many agents there are, concurrency will not exceed the number of self-hosted parallel jobs the organization purchased.
or score ≥ 70% on the quiz

Module 4 · Performance: parallelism, caching and agent sizing

23:00 – 30:00 · Measure before optimizing: find the critical path, then shorten it step by step with parallelism, caching, stronger agents, fewer checkouts and incremental builds
7 minCache@2 · strategy · fetchFilter★★★★☆
Learning objectives
  • Use the run timeline to find the critical path (the longest dependency chain) and know which segment is worth optimizing.
  • Use dependsOn,strategy: matrix,strategy: parallel slicing for parallelism, and understand how much they consume parallel-job slots.
  • Use correctly Cache@2 (key / restoreKeys / cacheHitVar, scope, immutability, 7-day expiry), and know the difference between a cache and an artifact.
  • Choose agent sizing by bottleneck (hosted 2-core 7 GB vs MDP large sizes / data disks / stateful reuse).
  • Slim down checkout (fetchDepth,fetchFilter,sparseCheckoutDirectories,checkout: none) and incremental builds (path filters, choosing jobs by change).
Prerequisites: M2 (checkout), M3 (agent types). Importance:★★★★☆

What: where pipeline time goes

The wall-clock time of a run = queue time + the sum of job times along the critical path. Each job consists of agent preparation (power-on / initialization) → checkout → dependency restore → compile → test → package/upload. Before optimizing, look at the job timeline and per-step durations on the run page, or use the M1 timeline API to tally each step's startTime/finishTime.

Why / How: five levers

LeverApproachBenefitCost / pitfall
Parallel jobssplit lint / unit tests / security scanning into jobs with no dependencies; strategy: matrix multiple versions; strategy: parallel: N test slicingthe critical path shrinks to the longest single jobeach job consumes a parallel-job slot and repeats checkout/restore; with too few slots it can actually be slower
CachingCache@2 Cache package manager cache directories (pip, npm, NuGet, Maven, Gradle), ccache, Docker buildx local cacherestore drops from minutes to secondsrestoring and saving have overhead; caches are immutable, so a fixed key never updates; do not cache node_modules (npm ci will delete it)
Agent sizingCPU-heavy work: more cores; memory-starved: more memory; disk short: add a data disk (MDP); stateful agents reuse workspace and package cachecompile/test scales roughly linearly (until I/O becomes the bottleneck)billed hourly; hosted agents cannot be upsized
Reduce checkoutfetchDepth: 1 (when history is not needed),fetchTags: false,fetchFilter: blob:none (partial clone),sparseCheckoutDirectories, deployment jobs checkout: nonelarge-repo checkout drops from minutes to secondsconflicts with M2's “needs history”; choose per job
Incremental buildstrigger.paths trigger only when relevant directories change; choose which jobs to run by git diff ; stateful agents workspace: clean: outputs keep the sourcemany commits do not need a full run at allthe decision logic must be reliable, or tests get missed

Cache scope rules (important)

  • Caches are isolated by project + pipeline + branch; CI runs can read and write their source branch and read-only main/master; PR runs read only the source/target branches,and write only to the merge (intermediate) branch refs/pull/N/merge; fork PRs cannot read the source branch.
  • So the branch name does not need to be in the key; the first run on a new branch restores from main's cache (restoreKeys prefix matching).
  • Cache immutable: within a scope, the same key is saved only once; when content changes, the key must change (use a lock-file hash). Caches cannot be cleared manually; you can only change the key (for example by adding v2 | prefix); expires automatically after 7 days without access; officially there is no enforced size limit; classic release pipelines do not support it.
  • Saving happens in the automatic “Post-job: Cache” step after all steps in the job succeed; a failed job does not save.

When: when not to optimize

If the total duration is < 3 minutes, or the bottleneck is queuing (the parallel-job issue in M5), do not touch the YAML first; also do not add caching when restoring the cache is slower than re-downloading (small dependencies, fast mirrors).

Common misconceptions

  • “More jobs means faster.” No: with 1 parallel-job slot, splitting into 4 jobs runs them serially and adds 3 extra checkouts.
  • “Caches can pass build outputs between jobs.” No: that is the job of Pipeline Artifacts ; a cache is a speedup that works even without it.
  • “Turning on system.debug does not affect speed.” No: log volume increases significantly.

Critical path before and after optimization

Before optimization (single job, about 14 minutes) init 1′ checkout 2′ pip install 3′ lint 1′ pytest 5′ docker build 2′ After optimization (parallel + cache + lean checkout, about 5 minutes) init lint job ≈1.5′ pytest 1/2 2.5′ pytest 2/2 2.5′ build 1′ Green: shallow/partial checkout (≈20 s) + dependency restore with cache hit (≈30 s) Red: test slicing strategy: parallel: 2 Blue: docker buildx + local cache, dependsOn the two test slices Prerequisite: at least 3 parallel-job slots, otherwise jobs run serially
Figure 4-1: the critical path drops from 14 minutes to about 5 minutes (illustrative data); when slots are insufficient, the benefit of parallelism disappears

Cache scope

main scopeCI writes on main feature/x scopereads its own + reads main, writes its own refs/pull/7/mergePR: reads source/target/main, writes only here Blue lines = readable; within each scope the same key can be written only once (immutable), expiring after 7 days without access
Figure 4-2: caches are isolated by project/pipeline/branch, so the key does not need the branch name

Interactive: pipeline duration calculator

Turn each optimization on or off and observe the critical path and the parallel-job slots consumed. The numbers are illustrative measurements based on myapp-ci, for understanding trade-offs; they are not a benchmark.

1. Tally the duration of each step (find the critical path)

curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJECT/_apis/build/builds/$RUN/timeline?api-version=7.1" |
jq -r '.records[] | select(.type=="Task" and .startTime and .finishTime) |
  [(((.finishTime|sub("\\.[0-9]+";"")|fromdateiso8601) - (.startTime|sub("\\.[0-9]+";"")|fromdateiso8601))|tostring), .name] | @tsv' |
sort -rn | head
302	Test
181	Install dependencies
118	Checkout myapp@main to s
96	Docker build

2. Optimized myapp-ci

trigger:
  branches: { include: [ main ] }
  paths:    { include: [ app/*, Dockerfile, azure-pipelines.yml ] }   # incremental: doc-only changes do not trigger

variables:
  PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip

stages:
- stage: CI
  jobs:
  - job: Lint
    pool: { vmImage: ubuntu-24.04 }
    steps:
    - checkout: self
      fetchDepth: 1
      fetchFilter: blob:none          # partial clone (agent ≥ 3.253.0 / 4.253.0)
      sparseCheckoutDirectories: app
    - script: pipx run ruff check app
  - job: Test
    pool: { vmImage: ubuntu-24.04 }
    strategy:
      parallel: 2                     # 2 slices, each using 1 parallel-job slot
    steps:
    - checkout: self
      fetchDepth: 1
    - task: UsePythonVersion@0
      inputs: { versionSpec: '3.12' }
    - task: Cache@2
      inputs:
        key: 'pip | "$(Agent.OS)" | app/requirements.txt'
        restoreKeys: |
          pip | "$(Agent.OS)"
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip
    - script: pip install -r app/requirements.txt pytest
    - script: |
        # assign test files by slice index
        files=$(ls app/tests/test_*.py | awk "NR % $(System.TotalJobsInPhase) == $(System.JobPositionInPhase) - 1")
        pytest -q $files --junitxml=$(Agent.TempDirectory)/junit.xml
      displayName: Test slice $(System.JobPositionInPhase)/$(System.TotalJobsInPhase)
    - task: PublishTestResults@2
      condition: always()
      inputs: { testResultsFiles: '$(Agent.TempDirectory)/junit.xml' }
  - job: Image
    dependsOn: [ Lint, Test ]
    pool: { vmImage: ubuntu-24.04 }
    steps:
    - checkout: self
      fetchDepth: 1
    - task: Cache@2
      inputs:
        key: 'buildx | "$(Agent.OS)" | Dockerfile | app/requirements.txt'
        restoreKeys: 'buildx | "$(Agent.OS)"'
        path: $(Pipeline.Workspace)/buildx-cache
    - script: |
        docker buildx create --use --driver docker-container
        docker buildx build --cache-from type=local,src=$(Pipeline.Workspace)/buildx-cache \
          --cache-to type=local,dest=$(Pipeline.Workspace)/buildx-cache-new,mode=max \
          -t myapp:$(Build.BuildId) --load .
        rm -rf $(Pipeline.Workspace)/buildx-cache && mv $(Pipeline.Workspace)/buildx-cache-new $(Pipeline.Workspace)/buildx-cache

buildx's cache-to is written to a new directory and then swapped, to avoid unbounded growth of the local cache (a known BuildKit usage). In deployment jobs, use checkout: none, and skip artifacts that a deployment job does not need with - download: none to skip automatic download.

3. Decide which jobs to run by change (incremental)

- job: Detect
  steps:
  - checkout: self
    fetchDepth: 2
  - bash: |
      if git diff --name-only HEAD~1 HEAD | grep -q '^charts/'; then
        echo "##vso[task.setvariable variable=chartsChanged;isOutput=true]true"; fi
    name: diff
- job: HelmLint
  dependsOn: Detect
  condition: eq(dependencies.Detect.outputs['diff.chartsChanged'], 'true')
  steps:
  - script: helm lint charts/myapp

For PR builds, HEAD~1 is the first parent commit of the merge commit (the target branch). For pushes with multiple commits, use $(Build.SourceVersion) comparison against the commit of the last successful build is more reliable (you can query the most recent successful run via REST).

Lab: before-and-after comparison

Record the baseline: run the baseline pipeline twice in a row on main (the second run rules out one-time download effects), and use the script in section 1 of “Commands” to record per-step and total durations.
Add caching: add only Cache@2 (pip). The first run should show Cache miss and upload in Post-job: Cache; the second run should show Cache restored. Record the change in duration of the pip install step.
Resolving key:
 - pip                         [string]
 - "Linux"                     [string]
 - app/requirements.txt        [file] --> 6E1F...C2
Resolved to: pip|"Linux"|9m3wq...
Entry found at fingerprint: `pip|"Linux"|9m3wq...`
Cache restored.
Modify a dependency to verify immutability: add a package to requirements.txt and observe the key change → exact miss → restoreKeys partial hit (cacheHitVar is inexact) → the job saves the new key when it finishes.
Split for parallelism: switch to the multi-job structure in section 2 of “Commands.” If the organization has only 1 parallel job, observe the jobs queueing one after another and the total duration getting longer; compare again when two agents in the M3 self-hosted container agent pool are running at the same time and the self-hosted slots are sufficient.
Lean checkout: the lint job's checkout log should show --filter=blob:none and sparse-checkout-related commands; record the checkout step time.
Write conclusions: organize the four measurements into a table (step × option), to serve as input for the capstone “performance/cost optimization report.”

Case 1: 12 GB single-repo game project, checkout 9 minutes → 40 seconds

Changed to fetchDepth: 1 + fetchFilter: blob:none + sparseCheckoutDirectories check out only the engine and the current game directory; art assets go through Azure Artifacts Universal Packages and are cached with Cache@2. Trade-off: the release-notes generation job, which needs full history, uses fetchDepth: 0 separately.

Case 2: cache hit rate 0% — a timestamp was in the key

The key was written as npm | $(Build.BuildNumber) | package-lock.json, producing a new key every time and wasting upload time. Changed to npm | "$(Agent.OS)" | package-lock.json and with restoreKeys added, the hit rate > 90%.

Case 3: .NET monolith tests 40 minutes → stateful MDP + 8 cores

On a 2-core hosted agent the tests were CPU-bound; switched to a stateful MDP D8ads_v5 pool (workspace and NuGet cache kept on the agent, 30-minute grace period), and used strategy: parallel: 3 slicing. Total duration 12 minutes. Trade-off: stateful agents share state between jobs, so use them only for internal trusted code, and recycle them on a maxAgentLifetime regular schedule.

Common errors and fixes

Cache@2: Path does not exist / every run is a cache miss

A file path segment in the key does not exist (relative to $(System.DefaultWorkingDirectory) resolution), or the key contains a value that changes every time. A string segment with . is treated as a file path, so it needs double quotes: "my.key".

Cache@2 fails on a self-hosted Linux agent: tar-related errors

Self-hosted agents need GNU tar on PATH (Windows also recommends 7-Zip; macOS uses BSD tar). Hosted agents have it pre-installed.

Caches written by PR builds are not usable on main

This is by design: PRs only write to refs/pull/N/merge scope. CI runs on main create main's cache, which all branches can read afterwards.

After strategy: parallel the test count doubles / tests are missed

The slicing script does not use System.JobPositionInPhase (starting from 1) and System.TotalJobsInPhase correct modulo. Compare the total number of published test results before and after optimization.

fetchFilter / sparseCheckoutDirectories are ignored

Agent version too old (needs 3.253.0 / 4.253.0 or later) or Git version too old; Microsoft-hosted and MDP use new agents by default. Confirm by checking the git command line in the checkout log.

no space left on device (hosted agent)

Hosted agents have only about 10 GB of free space and cannot be expanded. Clean up Docker images, reduce the cache, or switch to MDP and mount a data disk.

Command-line exercise

1. Write a Cache@2 for an npm project: cache the npm shared cache directory, build the key from the OS and package-lock.json, and on a full cache hit skip npm ci everything except the warm-up script.

Reference answer
variables:
  npm_config_cache: $(Pipeline.Workspace)/.npm
steps:
- task: Cache@2
  inputs:
    key: 'npm | "$(Agent.OS)" | package-lock.json'
    restoreKeys: |
      npm | "$(Agent.OS)"
    path: $(npm_config_cache)
    cacheHitVar: NPM_CACHE_RESTORED
- script: npm ci
- script: ./scripts/warmup.sh
  condition: ne(variables.NPM_CACHE_RESTORED, 'true')

2. Write a matrix: Python 3.11 / 3.12 / 3.13, running at most 2 at a time.

Reference answer
strategy:
  matrix:
    py311: { pythonVersion: '3.11' }
    py312: { pythonVersion: '3.12' }
    py313: { pythonVersion: '3.13' }
  maxParallel: 2

Scenario analysis question: The organization has only 1 Microsoft-hosted parallel job; after the team split the pipeline into 5 parallel jobs, the total duration went from 10 minutes to 16 minutes. Explain why and give recommendations.

Reference answer

The 5 jobs can only run serially using 1 slot, and each job repeats agent initialization, checkout and dependency restore (about 1–2 minutes each), so the total duration increases. Recommendations: with 1 slot, merge into a single job and use caching and a lean checkout; or add slots (buy hosted parallel jobs / use a self-hosted pool) before parallelizing; confirm the queuing with the pool consumption report.

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
How to REDUCE Build Time Using Caching in Azure Pipelines (Cache) — CoderDave
English · duration and upload date not verified · purpose: demo of the Cache task's key and restoreKeys
▶
Faster Azure DevOps Pipelines (#259) — Asp.Net Monsters
English · duration and upload date not verified · purpose: speed tips such as shallow clones

Official documentation

Video storyboard script

Shot 1 · 0:00–0:20
Visual: A horizontal 14-minute timeline bar, with the pytest segment longest and highlighted in red.
Narration: Measure before optimizing: find the longest segment.
Shot 2 · 0:20–0:50
Visual: The pip install segment shrinks from 3 minutes to 30 seconds, with “Cache restored” popping up beside it.
Narration: Cache the package manager's cache directory, use the lock file for the key, and use restoreKeys as a fallback.
Shot 3 · 0:50–1:20
Visual: One timeline bar splits into three short parallel bars; the slot counter in the upper right goes from 1 to 3.
Narration: Parallelism can shorten the critical path, but every job needs a slot.
Shot 4 · 1:20–1:45
Visual:--depth=1 --filter=blob:none appears in the checkout command line.
Narration: If a job does not need history, do not fetch history.
or score ≥ 70% on the quiz

Module 5 · Parallel jobs and cost optimization

30:00 – 37:00 · Parallel jobs are the “lanes” of Azure Pipelines: understand how they are billed, how to read usage, and how to scale on demand, so you neither queue nor waste
7 min$40 hosted · $15 self-hosted (verified 2026-11)★★★★☆
Learning objectives
  • State accurately the definition of parallel jobs, the two types, the free tier and how to obtain it, and paid prices and limits (verified 2026-11).
  • Understand that parallel jobs are shared at the organization level and cannot be divided by project, and which cases do not consume a slot.
  • Use the Pool consumption report and the Parallel jobs page to judge capacity.
  • Calculate the monthly cost of Managed DevOps Pools / VMSS (fixed parallel-job fee + variable Azure compute costs), and optimize with standby plans, stateless/stateful choices and sizing.
Prerequisites: M3, M4. Importance:★★★★☆

What: what a parallel job is

One parallel job = the capacity to run one pipeline job at the same time. Slots are configured at the organization level, and are shared by all pipelines in all projects in the organization; they cannot be allocated to a specific project or agent pool. There are two types: Microsoft-hosted (runs in the Azure Pipelines pool) and self-hosted (runs on any agent you register, including VMSS pools and Managed DevOps Pools).

Prices and free tier (Azure DevOps Services, USD, verified 2026-11-15)

Free tierPaidNotes
Microsoft-hostedPrivate projects: 1 parallel job,up to 1 hour per run, 1,800 minutes per month. Granted automatically after billing is set up for the organization (linking a valid Azure subscription)$40 / additional parallel job / month, unlimited minutes, up to 31 hours per jobThe first purchase of 1 only removes the time limit from the free one; to run 2 at once you need to buy 2. New organizations are capped at 25 hosted jobs; you can contact support to raise it
Self-hosted1 parallel job + each active Visual Studio Enterprise subscriber in the organization 1 each, no time limit$15 / additional parallel job / monthBilled by the number of jobs running at the same time, not by the number of registered agents; any number of agents can be registered
Two changes in 2026① Public projects are retired: no new public projects can be created; existing public projects convert to private in 2027, and the private-project free tier then applies (public projects previously had 10 free hosted parallel jobs). ② The way to get the Microsoft-hosted free tier changed to “linking an Azure subscription and setting up billing, after which it is granted automatically” (previously required filling out an application form). All prices and rules should be checked against the live content of the Azure DevOps pricing page and the “Configure and pay for parallel jobs” docs; the price of the newly added GitHub-hosted agents (billed per minute) is not yet shown on the pricing page, so this lesson does not estimate it.

Cases that do not consume a slot

  • Deployments waiting for approval or manual intervention (a slot is consumed only while actually executing on an agent).
  • Server jobs (pool: server, such as Delay, Invoke REST API, ManualValidation).
  • Classic releases deployed to a deployment group.
  • Self-hosted jobs on Azure DevOps Server (limited by number of agents; no parallel-job fee).

How: how to determine how many you need

  • Rule of thumb: 1 parallel job per 4–5 users; more is needed with multiple teams, many active branches, or many apps deploying at the same time.
  • Evidence: the pool's Analytics → Pool consumption report chart shows running jobs, queued jobs and the parallel limit over the last 30 days; if the queue backs up and the running count stays at the limit for a long time, slots are the bottleneck. Organization settings → Parallel jobs → View in-progress jobs See who is currently using them.
  • Purchase / adjust: requires Project Collection Administrators and billing to be set up; changes may take up to 30 minutes to take effect.

Cost model of elastic pools

VMSS pools and MDP have the same pricing: Monthly cost = fixed self-hosted parallel-job fee + Azure service fees (VM hours × unit price + disks + storage + outbound traffic; in MDP isolated networks, after default outbound access is retired, static public IPs / NAT are allocated and incur extra fees). VM hours ≈ number of jobs × average duration + standby hours (+ grace periods for stateful agents). Official example: 100 two-hour jobs per day, 5 days a week ≈ 4,000 hours per month, at $0.12 per VM-hour → about $480/month; 5 standby machines × 40 hours per week = 200 extra machine-hours per week. Difference: MDP cannot use VM reserved instances or Azure Hybrid Benefit, whereas VMSS can; MDP's Maximum agents and the parallel-job slots are two different things—with Maximum agents = 5 but only the 1 free slot, only 1 job can run at a time.

When: list of optimization measures

  1. First optimize duration (M4): halving the duration halves both hosted minutes and VM hours.
  2. Schedule standby for working hours, zero at night and on weekends; when unsure, use Automatic (MostCostEffective / MoreCostEffective).
  3. Stateless is the default; use stateful only when you really need to reuse caches, and set a reasonable grace period.
  4. Choose SKUs by bottleneck: memory-bound → memory-optimized, CPU-bound → more cores; use Instance Mix to improve availability.
  5. Hosted vs self-hosted: for long jobs (> 1 hour) and high volume, a $15 self-hosted slot plus your own compute is often cheaper; for a small number of short jobs, hosted is less hassle.
  6. Limit concurrent usage: matrix setting maxParallel, do not run the full set on non-critical branches, and cancel PR runs superseded by new commits (automatic cancellation in PR policy, or batch CI triggering batch: true).

Common misconceptions

  • “Self-hosted is billed per agent.” No: it is billed per concurrent job; registering any number of agents is free.
  • “A purchased parallel job can be dedicated to project A.” No: it cannot be divided.
  • “MDP costs nothing when idle.” No: standby agents and the grace periods of stateful agents are both billed.
  • “The free hosted tier is automatic.” No: billing must be set up (linking an Azure subscription).

Relationship between slots, agents and jobs

Organization-level slots (shared) Hosted: 1 free (1800′) + N×$40 Self-hosted: 1 + VS Enterprise subscribers + M×$15 cannot be divided by project / pool Jobs of projects A / B / C Running: uses a slotAwaiting approval: does not useserver job: does not useQueued: waiting for a slot or an agent Agents Azure Pipelines pool (hosted)Self-hosted / VMSS / MDP poolsOnline agents ≥ slots, so slots are not wastedSlots ≥ online agents, so agents are not wasted
Figure 5-1: concurrency limit = min(slots, available agents); when the two do not match, one side always wastes money

Composition of MDP monthly cost

Self-hosted parallel jobsFixed: (slots − free) × $15 + VM hours × unit priceJob duration + standby + grace period + Disks / storageOS disk, data disk + NetworkOutbound / NAT / static IP Cannot use VM reserved instances or Azure Hybrid Benefit (MDP)
Figure 5-2: Microsoft-hosted = slot fee only; elastic pool = slot fee + what you pay for the machines

Interactive: monthly cost estimator

Enter your team's workload and compare three options. Default unit prices: hosted $40, self-hosted $15 (pricing page 2026-11); for the VM unit price, enter the actual price of your chosen SKU in canadacentral from the Azure pricing page (the default $0.12/hour is illustrative).

1. Check slots and usage

# Organization-level resource usage (including parallel-job limits by type and current usage; for the response structure, follow the REST docs)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/_apis/distributedtask/resourceusage?parallelismTag=Private&poolIsHosted=true&includeRunningRequests=true&api-version=7.1-preview.1" |
  jq '{limit: .resourceLimit.totalCount, used: .usedCount, running: [.runningRequests[]?.definition.name]}'
# UI: Organization settings → Pipelines → Parallel jobs → View in-progress jobs
{ "limit": 1, "used": 1, "running": [ "myapp-ci" ] }

2. Export 30 days of queue data (capacity analysis)

# Runs completed in the last 30 days: queue time = startTime − queueTime
since=$(date -u -d '30 days ago' +%Y-%m-%dT%H:%M:%SZ)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/$PROJECT/_apis/build/builds?minTime=$since&statusFilter=completed&\$top=500&api-version=7.1" |
jq -r '.value[] | select(.startTime and .queueTime) |
  [.definition.name, .queueTime[0:16],
   (((.startTime|sub("\\.[0-9]+";"")|fromdateiso8601)-(.queueTime|sub("\\.[0-9]+";"")|fromdateiso8601))|tostring)] | @tsv' \
  > queue-30d.tsv
awk -F'\t' '{s+=$3; if($3>300)n++} END{printf "runs=%d avgQueue=%.0fs over5min=%d\n",NR,s/NR,n}' queue-30d.tsv
runs=486 avgQueue=212s over5min=97

When there are more than 500 entries, page using the continuationToken from M6. The Pool consumption report is more intuitive in the UI (pool → Analytics); it plots running, queued and the parallel limit on the same chart.

3. YAML patterns that reduce usage

trigger:
  batch: true                 # if more pushes arrive while a run is in progress, merge them into the next run instead of one run per push
  branches: { include: [ main ] }
strategy:
  matrix: { linux: {img: ubuntu-24.04}, windows: {img: windows-2025} }
  maxParallel: 1              # limit the slots a non-critical matrix uses at the same time
# use a server job (no slot used) while waiting for an external system
- job: WaitForChange
  pool: server
  timeoutInMinutes: 60
  steps:
  - task: ManualValidation@1
    inputs: { notifyUsers: 'release-team@contoso.com', instructions: 'Approve after CAB' }

4. MDP: adjust standby and maximum concurrency

az mdp pool update -n $POOL -g rg-ado-lab --maximum-concurrency 4 --agent-profile agent-profile.json
az mdp pool show -n $POOL -g rg-ado-lab --query "{max:maximumConcurrency, agent:agentProfile}"
# Cost: filter by resource group rg-ado-lab in Cost Management; MDP VM costs are attributed to the pool resource

Lab: write a capacity and cost recommendation for myapp-lab

Check current slots: open Organization settings → Parallel jobs, and record the hosted and self-hosted limits, whether billing is set up, and whether the free hosted tier is in effect (hosted is 0 when no subscription is linked).
View the pool consumption report: Organization settings → Agent pools → Azure Pipelines → Analytics; take a screenshot of the last 30 days' curve; also check lab-selfhosted.
Export queue data: run the script in section 2 of “Commands” and calculate the average queue time and the share of jobs queued for more than 5 minutes.
Compare options with the estimator: on the “Animation” tab, enter your job count and duration, and record the monthly cost of the three options (hosted / long-running self-hosted / MDP elastic).
Write recommendations: one page of Markdown: current bottleneck (slots / agents / duration) → recommended option → estimated monthly cost → risks (such as MDP not being able to use reserved instances, and long jobs exceeding 1 hour). This is the second part of the capstone “performance/cost optimization report.”

Case 1: bought 10 hosted slots, but the queue persists

A large project's nightly matrix build (60 combinations) filled all slots for 3 hours every night, so other projects' urgent fixes had to wait. Because slots cannot be divided by project, the platform team added maxParallel: 4, moved the nightly builds to a separate self-hosted / MDP pool (self-hosted slots purchased separately), and left the hosted slots for interactive CI.

Case 2: MDP bill doubled — the standby schedule “never reset to zero”

The team configured standby of 5 machines at 9:00 on weekdays but did not add the entry that sets it back to 0 at 17:00. The docs state clearly that standby counts are not reset automatically at the end of a day or week, and an empty daysData only means “no change that day.” As a result, 5 machines ran 24 hours a day all week. Fix: add "17:00:00": 0 for each weekday, and set a budget alert in Cost Management.

Case 3: free self-hosted slots from Visual Studio Enterprise subscribers

An organization had 12 VS Enterprise subscribers, so its free self-hosted slots = 1 + 12 = 13. The 10 self-hosted slots it had bought additionally ($150/month) were in fact not needed at all. Periodically verify that subscribers are organization members and that their subscriptions are active.

Common problems

No hosted parallelism has been purchased or granted.

Cause: The organization has no Microsoft-hosted free tier (billing not set up with a linked Azure subscription), or it has been used up. Fix: Link a subscription under Organization settings → Billing, or switch to a self-hosted pool (M3). Use the exact error text from the run page.

Job canceled after running for 1 hour: The job running on agent Hosted Agent ran longer than the maximum time of 1 hour.

The free hosted tier allows at most 1 hour per run. Split the job, optimize duration (M4), buy hosted slots (31 hours), or use self-hosted.

After the 1,800 free minutes for the month are used up, all hosted jobs queue

The free tier has a monthly cap; check the remaining minutes on the Parallel jobs page. In the short term, move to a self-hosted pool.

Slots did not increase immediately after purchase

It can take up to about 30 minutes to take effect; confirm that you bought the right type (hosted vs self-hosted).

MDP has Maximum agents = 5, but only 1 job runs at a time

The organization has only 1 self-hosted slot (the free one). Buy self-hosted slots as needed so that slots ≥ the expected concurrency.

Calculation questions

1. The organization needs 6 hosted jobs running at peak, but has only the 1 free one. How many should it buy, and how much per month?

Reference answer

The first purchase only removes the time limit from the free one and does not add to the count, so to run 6 at once you need to buy 6: 6 × $40 = $240/month (per the pricing page).

2. Self-hosted: a team has 3 VS Enterprise subscribers and expects 8 concurrent jobs. How many self-hosted slots need to be bought?

Reference answer

Free = 1 + 3 = 4, so buy 4: 4 × $15 = $60/month, plus the cost of the agent machines.

Scenario analysis question: The CFO asks, “Why not put all builds on self-hosted, since each slot is only $15?” Give a complete answer.

Reference answer

$15 is only the slot fee; you also pay for the machines (VMs, disks, network, image maintenance, and staff for patching and security operations). For a small team with short jobs, hosted is more hassle-free; for long jobs, high concurrency, internal network access or large machines, self-hosted / MDP is more economical. Calculate total cost of ownership separately based on 30 days of usage (number of jobs × duration, peak concurrency), and consider security isolation (fork PRs must not run on agents that can reach the internal network).

Instructional video

No verified video explaining the 2026 parallel-job prices and free-tier rules was found; information in earlier videos, such as “10 free slots for public projects” and “apply via a form for the free tier,” is out of date. Follow the official docs.

▶
Public Preview of Managed DevOps Pools (MDP) for Azure DevOps — Azure Power Lunch
English · recorded during the preview · purpose: understanding the MDP cost structure and standby (title and channel verified via oEmbed)

Official documentation

Video storyboard script

Shot 1 · 0:00–0:25
Visual: Pool schematic: one lane, five swimmers queued.
Narration: Parallel jobs are like swimming lanes: one lane holds only one swimmer at a time.
Shot 2 · 0:25–0:55
Visual: Price cards: hosted $40, self-hosted $15; next to the free tier, a “requires linked Azure subscription” label appears.
Narration: Hosted and self-hosted each have one free slot; the hosted free slot has a time limit, and billing must now be set up first.
Shot 3 · 0:55–1:25
Visual: Pool consumption report curves: the running line hugs the limit, and the queued line spikes in the morning.
Narration: Look at the 30-day consumption report to decide whether the bottleneck is slots or agents.
Shot 4 · 1:25–1:50
Visual: The MDP cost formula lights up item by item; the standby timeline drops to 0 at 17:00.
Narration: Money in elastic pools is spent on machine-hours; a standby schedule must specify the time points where it returns to zero.
or score ≥ 70% on the quiz

Module 6 · REST API, service hooks and extensions

37:00 – 45:00 · Pull (REST), push (service hooks), embed (extensions): connect Azure DevOps to your automation and notification systems
8 minapi-version · TSTU 200/5min · hooks★★★★☆
Learning objectives
  • Call REST correctly: URL structure, the required api-version, the lifecycle of preview versions, and Entra token authentication.
  • Paginate correctly: $top + continuation token (response header x-ms-continuationtoken), do not $skip page forcibly.
  • Understand global rate limits: the TSTU definition, 200 TSTU per 5-minute sliding window, 200 TSTU per pipeline independently, 429 and TF400733,Retry-After and X-RateLimit-* response headers.
  • Create service hook subscriptions (Webhook / Slack / Teams / Service Bus) and understand the permission and security implications.
  • Understand the structure of Marketplace extensions (vss-extension.json, contribution points, custom tasks task.json) and the packaging and publishing workflow (tfx-cli).
Prerequisites: M1 (timeline API). Importance:★★★★☆

1. REST API basics

  • URL:VERB https://dev.azure.com/{organization}/{project}/_apis/{area}/{resource}?api-version={version}. Some regions use a dedicated host (for example vssps.dev.azure.com for identity and graph,vsrm.dev.azure.com for classic release,feeds.dev.azure.com for Artifacts).
  • Version: every request must include api-version (a query parameter or Accept: application/json;api-version=7.1). The format is {major}.{minor}[-preview[.{rev}]]. After an API is officially released, its -preview version is deprecated,12 weeks later it may be retired, and preview requests are then rejected. The official getting-started docs' examples now use 7.2; the examples in this lesson uniformly use 7.1 (generally available); preview APIs carry a full revision number.
  • Authentication: Production apps should prefer Microsoft Entra ID (user delegation, or a service principal / managed identity with a resource ID 499b84ac-1321-427f-aa17-267ca6975798,Authorization: Bearer); PATs are used only for scripts and tests (Authorization: Basic base64(":"+PAT)). A service principal / managed identity must first be added to the organization as a user and assigned an access level and permissions.
  • Response: List responses are usually {"count": n, "value": [...]}; for PATCH work items, use application/json-patch+json; when the proxy only allows GET/POST, use X-HTTP-Method-Override.

2. Paging

List APIs use $top to limit the number of items per page. When more data remains, the response header returns x-ms-continuationtoken, which you pass as the next request's continuationToken query parameter, until the response no longer includes that header. Some APIs (such as Git commits and work item queries) have their own paging methods ($skip, and WIQL first fetches IDs and then fetches details in batches of 200); follow each API's reference page.

3. Rate limits and TSTU (official docs, 2026-11)

  • TSTU (Azure DevOps throughput unit) is an abstract load unit that mixes database (mainly Azure SQL DTU), compute and storage consumption; 1 TSTU ≈ the average load a typical user generates in 5 minutes. Peaks of normal activity are usually ≤ 10 TSTU per 5 minutes, and occasionally reach 100.
  • Global cap: 200 TSTU in any 5-minute sliding window (per user / identity); beyond that, requests are delayed (from a few milliseconds to 30 seconds); sustained high load is blocked, returning HTTP 429 and TF400733: The request has been canceled: Request was blocked due to exceeding usage of resource …. When significantly delayed, users receive email and web banners (identities without a mailbox, such as build service accounts, are notified via Project Collection Administrators).
  • Pipelines: Each pipeline is an independent entity,each pipeline gets 200 TSTU in a 5-minute sliding window; clones and log uploads by self-hosted agents also count. When rate-limited, a notice appears in the run log.
  • Response headers:Retry-After (seconds),X-RateLimit-Resource,X-RateLimit-Delay (number of seconds this request was delayed),X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset (Unix time),X-RateLimit-Cost (TSTU consumed by this request). Except for Delay, these headers appear before the delay starts, so clients should slow down proactively.
  • If a tool identity really needs a higher limit, you can temporarily assign it the Basic + Test Plans access level (only this level raises the limit; it is billed for the assigned duration). Under Organization settings → Usage you can view each identity's TSTU consumption.

4. Service hooks

Publishers (for example tfs: build/code/work item events; pipelines: YAML run / stage state changes, approval events) define events; a subscription listens for events and sends the messages to an action of the consumer. Available targets include Webhooks (any HTTPS endpoint, with optional basic auth and custom headers),Slack (managing subscriptions in Azure DevOps),Microsoft Teams (managing subscriptions through the Azure Pipelines / Azure Boards app in Teams), Azure Service Bus, Azure Storage queues, Jenkins, Datadog, Grafana, Trello, Zapier, etc. Creating a subscription requires Edit subscriptions and View subscriptions permissions (by default, only project administrators); owners can see the notification history of all subscriptions in the project. Consumer endpoints need to allow the Azure DevOps outbound IP ranges (inbound rules).

5. Marketplace extensions

  • Structure: Manifest vss-extension.json (publisher, id, version, targets Microsoft.VisualStudio.Services, scopes, contributions, files); contribution points can be hubs, menu actions, dashboard widgets, pipeline tasks (ms.vss-distributed-task.task), service endpoint types, etc.
  • Web extensions use azure-devops-extension-sdk (latest on npm is 5.0.0) and azure-devops-extension-api; Custom tasks are made of task.json (inputs, execution handler) + azure-pipelines-task-lib implementation; choose a supported Node version for the handler (new tasks use handlers for Node 20 and above; follow the task.json schema).
  • Packaging and publishing:npm i -g tfx-cli (latest 0.24.x) → tfx extension create --manifest-globs vss-extension.json → create a publisher in the Marketplace management portal → tfx extension publish --share-with <org> (private share) → an organization administrator installs it. Public publishing requires publisher verification.
  • Security: Extensions access data with the scopes granted by the installing user; organizations can restrict who can install or request extensions. Review the scopes requested by third-party extensions.

Common misconceptions

  • “Without api-version the latest is used by default.” No: it must be specified; omitting it fails or yields an unexpected version.
  • “Only 429 needs handling.” No: X-RateLimit-Remaining appears before a request is delayed; a delayed request still returns 200, just more slowly.
  • “Service hooks retry until success.” No: failed deliveries are recorded in the notification history, and subscriptions that keep failing may be disabled by the system (follow the docs for exact behavior); receivers must be idempotent and return 2xx quickly.
  • “You must write an extension to customize pipeline steps.” No: most scenarios are covered by YAML templates plus scripts; custom tasks suit capabilities that need to be distributed to multiple organizations.

Three integration methods: pull, push, embed

Azure DevOpsREST · events · extension hostTSTU metering (200/5 min) Scripts / apps (pull)Entra token · api-version · paging Service hooks (push)Webhook · Slack · Teams · Service Bus MCP Server / AI assistantNatural-language queries based on REST Extensions (embed)hub · widget · custom task
Figure 6-1: polling REST consumes TSTU and incurs delays; for scenarios that can be pushed by events, prefer service hooks

continuation token paging

GET …/builds?$top=100→ 100 items + token A GET …&continuationToken=A→ 100 items + token B GET …&continuationToken=B→ 37 items, no token End
Figure 6-2: the token is in the x-ms-continuationtoken response header; no such header means the last page

Interactive: paging + rate-limit simulator

Simulates a script that “exports all build records.” Each request consumes some TSTU (depending on page size); the 5-minute window cap is 200. Choose a client strategy and observe X-RateLimit-Remaining,X-RateLimit-Delay and 429.

TSTU used in the window0 / 200
Click “Start export.”

1. Bash client with paging and rate-limit handling

#!/usr/bin/env bash
# export-builds.sh: export all builds of a project (continuationToken paging + Retry-After)
set -euo pipefail
tok=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)
url="$ORG/$PROJECT/_apis/build/builds?\$top=500&queryOrder=finishTimeDescending&api-version=7.1"
ct=""; page=0; : > builds.jsonl
while :; do
  hdr=$(mktemp)
  curl -s -D "$hdr" -H "Authorization: Bearer $tok" "${url}${ct:+&continuationToken=$ct}" |
    jq -c '.value[] | {id, buildNumber, result, sourceBranch, queueTime, finishTime}' >> builds.jsonl
  page=$((page+1))
  ra=$(grep -i '^retry-after:' "$hdr" | tr -d '\r' | awk '{print $2}')
  rem=$(grep -i '^x-ratelimit-remaining:' "$hdr" | tr -d '\r' | awk '{print $2}')
  ct=$(grep -i '^x-ms-continuationtoken:' "$hdr" | tr -d '\r' | awk '{print $2}')
  echo "page=$page remaining=${rem:-n/a} retryAfter=${ra:-0}"
  [ -n "${ra:-}" ] && sleep "$ra"
  rm -f "$hdr"; [ -z "$ct" ] && break
done
wc -l builds.jsonl
page=1 remaining=n/a retryAfter=0
page=2 remaining=n/a retryAfter=0
page=3 remaining=n/a retryAfter=0
1137 builds.jsonl

Under normal usage you usually will not see the X-RateLimit-* header (it is returned only near the threshold), so the output n/a is normal.

2. Create a Webhook service hook (POST on build failure)

PROJECT_ID=$(az devops project show -p $PROJECT --query id -o tsv)
cat > hook.json <<EOF
{
  "publisherId": "tfs",
  "eventType": "build.complete",
  "resourceVersion": "1.0",
  "consumerId": "webHooks",
  "consumerActionId": "httpRequest",
  "publisherInputs": { "projectId": "$PROJECT_ID", "definitionName": "myapp-ci", "buildStatus": "Failed" },
  "consumerInputs": { "url": "https://hooks.example.com/ado-build", "httpHeaders": "X-Hook-Secret:REPLACE_ME" }
}
EOF
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
  "$ORG/_apis/hooks/subscriptions?api-version=7.1" -d @hook.json | jq '{id, status, eventType}'
# List and view delivery history
curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/_apis/hooks/subscriptions?api-version=7.1" |
  jq -r '.value[] | [.id, .eventType, .consumerId, .status] | @tsv'
{ "id": "6c0f…", "status": "enabled", "eventType": "build.complete" }

Run/stage events of YAML pipelines use the publisher pipelines (such as ms.vss-pipelines.run-state-changed-event,ms.vss-pipelines.stage-state-changed-event); input fields follow the Service Hooks event reference. You can first create a subscription in the UI and then GET its JSON as a template.

3. Local receiver (for testing)

# Use Python to start a minimal receiver that prints the event type and run result
python3 - <<'EOF'
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
class H(BaseHTTPRequestHandler):
    def do_POST(self):
        body = json.loads(self.rfile.read(int(self.headers['Content-Length'])))
        r = body.get('resource', {})
        print(body.get('eventType'), r.get('buildNumber'), r.get('result'), self.headers.get('X-Hook-Secret'))
        self.send_response(200); self.end_headers()
HTTPServer(('0.0.0.0', 8080), H).serve_forever()
EOF
# For public testing you can temporarily expose port 8080 with a tunneling tool; close it when done

4. Slack / Teams

Slack: install the Azure Pipelines / Azure Boards app in Slack, or in Project settings → Service hooks
       → Create subscription → Slack, and paste Slack's Incoming Webhook URL (managed in Azure DevOps).
Teams: install the Azure Pipelines app in Teams, and in a channel run @Azure Pipelines subscribe https://dev.azure.com/<org>/<project>/_build?definitionId=12
       (subscriptions are managed in Teams); or use a generic Webhook pointing to a Teams workflow / Power Automate endpoint.

5. Extension scaffolding

{
  "manifestVersion": 1,
  "id": "myapp-build-tools",
  "publisher": "contoso-lab",
  "version": "0.1.0",
  "name": "myapp build tools",
  "targets": [ { "id": "Microsoft.VisualStudio.Services" } ],
  "categories": [ "Azure Pipelines" ],
  "contributions": [ {
    "id": "healthz-check-task",
    "type": "ms.vss-distributed-task.task",
    "targets": [ "ms.vss-distributed-task.tasks" ],
    "properties": { "name": "tasks/healthz-check" }
  } ],
  "files": [ { "path": "tasks/healthz-check" } ]
}
npm i -g tfx-cli
tfx extension create --manifest-globs vss-extension.json --rev-version
tfx extension publish --vsix contoso-lab.myapp-build-tools-0.1.1.vsix --share-with contoso-lab --token "$MARKETPLACE_PAT"

Lab: failed build → Webhook notification (including the failing step)

Start the receiver: run the receiver from section 3 of “Commands” on the lab machine; if the lab machine has no public address, use a temporary request-inspection service (or a tunneling tool) to get an HTTPS URL. Do not send real secrets to third-party test sites.
Create the subscription: use the JSON from section 2 of “Commands” (replace the URL with yours), or create it under Project settings → Service hooks → Web Hooks; click Test to confirm a test event is received.
Trigger a failure: faults/inject.sh 7 (shallow clone); after the run fails, the receiver prints build.complete … failed.
Add the failing step: after the receiver gets the event, call the M1 faults/why.sh <buildId> (buildId is in resource.id), and print the failing task name and the last 15 log lines. This is the prototype for production case 2.
Export build history: run export-builds.sh, and count the result distribution: jq -r .result builds.jsonl | sort | uniq -c.
Cleanup: delete the subscription (DELETE $ORG/_apis/hooks/subscriptions/{id}?api-version=7.1); close the tunnel; faults/reset.sh.

Case 1: a dashboard script slowed down the entire organization

A team's dashboard service polled the build lists of all projects every 30 seconds ($top=1000), running as a single service principal. After a few hours, that identity's requests were delayed by 10–30 seconds, and eventually were blocked with 429; the PCA received email. Remediation: switch to service-hook pushes plus local caching; polling that is still needed was reduced to once every 5 minutes, using minTime incremental pulls, and X-RateLimit-Remaining reading the headers to back off proactively.

Case 2: one Webhook consumer caused all notifications to be lost

The receiver called multiple downstream systems synchronously while handling events, which often timed out, so Azure DevOps recorded the deliveries as failed. Remediation: the receiver only validates (a secret in a custom header) and writes the event to Azure Service Bus, then returns 200 immediately, with later processing done asynchronously; or use Service Bus directly as the service-hook consumer.

Case 3: a custom task's Node handler was outdated

An internal extension's task declared only an old Node handler; after agents were upgraded, deprecation warnings appeared, and the planned phase-out would make the task fail. Remediation: add a newer Node handler to task.json, upgrade azure-pipelines-task-lib,tfx extension create --rev-version republish, and run integration tests of the task in CI with the latest agent.

Common errors and fixes

HTTP 203 Non-Authoritative Information + login page HTML

Authentication failed and was redirected to the login page (a PAT was used with Bearer, the token expired, or the resource ID was wrong). PAT: -u :$PAT; Entra: resource 499b84ac-1321-427f-aa17-267ca6975798.

VS800071 / The requested REST API version of X is out of range for this server / preview version rejected

The api-version is not supported or the preview has been disabled. Switch to a released version or the current preview with a revision number (for example 7.1-preview.1). Use the actual returned error number.

HTTP 429 TF400733: The request has been canceled: Request was blocked due to exceeding usage of resource …

TSTU limit exceeded. Honor Retry-After, reduce the frequency and page size, and switch to event pushes; under Organization settings → Usage, check which identity consumes the most.

Service hook: subscription status becomes disabledBySystem / all entries in the notification history are failures

The endpoint keeps failing. Check the endpoint certificate, whether the firewall allows Azure DevOps outbound IPs, and whether responses time out; after fixing, re-enable the subscription in the UI.

Creating a service hook reports insufficient permissions

Requires the project's Edit subscriptions and View subscriptions (by default only project administrators); can be granted to specific groups via the security namespace.

tfx extension publish: Extension already exists with version 0.1.0

Bump the version on every publish: --rev-version or manually change the version in the manifest; the version in the task's task.json must also be bumped, otherwise agents keep using the cached old task.

Command-line exercise

1. Use curl to get the response headers of a build and print only the rate-limit-related headers.

Reference answer
curl -s -D - -o /dev/null -H "Authorization: Bearer $ADO_TOKEN" \
  "$ORG/$PROJECT/_apis/build/builds/$RUN?api-version=7.1" | grep -i -E '^(retry-after|x-ratelimit-)'

2. Write the key fields of a service hook subscription JSON: POST to a Webhook when code is pushed to the myapp repository.

Reference answer
{ "publisherId": "tfs", "eventType": "git.push", "resourceVersion": "1.0",
  "consumerId": "webHooks", "consumerActionId": "httpRequest",
  "publisherInputs": { "projectId": "<guid>", "repository": "<repo-guid>" },
  "consumerInputs": { "url": "https://hooks.example.com/push" } }

Scenario analysis question: The security team requires “an alert in Slack within 10 seconds every time someone modifies a service connection.” How would you implement this? REST polling or events?

Reference answer

Modifying a service connection is an audit event. Prefer audit streaming (Organization settings → Auditing → Streams, pushing to Azure Monitor Log Analytics / Splunk / Event Grid), set up alerts in the target system, and forward to Slack; polling the audit REST API has latency and consumes TSTU. Service hook event types do not cover all audit events, so audit streaming is more appropriate (follow the auditing docs for target types).

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
Retrieving Commits from Azure DevOps API — Dwain: Unfinished
English · duration and upload date not verified · uses a PAT in the demo; use an Entra token in production
▶
#azuredevopssprints 157 - Service hooks for YAML pipelines — Azure DevOps Sprints
English · recorded earlier · purpose: service hook events for YAML pipelines
▶
Azure DevOps Slack Integration | Integrate Slack and Azure DevOps | Azure Pipeline Slack Integration — Cloudamy
English · recorded earlier, UI may have changed · purpose: Slack integration steps

Official documentation

Video storyboard script

Shot 1 · 0:00–0:25
Visual: A URL is split into five parts (organization, project, region, resource, api-version), each highlighted in turn.
Narration: Every request must include api-version, and preview versions may be retired twelve weeks after the general release.
Shot 2 · 0:25–0:55
Visual: Three data cards flip out in turn; each card has a continuation token at the upper right, and the last one has none.
Narration: For paging, look at the continuation token in the response header; without it, it is the last page.
Shot 3 · 0:55–1:25
Visual: The TSTU progress bar climbs to 200, requests start slowing, and finally 429 and Retry-After appear.
Narration: 200 TSTU in five minutes; when near the threshold, the response headers warn you early to slow down.
Shot 4 · 1:25–1:50
Visual: A build failure event flies from Azure DevOps to three icons: Webhook, Slack, Teams.
Narration: If you can push events, don't poll; service hooks deliver changes directly to your system.
or score ≥ 70% on the quiz

Module 7 · Migration: Azure DevOps to GitHub

45:00 – 52:00 · Use GitHub Enterprise Importer for code and PRs; integrate Boards before migrating; Pipelines can be “kept and rewired” or converted with GitHub Actions Importer
7 mingh ado2gh v1.35.0 · gh actions-importer★★★★☆ Public projects convert to private in 2027
Learning objectives
  • List what GEI migrates from Azure DevOps (Git source and history, PRs with their user history / work item links / attachments, repository branch policies) and what it does not (user-scoped and cross-repository branch policies, LFS objects, pipelines, Boards, Wiki, etc.).
  • Know GEI's limits: repository 40 GiB (source, public preview), single file 400 MiB during migration, 2 GiB per commit/push, single file 100 MiB after migration, ref names 255 bytes, mannequins (placeholder users).
  • Use gh ado2gh 's inventory-report / generate-script / migrate-repo / rewire-pipeline / integrate-boards / lock-ado-repo / disable-ado-repo.
  • Design a transition plan for Boards (Azure Boards + GitHub integration,AB#123) and the two paths for Pipelines; use GitHub Actions Importer's audit → forecast → dry-run → migrate.
Prerequisites: GitHub course (Actions basics). Importance:★★★★☆

What: migration is not a “one-click move”

Azure DevOps is a combination of Boards + Repos + Pipelines + Test Plans + Artifacts; GitHub has corresponding but different products (Issues/Projects, repositories, Actions, Packages). The official tools cover only some of them, so migration is usually phased: first migrate repositories (GEI), keep Azure Boards and Azure Pipelines integrated with GitHub, then gradually convert pipelines to Actions.

GitHub Enterprise Importer (GEI) · Azure DevOps → GitHub Enterprise Cloud

MigratedNot migrated / handled separately
  • Git source and full commit history
  • Pull requests: including user history, work item links, attachments
  • Repository branch policies
  • User-scoped and cross-repository branch policies
  • Git LFS objects (repositories can use LFS, but objects must be pushed separately after migration)
  • Azure Pipelines (not migrated by GEI; converting to Actions requires another tool or contacting a GitHub account manager)
  • Azure Boards work items (can continue to be used with GitHub integration)
  • Wiki, Test Plans, Artifacts, service connections, variable groups, secrets (not listed by the official docs as migrated; treat as not migrated)

Limits: Repository source 40 GiB (public preview; check with git-sizer); single file ≤ 400 MiB during migration, GitHub's usual 100 MiB limit after migration; a single commit / single push ≤ 2 GiB (exceeding it reports pack exceeds maximum allowed size); ref names ≤ 255 bytes; organization rulesets may cause migration to fail; code search results may be incomplete for hours after migration; users mapped to mannequin must be “reclaimed” before their content is attributed correctly.

gh ado2gh commands (gh-gei v1.35.0, 2026-10-28)

CommandPurpose
inventory-reportInventory organizations / projects / repositories / pipelines, generate CSVs for planning batches
generate-script --allGenerate migrate.ps1: migrate repositories, and (with --all) create teams, rewire pipelines, configure Boards integration, etc.
migrate-repoMigrate a single repository (--ado-org --ado-team-project --ado-repo --github-org --github-repo, can --queue-only,--target-repo-visibility)
wait-for-migration / download-logsWait for the queued migration to finish / download the migration log
lock-ado-repo / disable-ado-repoLock the source repository before cutover to prevent new pushes / disable the source repository after cutover
rewire-pipelineChange an existing Azure Pipeline to fetch code from the GitHub repository (requires a GitHub service connection --service-connection-id; supports --dry-run)
integrate-boards / configure-autolinkConfigure the Azure Boards ↔ GitHub integration for the project / configure in the GitHub repository AB# auto-linking
share-service-connection / test-pipelinesShare the GitHub service connection with the project / test the re-wired pipeline
generate-mannequin-csv / reclaim-mannequinMap the placeholder users created by the migration to real GitHub accounts

Tokens: set ADO_PAT and GH_PAT environment variables (for scopes, see the GitHub docs “Managing access for GitHub Enterprise Importer”); the migrator needs the migrator role in the target organization (grant-migrator-role).

Boards: integrate first, decide later

Azure Boards can fully integrate with GitHub repositories: install Azure Boards the app on GitHub and connect the project; then write AB#123 in the commit message or PR title/description to link to a work item; write Fixes AB#123 to transition the state on merge; work items show GitHub commits, PRs and branches. Many teams keep “Boards in Azure DevOps, code in GitHub” for the long term. To move to GitHub Issues/Projects there is no official one-click tool; usually you export via REST (WIQL + work item API) and import with the GitHub API/CLI, accepting the loss of some fields and process.

Pipelines: two paths

  1. Keep Azure Pipelines and rewire: the pipeline triggers from and checks out the GitHub repository (using a GitHub App or an OAuth/PAT service connection); templates, approvals, environments and MDP pools are all kept. Lowest risk; suits teams with many classic releases, approvals and checks.
  2. Convert to GitHub Actions: use GitHub Actions Importer (gh extension install github/gh-actions-importer, runs in a Docker container, requires Azure DevOps API 5.0, i.e. Services or Server 2019+):
    • audit azure-devops: assess the convertibility of all pipelines (success / partial success / unsupported / failed);
    • forecast azure-devops: estimate Actions usage from history (last 7 days by default);
    • dry-run azure-devops pipeline|release --pipeline-id N: generate workflows locally only;
    • migrate azure-devops pipeline|release … --target-url: generate and submit a PR to the target repository.
    Partially supported: manual deployment, pool, services, strategy, triggers; not supported: pullRequest tags, schedules, trigger event types, pre/post-deployment gates and post-deployment approvals; Requires manual migration: secrets, service connections, unknown tasks, self-hosted agents, environments, pre-deployment approvals. Task groups from the classic editor can be converted as templates (results vary).

Special note on public projects

Azure DevOps public projects are retired: they cannot be created, and existing public projects convert to private starting in 2027. The official guide “Migrating from a public project to GitHub” exists; open-source projects should usually move to public GitHub repositories.

Common misconceptions

  • “GEI also moves the pipelines.” No; pipelines are either rewired or converted with Actions Importer.
  • “All LFS files are there after migration.” No: LFS objects are not migrated and must be git lfs push --all pushed separately.
  • “Actions Importer migrates secrets.” No: secrets, service connections, environments and approvals must all be rebuilt by hand (preferably switching to OIDC).
  • “You can delete the Azure DevOps project right after migrating.” No: lock first, observe for a while, keep a read-only backup, and disable only after confirming the Boards, pipeline and audit needs.

Phased migration path

Azure DevOps Repos (including PRs and policies) Pipelines (YAML/classic) Boards Wiki / Test Plans / Artifacts ① GEI: gh ado2gh migrate-repoLFS pushed separately · mannequin reclaim ② rewire-pipeline or Actions ImporterSecrets / connections / environments rebuilt by hand ③ integrate-boards (AB#)Long-term integration or separate export GitHub Enterprise Cloud Repositories + PRs + branch protection Azure Pipelines (pulling from GitHub) → Actions Azure Boards integration / Issues Wiki / Packages (manual)
Figure 7-1: only ① is GEI's responsibility; dashed lines indicate there is no official automation tool

Cutover window for one repository

Notification + freeze window lock-ado-repo migrate-repo LFS push · verification rewire / boards After the observation period, disable-ado-repo
Figure 7-2: lock first, then migrate, to avoid losing pushes during migration

Interactive: migration asset mapper

Click each Azure DevOps asset to see whether GEI migrates it, the recommended tool and target, and the parts that need manual handling.

Azure DevOps
GitHub
Select an asset.

1. Install and inventory

gh extension install github/gh-ado2gh
gh extension upgrade github/gh-ado2gh
export ADO_PAT=...  GH_PAT=...          # for scopes, see the GEI docs; revoke after migration
gh ado2gh inventory-report --ado-org contoso-lab
ls *.csv                                 # orgs.csv teams.csv repos.csv pipelines.csv (file names follow the actual output)

2. Migrate a single repository (cutover window)

gh ado2gh lock-ado-repo --ado-org contoso-lab --ado-team-project myapp-lab --ado-repo myapp
gh ado2gh migrate-repo --ado-org contoso-lab --ado-team-project myapp-lab --ado-repo myapp \
  --github-org contoso-gh --github-repo myapp --target-repo-visibility private
gh ado2gh download-logs --github-org contoso-gh --github-repo myapp
# push LFS objects separately (if using LFS)
git clone --mirror https://dev.azure.com/contoso-lab/myapp-lab/_git/myapp && cd myapp.git
git lfs fetch --all && git remote add gh https://github.com/contoso-gh/myapp.git && git lfs push --all gh
[INFO] Migrating Repo...
[INFO] A repository migration (ID: RM_kgDaACQ…) was successfully queued.
[INFO] Migration completed (ID: RM_kgDaACQ…)! State: SUCCEEDED

3. Batch: generate a script

gh ado2gh generate-script --ado-org contoso-lab --github-org contoso-gh --all \
  --download-migration-logs --output migrate.ps1
pwsh ./migrate.ps1        # review first: adjust with --target-repo / --target-repo-visibility

4. Keep Azure Pipelines: rewire + Boards integration

# A GitHub service connection (GitHub App method) must first be created in the project; get its ID
gh ado2gh rewire-pipeline --ado-org contoso-lab --ado-team-project myapp-lab \
  --ado-pipeline myapp-ci --github-org contoso-gh --github-repo myapp \
  --service-connection-id 0b1c… --dry-run
gh ado2gh integrate-boards --ado-org contoso-lab --ado-team-project myapp-lab \
  --github-org contoso-gh --github-repo myapp
gh ado2gh configure-autolink --github-org contoso-gh --github-repo myapp \
  --ado-org contoso-lab --ado-team-project myapp-lab
git commit -m "fix: healthz timeout Fixes AB#123"     # after merge, work item 123 transitions state

5. Convert to GitHub Actions (GitHub Actions Importer)

gh extension install github/gh-actions-importer
gh actions-importer update                      # pull the latest container image (requires Docker)
gh actions-importer configure                   # choose Azure DevOps, enter GitHub PAT (workflow scope), ADO PAT (read-only), organization and project
gh actions-importer audit azure-devops --output-dir tmp/audit
gh actions-importer forecast azure-devops --output-dir tmp/forecast
gh actions-importer dry-run azure-devops pipeline --pipeline-id 12 --output-dir tmp/dry-run
gh actions-importer migrate azure-devops pipeline --pipeline-id 12 \
  --target-url https://github.com/contoso-gh/myapp --output-dir tmp/migrate
Pipelines: 6
- Successful: 3 (50%)
- Partially successful: 2 (33%)
- Unsupported: 0
- Failed: 1 (17%)
Manual tasks: secrets (4), service connections (2), self-hosted runners (1)

Read-only scopes needed for the ADO PAT: Agent Pools, Build, Code, Release, Service Connections, Task Groups, Variable Groups; you can also use environment variables AZURE_DEVOPS_ACCESS_TOKEN,AZURE_DEVOPS_ORGANIZATION,AZURE_DEVOPS_PROJECT,AZURE_DEVOPS_INSTANCE_URL,GITHUB_ACCESS_TOKEN or .env.local files.

Lab: dry-run myapp-ci with Actions Importer

Only generates files locally and does not modify any repository; an actual GEI migration requires a GitHub Enterprise Cloud organization (this lab is optional).

Prepare: install Docker and the GitHub CLI on the lab machine; create a GitHub classic PAT (only workflow, 1 day) and an ADO PAT (the read-only scopes above, 1 day).
Configure and audit: run configure and audit, then open tmp/audit/audit_summary.md, and record myapp-ci's classification and the items that need manual handling.
dry-run: run a dry-run on myapp-ci and review the generated .github/workflows/*.yml: trigger.paths whether it is converted to on.push.paths; Cache@2 whether it is converted to actions/cache; UsePythonVersion@0 whether it is converted to actions/setup-python; fetchDepth: 0 whether it is converted to actions/checkout 's fetch-depth: 0.
Mark the manual items: compare the lab-selfhosted pool used in the M3 lab; in the conversion result the runs-on needs to be manually changed to a GitHub runner label; the service connection sc-azure-lab must be changed to azure/login + OIDC federated credentials (see the GitHub course).
(Optional) GEI: if you have a GHEC trial organization, migrate one test repository and verify PRs and branch policies; then run rewire-pipeline --dry-run on it.
Cleanup: delete tmp/; revoke both PATs.

Case 1: 800 repositories migrated in 6 batches

Used inventory-report to batch by project and most-recent commit time, migrating the “archived” repositories first to validate the process. The day before each batch, a freeze window was announced; generate-script produced the script, which was reviewed manually; then lock → migrate → automatic verification (branch count, tag count, latest commit SHA match) → rewire-pipeline. Mannequins were reclaimed centrally after each batch. Two repositories over 40 GiB had large historical files cleaned with git-filter-repo before migrating.

Case 2: Boards stayed in Azure DevOps for three years

The product team depended heavily on Boards' custom process, delivery plans and Analytics reports. The migration moved only code and CI: GitHub repositories were integrated through the Azure Boards app, and the PR template required AB#, and the branch policy checked the link. Result: engineers work in GitHub, PMs work in Boards, and neither disturbs the other.

Case 3: the “last 20%” after Actions Importer

The audit showed 70% of pipelines could be fully converted. The remainder was mainly the pre/post-deployment gates and approvals of classic releases, which in Actions became required reviewers on environments and custom deployment protection rules. All service connections were switched to OIDC federated credentials, which also eliminated all long-lived secrets.

Common errors and fixes

pack exceeds maximum allowed size

A single commit/push larger than 2 GiB exists. Split the history or clean up large files (git-filter-repo) before migrating; check the git-sizer report.

Migration succeeded but LFS files are pointer text

LFS objects are not migrated with GEI. Follow section 2 of “Commands” git lfs fetch --all + git lfs push --all.

PR authors show as strange placeholder users

These are mannequins. Use generate-mannequin-csv to export, fill in the corresponding GitHub accounts, and then reclaim-mannequin.

Migration fails because of an organization ruleset

The target organization's rulesets (such as requiring signed commits or commit message formats) reject historical commits that do not comply. During migration, temporarily add a bypass for the migrator, or enable the rulesets after migration.

Pipeline no longer triggers after rewire-pipeline

The GitHub service connection is not shared with the project, or the GitHub App is not installed on the target repository; in YAML, pr: applies to GitHub. Check the branch names and path filters. Use test-pipelines to verify.

Actions Importer: pipelines that are Unsupported / Failed

Review the unknown tasks and unsupported constructs (schedules, gates) in the audit output; write a custom transformer for unknown tasks, or rewrite them by hand.

Command-line exercise

1. Migrate myapp-lab/myapp to myapp-v2 in the GitHub organization contoso-gh, set to internal visibility, and only queue without waiting.

Reference answer
gh ado2gh migrate-repo --ado-org contoso-lab --ado-team-project myapp-lab --ado-repo myapp \
  --github-org contoso-gh --github-repo myapp-v2 --target-repo-visibility internal --queue-only

2. Convert the classic release pipeline with ID 34 locally only.

Reference answer
gh actions-importer dry-run azure-devops release --pipeline-id 34 --output-dir tmp/dry-run

Scenario analysis question: The company plans to migrate from Azure DevOps to GitHub within 3 months: 200 repositories (3 using LFS), 150 YAML pipelines, 40 classic releases (including approvals and gates), and Boards using a custom process. Provide a phased plan.

Reference answer

Phase 1 (weeks 1–2): inventory-report, git-sizer, Actions Importer audit/forecast; determine batches and risks (LFS, oversized repositories, gates). Phase 2 (weeks 3–8): per batch, lock → migrate-repo → LFS push → verification → rewire-pipeline (pipelines stay in Azure Pipelines for now) → integrate-boards; Boards kept. Phase 3 (weeks 6–12): YAML pipelines use Actions Importer migrate to generate PRs; secrets and service connections switched to OIDC; self-hosted agents switched to GitHub runners; classic release approvals changed to environment protection rules, and gates changed to custom deployment protection or in-job checks. Phase 4: after the observation period, disable-ado-repo; evaluate whether Boards is kept long-term.

Instructional videos (titles and channels verified via YouTube oEmbed, 2026-11-15)

▶
Azure DevOps migrations powered by GitHub Actions Importer — Ethan Dennis
English · linked from the official github/gh-actions-importer README · purpose: audit / dry-run / migrate demo
▶
Migrating Repositories from Azure DevOps to GitHub Using GitHub CLI ADO2GH Extension — MadeForCloud
English · duration and upload date not verified · purpose: ado2gh migration steps
▶
Migrating Azure DevOps repositories into GitHub Enterprise Cloud — RamanaReddy V
English · duration and upload date not verified
▶
Using Azure Boards with GitHub | DevOps Lab — DevOps on Azure
English · recorded earlier · purpose: Boards and GitHub integration (AB# links)
▶
Introducing Azure Boards to the GitHub Marketplace | DevOps Lab — DevOps on Azure
English · recorded earlier · purpose: Azure Boards app

Official documentation

Video storyboard script

Shot 1 · 0:00–0:25
Visual: Five Azure DevOps product icons line up in a column; only Repos, with a green arrow, flies to GitHub.
Narration: GEI migrates code, pull requests and repository branch policies; it does not migrate pipelines, Boards or LFS objects.
Shot 2 · 0:25–0:55
Visual: The terminal runs lock-ado-repo, migrate-repo and git lfs push in turn.
Narration: Lock the source repository first, then migrate; LFS objects must be pushed separately.
Shot 3 · 0:55–1:25
Visual: The Azure Pipelines icon's connection is rewired from Azure Repos to GitHub; an AB#123 link appears in the PR beside it.
Narration: Pipelines can be kept at first and rewired to GitHub; Boards integrates with GitHub using AB numbers.
Shot 4 · 1:25–1:50
Visual: Audit report pie chart: success, partial success, failure; the manual-items list flashes: secrets, service connections, environments.
Narration: Actions Importer audits first and then does a trial run; the last 20% of the work is manual rebuilding of secrets, connections and approvals.
or score ≥ 70% on the quiz

Module 8 · Comprehensive fault mystery box

52:00 – 60:00 · 8 randomly injected faults: warm up in the browser simulator first, then open the mystery box in the real myapp-lab project
8 min8 faults · interactive troubleshooting tree★★★★★ Tests the first 7 modules
Learning objectives
  • Facing an unknown fault, use the seven-stage locating method to determine the stage within 2 minutes and provide evidence and a fix.
  • Use this lesson's toolchain fluently: run summary, Error analysis, system.debug,faults/why.sh, preview API, Parallel jobs page, agent capabilities.
  • Write a five-part incident record: symptom → evidence → root cause → fix → prevention.
Prerequisites: M1–M7. Importance:★★★★★

The 8 faults in the mystery box

#FaultStageFirst symptomKey evidenceFix
F1Path filter mismatch① TriggerNo run after pushthe YAML of that branch's paths.includeCorrect paths
F2YAML unknown key② CompileRun fails immediately, with Line/ColUnexpected value 'step'Change back to steps
F3Template file does not exist② CompileThe pipeline is not validTemplate pathCreate the template / remove the reference
F4Service connection does not exist or is not authorized③ AuthorizeThe pipeline is not valid … could not be found / needs permissionservice connection name, Pipeline permissionsCorrect the name, Permit
F5Demands cannot be satisfied④ QueueJob stays QueuedAgent capabilitiesRemove the demand or add the capability to the agent
F6Image retired⑤ AgentJob cannot be allocated / initializedvmImage: ubuntu-20.04Change to ubuntu-24.04
F7Shallow clone missing tags⑥checkoutVersion step failsNo names found, in checkout --depth=1fetchDepth: 0 + fetchTags: true
F8Disk full⑦ Task / ⑤ AgentNo space left on device or agent lost contactthe verbose Agent environment resourcesClean up / switch to an agent with a larger disk

Mystery box rules

  1. Do not look at .fault-answer, and do not look at git diff (in real incidents you usually cannot see “what changed”).
  2. First write down your judgment of the stage and the reason, then look at the evidence; change only one thing at a time and verify.
  3. Timing: 2 minutes per question in the simulator; 10 minutes per fault in the real project.
  4. After finishing, write the five-part record: symptom → evidence (screenshot / log line) → root cause → fix → prevention (templates, policies, monitoring).

Summary of preventive measures

  • F1/F7: put trigger and checkout into the required extends template, maintained centrally by the platform (Lesson 5).
  • F2/F3: run compile checks with the preview API in PR validation; tag the template repository with versions and use ref to pin them.
  • F4: authorize service connections only to designated pipelines; alert on disable events; run smoke tests regularly.
  • F5: put pools and demands in the template; containerize agent images (container / MDP images) to keep capabilities consistent.
  • F6: explicitly pin vmImage; subscribe to image deprecation announcements, and use git grep for periodic scans (M2 commands, section 6).
  • F8: run large jobs on MDP with data disks; clean up Docker during builds; sample resource monitoring with verbose.

Mystery box troubleshooting flow

Is there a new run? No → F1 triggerpaths / branches / overrides Are there job logs? No → read the error at the topLine/Col = F2 · template = F3 · resource = F4 Stuck in QueuedF5 demands Look at the failing stepInitialize = F6 · Version/checkout = F7 · disk / lost contact = F8 Change one thing → rerun → write the five-part record
Figure 8-1: two questions (is there a run, are there job logs) are enough to split the 8 faults into 4 groups

In-browser fault mystery box simulator

Click “Open mystery box” to inject a random fault. Read the symptoms and logs, first choose the stage and root cause, then choose the fix. 120 seconds per question; scores are saved in this browser.

When ready, click “Open mystery box.”

Mystery box toolkit

# open the mystery box (real project)
faults/inject.sh random
# 1) Is there a new run?
az pipelines runs list --branch "$(git branch --show-current)" --top 3 -o table
# 2) If there is a run: status, result and failing step
faults/why.sh <runId>
# 3) No job logs: compile pre-check (no run)
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
  "$ORG/$PROJECT/_apis/pipelines/$PID/preview?api-version=7.1" \
  -d "{\"previewRun\":true,\"resources\":{\"repositories\":{\"self\":{\"refName\":\"refs/heads/$(git branch --show-current)\"}}}}" | jq -r '.finalYaml // .message' | head
# 4) Queued: agents and capabilities
az pipelines agent list --pool-id <id> --include-capabilities --query "[].{n:name,s:status,cap:userCapabilities}" -o json
# 5) Reveal the answer (look after finishing)
base64 -d .fault-answer
# 6) Reset
faults/reset.sh

Five-part incident record template

## Incident: fault/N  myapp-ci  2026-11-15 14:05
- Symptom: no run 10 minutes after push / run #20261115.9 failed at …
- Evidence: (log lines, screenshots, command output)
- Root cause:
- Fix: (which single place was changed; verify the run number)
- Prevention: (templates / policies / monitoring / docs)

Lab: real-project mystery box challenge (3 rounds)

Prepare: confirm main is green,lab-selfhosted the pool exists (F5 requires it), and the service connection sc-azure-lab is authorized correctly. Start a timer.
Round 1: faults/inject.sh random. Without looking at the answer, use the toolkit in “Commands” to locate and fix it (edit and push directly on the fault branch), write the five-part record, then reveal the answer to check.
Round 2: faults/reset.sh after; open another one (it may repeat; if it does, open another). This round requires at least one “evidence” command output.
Round 3 (double fault): manually execute in sequence faults/inject.sh 7 and then, on the same branch, add F2 (sed -i 's/^steps:/step:/' azure-pipelines.yml and push). Experience that “you only see the checkout error after fixing the compile error”—this is why the seven-stage method checks in order.
The manual parts of F4 / F5: after injecting F4, change the service connection name back to sc-azure-lab, then remove the myapp-ci authorization from its Security, observe and Permit; after injecting F5, add a user capability on the M3 container agent gpu=true (pool → agent → Capabilities → Add), observe the queued job being picked up, then delete the capability.
Cleanup: faults/reset.sh; restore all authorizations and capabilities; the three incident records serve as input to the capstone lab.

Case 1: a “compound fault” on release day

The night before the release, the platform team upgraded the shared template repository (adding a lint template reference), and at the same time the operations team changed the hosted image from ubuntu-22.04 to latest. The next day: some pipelines reported The pipeline is not valid (the template ref was not pinned, an F3-type issue), while others failed because a tool was missing after the switch to latest (an F6-type issue). On-call fixed the compile-type issues first, following the seven stages, then handled the agent/image issues, and recovered in 2 hours. Postmortem conclusions: pin template versions by ref; explicitly pin vmImage and validate on non-production branches first.

Case 2: “queued” was actually an authorization issue

A newly created pipeline showed Queued for an hour, and the team was about to buy parallel jobs. In fact, the top of the run page said “needs permission to access a resource,” because the new pipeline was using the MDP pool for the first time; after clicking Permit, it ran immediately. Lesson: check the top of the run summary first, then the job panel.

Case 3: mystery box drills in the on-call handbook

A team adapted this module's inject.sh into a monthly on-call drill: random injection, timing, and review, and aggregated each five-part record into an internal troubleshooting knowledge base. After six months, the average time to repair dropped from 47 minutes to 15 minutes.

Interactive troubleshooting tree

Start from a symptom and answer questions step by step to get a diagnosis, commands and fix suggestions. Covers the 8 mystery box faults in this lesson, plus common problems related to agents, caching, REST and migration.

Command-line exercise

1. Write a command that lists the number, status and result of the last 3 runs on the current branch.

Reference answer
az pipelines runs list --branch "$(git branch --show-current)" --top 3 \
  --query "[].{n:buildNumber,s:status,r:result}" -o table

2. Temporarily enable verbose logging for one step in YAML without affecting the whole pipeline (hint: step-level variables cannot override system.debug; so what should you do?)

Reference answer

system.debug It applies to the whole run; if you only want details for one step, add output in that step's script yourself (such as set -x, or the tool's --verbose), or rerun once with Enable system diagnostics. Note that set -x and ##vso used together with the command causes the variable value to gain extra single quotes (M2 troubleshooting and official docs).

Scenario analysis question: On the fault branch, you see a run fail at the Version step; but after fixing fetchDepth, the run fails at the Test step with “No space left on device.” What does this mean? How do you proceed?

Reference answer

It means there are multiple faults, and the earlier one masked the later one (exposed in stage order). Continue with the seven-stage method: the Test step belongs to the ⑦ Task stage; turn on verbose to check Agent environment resources the available disk space, locate the command that filled the disk (fallocate), and delete it or switch to an agent with a larger disk; after each fix, rerun to verify, and record the two incident records separately.

Instructional video

This module is a comprehensive exercise; no verified video matching this mystery box was found; you can review the videos listed in M1–M7. Below is a verified overview video, suitable for review before the troubleshooting drill.

▶
Azure DevOps: Zero to Hero Tutorial — DevOps on Azure
English · title and channel verified via oEmbed (2026-11-15)

Official documentation

Video storyboard script

Shot 1 · 0:00–0:20
Visual: A gift box opens, popping out a fault/? branch name and a red run.
Narration: The mystery box holds eight faults; you can only see the symptoms.
Shot 2 · 0:20–0:50
Visual: Two questions zoom in one after another: is there a new run? are there job logs? The eight fault cards are sorted into four groups.
Narration: Two questions can narrow the scope to one or two possibilities.
Shot 3 · 0:50–1:20
Visual: The terminal runs why.sh, outputting the failing task name and the last fifteen log lines; No names found is highlighted.
Narration: Evidence before conclusions: use a script to get the original text of the failing step.
Shot 4 · 1:20–1:45
Visual: Only one line of fetchDepth is changed; the run turns green; a five-part incident record is generated on the right side of the screen.
Narration: Change only one thing, rerun to verify, and write down the record and preventive measures.
or score ≥ 70% on the quiz

Command cheat sheet

All key commands, settings and numbers from Lesson 7, on one page

Diagnostic logs

PurposeCommand / setting
Verbose logs for all runsvariables: { system.debug: true } (automatically turned on Agent.Diagnostic)
Verbose log for a single runRun pipeline → Enable system diagnostics
Resource utilizationSearch in verbose logs Agent environment resources
Download all logsRun page … → Download logs; REST _apis/build/builds/{id}/logs?$format=zip
Failing step_apis/build/builds/{id}/timeline → records[result=failed] → logs/{log.id}
Agent logs_diag/Agent_*.log (listener),_diag/Worker_*.log (job); ./run.sh --diagnostics; VSTS_AGENT_HTTPTRACE=true
Upload custom logsecho "##vso[task.uploadfile]/path/file"

Common failures

SymptomCheck first
No runtrigger/paths in that branch's YAML, Triggers overrides, Disable implied YAML CI trigger,[skip ci], Paused/Disabled, Azure Repos PR uses branch policy
Line/Col errorValidate; POST _apis/pipelines/{id}/preview (previewRun: true)
The pipeline is not validtemplate path/parameters; resource “does not exist, is disabled or is not authorized” (service connections unused for 100 days are disabled)
needs permissionView → Permit; resource Security → Pipeline permissions; use Open access with caution
Stuck in QueuedParallel jobs → View in-progress jobs; demands vs capabilities (restart the agent after installing software)
Version / diff errorsfetchDepth: 0,fetchTags: true
image retirementWindows 2019 retired (2025-12-31); Ubuntu 20.04 retired; Ubuntu 22.04 scheduled for removal 2027-04-17; explicitly pin ubuntu-24.04

Agents and elastic pools

./config.sh --unattended --url $ORG --auth pat|SP --token … --pool P --agent A --replace --acceptTeeEula
sudo ./svc.sh install <user> | start | status | stop | uninstall ;  ./config.sh remove
docker run -e AZP_URL -e AZP_TOKEN|AZP_CLIENTID/AZP_CLIENTSECRET/AZP_TENANTID -e AZP_POOL -e AZP_AGENT_NAME azp-agent:linux [--once]
az vmss create … --disable-overprovision --upgrade-policy-mode manual --orchestration-mode Uniform --load-balancer ""
az provider register -n Microsoft.DevOpsInfrastructure ; az provider register -n Microsoft.DevCenter
az mdp pool create -n P -g RG -l REGION --devcenter-project-id ID --maximum-concurrency N \
  --agent-profile a.json --fabric-profile f.json --organization-profile o.json
FigureValue
Hosted agent spec2 cores / 7 GB / 14 GB SSD (≥10 GB available); Linux step cgroup 6 GB physical memory
VMSS poolSampled every 5 minutes; scales by a percentage of the maximum, about 20 minutes per step; scales down after 30 minutes idle (configurable)
MDPIncrements by 1; without standby, on-demand power-on takes tens of seconds to 15 minutes; stateful up to 7 days; jobs up to 2 days; automatic standby based on 3 weeks of data (10/25/50/75/90 percentiles)
Agent versionv5.282.0 (2026-10-30, .NET 10); SP registration requires ≥ 3.227.1; fetchFilter/sparse requires ≥ 3.253.0 / 4.253.0

Performance

- task: Cache@2
  inputs: { key: 'pip | "$(Agent.OS)" | requirements.txt', restoreKeys: 'pip | "$(Agent.OS)"', path: $(PIP_CACHE_DIR), cacheHitVar: HIT }
strategy: { parallel: 4 }          # $(System.JobPositionInPhase) / $(System.TotalJobsInPhase)
strategy: { matrix: {...}, maxParallel: 2 }
- checkout: self
  fetchDepth: 1
  fetchFilter: blob:none
  sparseCheckoutDirectories: app
- checkout: none                   # deployment jobs

Cache: isolated by project/pipeline/branch; immutable; expires after 7 days without access; cannot be cleared manually (change the key); PRs write only to refs/pull/N/merge.

Cost (2026-11, USD)

ItemValue
Hosted parallel jobs1 free (granted after linking an Azure subscription; ≤1 hour per run, 1,800 minutes per month); $40 per job per month (≤31 hours per job); new organization cap 25
Self-hosted parallel jobs1 free + 1 per VS Enterprise subscriber; $15 per job per month
Do not use a slotWaiting for approval, server jobs, deployment groups
MDP / VMSSSelf-hosted slots + Azure compute/storage/network; MDP cannot use reserved instances or Hybrid Benefit

REST and service hooks

TOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)
curl -D - -H "Authorization: Bearer $TOKEN" "$ORG/$PROJECT/_apis/build/builds?\$top=500&api-version=7.1"
#   x-ms-continuationtoken → &continuationToken=…   |   Retry-After · X-RateLimit-Limit/Remaining/Reset/Delay/Cost/Resource
#   200 TSTU / 5-minute sliding window (per identity; each pipeline also 200); 429 TF400733
POST $ORG/_apis/hooks/subscriptions?api-version=7.1   # publisherId tfs|pipelines, consumerId webHooks, consumerActionId httpRequest
tfx extension create --manifest-globs vss-extension.json --rev-version ; tfx extension publish --share-with ORG

Migration

gh extension install github/gh-ado2gh          # ADO_PAT / GH_PAT
gh ado2gh inventory-report --ado-org O
gh ado2gh generate-script --ado-org O --github-org G --all --output migrate.ps1
gh ado2gh lock-ado-repo | migrate-repo | download-logs | rewire-pipeline | integrate-boards | configure-autolink | disable-ado-repo
gh extension install github/gh-actions-importer
gh actions-importer configure | audit azure-devops | forecast azure-devops | dry-run azure-devops pipeline|release --pipeline-id N | migrate … --target-url URL

GEI migrates: source + history, PRs (user history / work item links / attachments), repository branch policies; does not migrate: user-level / cross-repository policies, LFS objects, pipelines, Boards. Limits: repository 40 GiB (preview), files during migration 400 MiB, commit/push 2 GiB.

Capstone lab + final quiz

Fault mystery box challenge + performance/cost optimization report + optional: deploy a self-hosted container agent
About 90–120 minutesCan be completed at zero cost (excluding the optional MDP)
Scenario

You have just taken over the platform work for the myapp-lab project. The team complains about three things: ① pipelines “fail for no clear reason”; ② CI is too slow (over 10 minutes each time) and queues in the morning; ③ finance wants to know how much is spent on Pipelines each month and whether it can be reduced. Within one week you need to deliver: a repeatable troubleshooting capability (passing the mystery box challenge), a performance and cost optimization report, and (optional) a self-hosted container agent that can run on the internal network.

Baseline and tools: complete the Module 0 baseline pipeline and faults/ scripts, and the M1 faults/why.sh, and confirm main is green.
Mystery box challenge: use faults/inject.sh random to complete at least 4 rounds (covering at least 3 different stages), fixing each within 10 minutes and writing a five-part record; browser simulator accuracy ≥ 75%.
Performance measurement: per the M4 lab, record the baseline duration of each step; then add caching, a lean checkout, parallel slicing (if slots allow) and Docker buildx caching in turn, recording the benefit of each step.
for r in $(az pipelines runs list --pipeline-ids $PID --top 6 --query "[].id" -o tsv); do
  echo "== run $r"; curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJECT/_apis/build/builds/$r/timeline?api-version=7.1" |
  jq -r '[.records[]|select(.type=="Job" and .startTime and .finishTime)|((.finishTime|sub("\\.[0-9]+";"")|fromdateiso8601)-(.startTime|sub("\\.[0-9]+";"")|fromdateiso8601))]|max'; done
Capacity analysis: per M5, export 30 days of queue data, capture the Pool consumption report, and calculate the average queue time and the share >5 minutes.
Cost estimate: use the M5 estimator to compare the three options (hosted / long-running self-hosted / MDP elastic), and write down the assumptions (job count, duration, peak, source of the VM unit price).
(Optional) self-hosted container agent: per the M3 lab, deploy 2 container agents to lab-selfhosted, run one branch's CI on them; then try once more --once. Security requirements: short-lived PAT or service principal, do not mount docker.sock, and authorize the agents only to myapp-ci.
Notification: per the M6 lab, create a “build failed” Webhook subscription for myapp-ci; the receiver prints the failing steps.
Deliverable report: a Markdown document, “myapp-lab Pipeline Performance and Cost Optimization Report”: current state (duration, queuing, slots) → optimization items and measured benefits → recommended agent plan and monthly cost → risks and next steps (such as the GitHub migration assessment: summary of the Actions Importer audit results).
Acceptance checklist

Open-ended self-check

1. Why segment troubleshooting first instead of reading logs directly?

When the first three stages (trigger, compile, authorize) fail, there are no job logs at all; evidence for the fourth stage (queue) is in the job panel and the Parallel jobs page. Segmenting first lets you pick the right evidence source directly and avoids wasting time on scripts.

2. What problem does each of system.debug, Agent.Diagnostic and HTTP trace solve?

system.debug: debug output and resource utilization for all tasks; Agent.Diagnostic (turned on automatically with system.debug): network/environment diagnostic files for self-hosted agents; HTTP trace: HTTP headers between the agent and the service, used for proxy/certificate/firewall problems; may contain sensitive information.

3. When to choose MDP, when to choose a VMSS pool, and when to stick with Microsoft-hosted?

Hosted: specs are sufficient, no internal-network needs, low concurrency, and minimal operations. MDP: needs larger specs / internal network / custom images, and you want managed scaling and standby plans, shared across multiple organizations. VMSS: needs reserved instances / Hybrid Benefit, VMSS extension scripts, availability zones or other capabilities MDP does not yet support, or already has mature investment.

4. Why is the cache designed to be immutable? What does this require of key design?

Immutability guarantees that the same key always has the same content, and avoids concurrent write conflicts and the spread of cache poisoning; so the key must include components that uniquely describe the content (lock-file hash, OS), and use restoreKeys to handle partial hits; to “clear,” you can only change the key prefix.

5. A tool account is rate-limited (TF400733); how do you locate and resolve it?

Under Organization settings → Usage, view TSTU consumption by identity and the delayed requests; check whether the script polls too often, the pages are too large, or concurrency is too high; switch to service-hook pushes, incremental queries, and honor Retry-After and X-RateLimit-Remaining; if necessary, temporarily assign the identity Basic + Test Plans to raise the limit.

6. When migrating from Azure DevOps to GitHub, why is it often “migrate the repositories first, keep the pipelines”?

GEI only migrates repositories and PRs; pipelines involve many platform resources such as service connections, approvals, environments and agent pools, so direct conversion is high-risk. rewire-pipeline lets pipelines fetch code from GitHub first, so the business is not interrupted; afterwards, Actions Importer converts them in batches, and secrets are switched to OIDC along the way.

Sources and version notes

Verification basis for all technical facts in this lesson (verified 2026-11-15)
TopicVerification conclusionsSource (verification date)
Diagnostic logsEnable system diagnostics / system.debug=true; verbose log injection Agent environment resources; Agent.Diagnostic turned on automatically with System.Debug (agent ≥ 2.200.0); Download logs; worker/agent logs; environment.txt, capabilities.txt; VSTS_AGENT_HTTPTRACE; ##vso[task.uploadfile]Review logs(2026-11-15)
Common troubleshooting problemsError analysis page; “needs permission … Permit / Open access”; free hosted 1 hour, paid 31 hours; cross-project checkout TF401019; service connections unused for 100 days automatically disabled; “We stopped hearing from agent”; Azure DevOps MCP ServerTroubleshoot pipeline runs(2026-11-15)
Parallel jobsHosted: 1 free (granted after linking an Azure subscription and setting up billing; 1 hour per run, 1,800 minutes per month); paid 31 hours per job; the first purchase only removes the time limit; new organization cap 25; self-hosted: 1 free + VS Enterprise subscribers; cannot be divided by project; waiting for approval and server jobs do not use a slot; 1 per 4–5 users; takes effect within up to 30 minutes; public projects retired, converting to private in 2027Configure and pay for parallel jobs(2026-11-15)
PricesHosted $40/job/month; self-hosted $15/job/month; Basic first 5 free, then $6; GHAzDO Code Security $30, Secret Protection $19 / committer / month; per-minute prices for GitHub-hosted agents are not shown on the pricing pageAzure DevOps pricing(2026-11-15)
Microsoft-hosted agentsubuntu-latest = 24.04; ubuntu-26.04 GA (2026-09-29); 22.04 deprecated, scheduled for removal 2027-04-17; 20.04 retired; windows-latest = 2025 (will switch to the VS 2026 version); windows-2025-vs2026 GA (2026-09-29); Windows 2019 retired 2025-12-31; macOS-latest = 15, macOS 14 deprecated since 2026-07-06; 2 cores / 7 GB / 14 GB SSD, Linux cgroup 6 GBMicrosoft-hosted agents(2026-11-15; page date 2026-11-09)
Self-hosted agentsThe docs body describes 4.x (.NET 8); GitHub's latest is v5.282.0 (2026-10-30, .NET 10 patch), with 5.x released since v5.270.0 (2026-02-27); unattended parameters; svc.sh; run.sh --once,--diagnostics; auto-upgrade and Update all agents; SP registration ≥ 3.227.1; firewall domains include download.agent.dev.azure.comLinux agent · SP registration · agent releases(2026-11-15)
Container agentsUbuntu 24.04 Dockerfile (libicu74); start.sh supports PAT or SP (AZP_CLIENTID/SECRET/TENANTID), with the token written to a 600 file,VSO_AGENT_IGNORE; remove in trap (10 retries); --once; docker.sock risk; no DinD on AKS 1.19+Run a self-hosted agent in Docker(page date 2026-08-14)
VMSS agent poolMust turn off overprovision, use manual upgrade policy, turn off autoscale and instance protection; Uniform; do not pre-install agents; 5-minute sampling, scale by percentage, about 20 minutes per step, scale down after 30 minutes idle; only SP-secret ARM connections are supported; _AzureDevOpsElasticPool tags; the official docs recommend considering MDPScale set agents(2026-11-15)
Managed DevOps Poolsevolution of VMSS pools; VMs in Microsoft subscription; RP Microsoft.DevOpsInfrastructure + Microsoft.DevCenter; dev center project; DevOps Infrastructure Contributor; by default some SKU families have a 5-core quota, default SKU Standard D2ads v5; project-level pool creation since 2025-10; stateless by default, stateful up to 7 days; standby Manual/Automatic (3 weeks of data, 5 percentile tiers); wait up to 15 minutes without standby; jobs up to 2 days; increments by 1, multi-image, multi-organization; cannot use reserved instances/Hybrid Benefit; 2026-09 Instance Mix (≤5 SKUs), startup scripts; roadmap Spot (TBD); az mdp pool create; ARM apiVersion 2025-09-20Overview · Prerequisites · Scaling · Pricing · Timeline · CLI quickstart(2026-11-15)
Pipeline cachingCache@2 key/path/restoreKeys/cacheHitVar (true/inexact/false); scope table (CI, PR, fork PR); immutable; expires after 7 days without access; no enforced size limit; cannot be cleared; self-hosted needs GNU tar; classic release not supportedPipeline caching(2026-11-15)
REST APIURL structure; api-version required; examples use 7.2; preview is deprecated after release and can be retired 12 weeks later; prefer Entra tokensCall REST API · Versioning(2026-11-15)
Rate limitsTSTU definition; global 200 TSTU / 5-minute sliding window; delayed up to 30 seconds; 429 TF400733; 200 TSTU per pipeline; Retry-After, X-RateLimit-Resource/Delay/Limit/Remaining/Reset/Cost; Basic + Test Plans raises the limitRate and usage limits(2026-11-15)
Service hooksConsumer list (Webhooks, Slack, Teams (managed in Teams), Service Bus, Storage, Jenkins, Datadog, Grafana, etc.); Edit/View subscriptions permissions; outbound IPs must be allowedService hooks(2026-11-15)
Extension tool versionstfx-cli 0.24.x, azure-devops-extension-sdk 5.0.0 (npm registry)registry.npmjs.org (2026-11-15)
GitHub Enterprise ImporterMigrates: source and history, PRs (user history, work item links, attachments), repository branch policies; does not migrate: user-level and cross-repository policies, LFS objects; pipelines need to contact an account manager or use another tool; limits 40 GiB (preview), 400 MiB, 2 GiB, 255 bytes, rulesets, mannequins; gh-gei v1.35.0 (2026-10-28); ado2gh commands and parameters taken from sourceGitHub Docs · github/gh-gei(2026-11-15)
GitHub Actions ImporterRequires Docker and the gh CLI, ADO API 5.0; configure/audit/forecast (default 7 days)/dry-run/migrate, pipeline and release subcommands; supported / partially supported / unsupported lists; items requiring manual migration; PAT scopes and environment variablesGitHub Docs(2026-11-15)

Video verification notes

The following videos were all checked via the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json, 2026-11-15) for titles and channels: TechWorld with Nana, “Azure DevOps Tutorial for Beginners | CI/CD with Azure Pipelines” (4BibQ69MD8c); DevOps on Azure, “Azure DevOps: Zero to Hero Tutorial” (DoWhZO7nbCY); Microsoft Visual Studio, “Building and Deploying your Code with Azure Pipelines” (NuYDAs3kNV8); Asp.Net Monsters, “Faster Azure DevOps Pipelines (#259)” (BfSgjDd5e7g); Azure Power Lunch, “Public Preview of Managed DevOps Pools (MDP) for Azure DevOps” (3IWFIhUF_sY); CoderDave, “EVERYTHING About the Scale Set Agents for Azure Pipelines (VMSS)” (3oILIG4i71g); Mike Douglas, “Learning How to Set Up an Azure Virtual Machine Scale Set Agents for Azure DevOps” (SpnzV6dVgYw); Federal App Innovation Community, “Scaling Containerized Azure DevOps Agents with AKS + KEDA” (06RF-I87jMs); CoderDave, “How to REDUCE Build Time Using Caching in Azure Pipelines (Cache)” (HfJcN9gWleM); Dwain: Unfinished, “Retrieving Commits from Azure DevOps API” (g9hfanNLNLo); Azure DevOps Sprints, “#azuredevopssprints 157 - Service hooks for YAML pipelines” (-wLb-M0e-G8); Cloudamy, “Azure DevOps Slack Integration …” (gxkvqIn2hIs); Ethan Dennis, “Azure DevOps migrations powered by GitHub Actions Importer” (gG-2bkmBRlI, linked from the github/gh-actions-importer README); MadeForCloud, “Migrating Repositories from Azure DevOps to GitHub Using GitHub CLI ADO2GH Extension” (iPlsUxGBrNw); RamanaReddy V, “Migrating Azure DevOps repositories into GitHub Enterprise Cloud” (2SRcs2T6q50); DevOps on Azure, “Using Azure Boards with GitHub | DevOps Lab” (Q-wnvG_pvj8) and “Introducing Azure Boards to the GitHub Marketplace | DevOps Lab” (A3jD3eWvYLE). Durations and upload dates are not verified; interfaces and rules in older videos (such as how the free tier is requested) may be out of date, so follow the text of this lesson. No verified video covering system.debug / _diag, the 2026 parallel-job billing rules, or the fault mystery box topic was found; the corresponding modules provide storyboard scripts instead.

Narration notes

The “Narration” tab reads the script aloud using the browser's Web Speech API (en-US), with English terms pronounced in en-US; the result depends on the speech packs installed on the operating system. The courseware generation environment cannot call a TTS service, so no MP3 is embedded; the narration script can be used directly for recording.

Known limitations

  • Organization names, run IDs, GUIDs, times, line counts, durations and costs in the “expected output” are example values; the lab commands were not actually executed in this environment.
  • Some error texts (such as unmet demands, no hosted parallel quota, image label does not exist, REST version error number) are written in common forms; exact wording follows the actual run page / response.
  • The following content was written from official materials but could not be tested, and has been handled conservatively: az mdp JSON shape of Stateful/Automatic in the CLI (follow --help and the CLI tab of the docs); automatic disabling behavior after service hooks keep failing; settingsSourceType the meaning of the values of; details of which branch's YAML scheduled triggers read; the specific installation steps for service hooks to Teams (follow the Teams app docs); the PAT scopes required by GEI (follow the GitHub docs).
  • Agent version: the official Linux installation docs still describe 4.x, while the GitHub release page already has 5.x; this lesson uses the release page as the basis for the latest version; replace the version number in install commands with the latest version you see.
  • Prices are USD values from the pricing page, excluding tax and regional differences; the MDP example VM unit price of $0.12/hour is taken from the official example and is not an actual canadacentral quote.
  • Time constants in animations and simulators are scaled down proportionally and are used only to explain mechanisms.
  • Lesson 8 was written in parallel with this lesson; cross-lesson references follow the final content of each lesson.