Narration: The first step in troubleshooting is not reading logs, but determining which stage is broken.
Azure DevOps Hour 7: Deep Troubleshooting, Optimization and Advanced Topics
- 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_diagthe 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
--oncesingle-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
| # | Time | Module | Core content | Animation / interaction | Lab |
|---|---|---|---|---|---|
| 0 | Before class | Prep: fault-injection project | myapp-lab project, baseline pipeline myapp-ci,faults/ fault-injection scripts, az devops CLI and Entra token | — | Push the baseline and get one green run |
| 1 | 00–06 | Troubleshooting methodology and diagnostic logs | seven-stage locating method, Error analysis page,system.debug / Enable system diagnostics, download logs,_diag,Agent environment resources, REST timeline | step-by-step animation of “drilling down through log layers” | Rerun with debug on and use REST to find the failing task |
| 2 | 06–14 | Deep dive into common pipeline failures | No trigger, YAML compilation, The pipeline is not valid, resource authorization, queuing, task/image deprecation, shallow clone | “Which stage did it fail in?” classifier | Reproduce and fix 4 kinds of failure |
| 3 | 14–23 | Self-hosted agents, VMSS and MDP | install/upgrade/run as a service, SP registration, container agents and --once, VMSS pools, Managed DevOps Pools (dev center, standby, stateless/stateful), isolation | Elastic agent pool scaling simulator (core animation) | Deploy a self-hosted container agent; optional MDP |
| 4 | 23–30 | Performance: parallelism, caching and agent sizing | Parallel jobs / matrix / test slicing, Cache@2, Docker layer caching, agent sizing, lean checkout, incremental builds | Pipeline duration calculator | Before/after comparison of the same pipeline |
| 5 | 30–37 | Parallel jobs and cost optimization | Billing for hosted and self-hosted parallel jobs, changes in how free tiers are obtained, pool consumption report, MDP cost formula, on-demand scaling | Monthly cost estimator | Export 30 days of queue data for capacity recommendations |
| 6 | 37–45 | REST API, service hooks and extensions | api-version, Entra tokens, paging, TSTU and X-RateLimit headers, service hooks, Marketplace extensions | Paging + rate-limit simulator | Failed build → Webhook notification |
| 7 | 45–52 | Migration: Azure DevOps to GitHub | GEI (ado2gh): what it can and cannot migrate, Boards integration, rewire-pipeline, GitHub Actions Importer | Migration asset mapper | Actions Importer dry-run |
| 8 | 52–60 | Comprehensive fault mystery box | 8 randomly injected faults, in-browser simulator, interactive troubleshooting tree | Mystery box simulator + troubleshooting tree | Mystery box challenge (real project) |
| — | After class | Cheat sheet · Capstone lab | Fault mystery box challenge + performance/cost optimization report + optional self-hosted container agent | Final quiz: 12 questions | Acceptance checklist: 12 items |
Knowledge Coverage Matrix
| Target skill | Module | Key commands / settings | Lab | Production case |
|---|---|---|---|---|
| Diagnostic logs and evidence collection | M1 | system.debug=true, Download logs,_diag/Agent_*.log,Worker_*.log,./run.sh --diagnostics | ✓ | ✓ |
| Locate the failing step via the API | M1 · M6 | _apis/build/builds/{id}/timeline,az devops invoke | ✓ | ✓ |
| Trigger / compile / authorization failures | M2 | trigger,paths, Override YAML trigger, Permit, Open access | ✓ | ✓ |
| Queuing and parallelism | M2 · M5 | Parallel jobs page, Pool consumption report, demands | ✓ | ✓ |
| Checkout and Git history | M2 · M4 | fetchDepth,fetchTags,fetchFilter,sparseCheckoutDirectories | ✓ | ✓ |
| Self-hosted agent lifecycle | M3 | config.sh --unattended,svc.sh install, Update all agents,--auth SP | ✓ | ✓ |
| Container agents and single-use agents | M3 | AZP_URL/AZP_TOKEN/AZP_POOL,run.sh --once | ✓ | ✓ |
| Elastic agent pool | M3 | az vmss create --disable-overprovision --upgrade-policy-mode manual,az mdp pool create | optional | ✓ |
| Build performance | M4 | Cache@2,strategy: parallel/matrix,dependsOn, path filters | ✓ | ✓ |
| Cost optimization | M5 | Parallel job purchase, standby plans, stateless/stateful | ✓ | ✓ |
| REST / service hooks / extensions | M6 | api-version,x-ms-continuationtoken,X-RateLimit-*,_apis/hooks/subscriptions,tfx extension create | ✓ | ✓ |
| Migration to GitHub | M7 | gh ado2gh migrate-repo,rewire-pipeline,integrate-boards,gh actions-importer audit/dry-run/migrate | ✓ | ✓ |
| Comprehensive troubleshooting | M8 | All | ✓ | ✓ |
What this lesson does not cover
| Topic | Reason | Where to learn it |
|---|---|---|
| YAML syntax, triggers, and basic writing of stages/jobs/steps | Covered in Lesson 2; this lesson only covers “what to do when it breaks” | Lesson 2 |
| Details of creating service connections and workload identity federation | Covered in Lessons 3/4; this lesson only covers authorization and troubleshooting | Lesson 3 · Lesson 4 |
| extends templates, approvals and checks | Covered in Lessons 5/6 | Lesson 5 · Lesson 6 |
| GitHub Actions syntax and runners | Topic of the GitHub course | GitHub 8-hour course |
| Writing Dockerfiles, slimming images | Topic of the Docker course | Docker 8-hour course |
| A complete plan for scaling container agents with KEDA on AKS | Beyond 1 hour; only the approach is given | Kubernetes 8 + 1-hour course + KEDA docs, azure-pipelines scaler |
How to use this courseware
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · narration · video. Read “principles + animation” first, then do the “lab” in the myapp-lab project.
A quiz score ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (storage key
ado60-part7-progress-v1).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.
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
- Completed Lessons 1–6: organization
https://dev.azure.com/<org>has a projectmyapp-lab, repositorymyapp(the Flask + gunicorn + Redis app from the Docker course, including/healthz), pipelinemyapp-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)
| Name | Value (example) | Source |
|---|---|---|
| Organization / project | https://dev.azure.com/contoso-lab / myapp-lab | Lesson 1 |
| Repository / pipeline | myapp / myapp-ci (YAML: azure-pipelines.yml) | Lesson 2 |
| ARM service connection | sc-azure-lab (workload identity federation) | Lesson 3 |
| Azure resource group / region | rg-ado-lab / canadacentral | Lesson 3 |
| Created in this lesson | Self-hosted pool lab-selfhosted; optional MDP pool mdp-myapp-<random>, dev center dc-ado-lab | M3 |
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
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
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
- 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.debugthe difference between and the scope of “Enable system diagnostics”. - Know the self-hosted agent
_diagdirectory contents: the Agent and Worker log types, and how to useAgent.Diagnostic,VSTS_AGENT_HTTPTRACE,./run.sh --diagnostics. - Use REST (timeline + logs) or
az devops invoketo precisely find the failing stage/job/task and its logs in a script.
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.
| Stage | Typical symptom | Where the evidence is | Common tools |
|---|---|---|---|
| ① Trigger | No new run at all after a push | Pipeline Triggers settings, trigger/paths in the YAML, YAML version on the branch | Compare with a manual run,az pipelines runs list |
| ② Compile | Run fails immediately, with a YAML line and column number | Error at the top of the run summary; Validate on the Edit page | Editor Validate, Download full YAML |
| ③ Authorize | “needs permission to access a resource” or The pipeline is not valid … not authorized | Run summary, resource's Security / Pipeline permissions | Permit, Open access, audit log |
| ④ Queue | Job stays Queued for a long time | Queue explanation in the job panel, Parallel jobs page | Pool consumption report, View in-progress jobs |
| ⑤ Agent | “We stopped hearing from agent”, Initialize job fails | Initialize job log, agent _diag | Agent Capabilities,run.sh --diagnostics |
| ⑥checkout | Git fetch failed with exit code 128, TF401019 | Checkout step log | git trace under system.debug |
| ⑦ Task | ##[error] and a non-zero exit code | Task log, uploaded custom logs | Error analysis, local reproduction commands |
How: the five levels of logs
- 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.
- 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.
- 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 injectsAgent environment resources - Disk … Memory … CPU …resource utilization lines; it also automatically setsAgent.Diagnosticto true, which collects network diagnostic files (cloudinit, BrokenPackages, environment.txt, etc.; agent ≥ 2.200.0). - Full log package: run page … → Download logs, which yields a zip with one file per step, including
environment.txt(run environment) andcapabilities.txt(agent capabilities). - 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) andWorker_<time>-utc_<pid>.log(execution details of a single job). You can also setVSTS_AGENT_HTTPTRACE=trueto log HTTP headers, or run./run.sh --diagnosticsfor 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;
_diagagent 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
Agent directory structure (self-hosted)
_diag is the first place to look when troubleshooting a self-hosted agent; .credentials files like these need strict file permissionsStep-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.
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
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
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
Agent environment resources lines and ##[error] lines, and open environment.txt (if it exists).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 418faults/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.
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)
No verified video specifically explaining system.debug / _diag / timeline API was found; please rely on the official documentation and storyboard script below.
Official documentation
- Troubleshoot pipeline runs
- Review logs to diagnose pipeline issues
- REST · Build Timeline
- Logging commands
Video storyboard script
This courseware cannot directly generate video or MP3; a storyboard and narration script are provided instead.
Narration: The first step in troubleshooting is not reading logs, but determining which stage is broken.
Narration: Error analysis tells you which task and what input; when more detail is needed, rerun once with system diagnostics.
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.
Narration: For bulk analysis, use the timeline endpoint; one command finds the failing step and its log ID.
Module 2 · Deep dive into common pipeline failures
- 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.
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:
| # | Cause | How to confirm |
|---|---|---|
| 1 | trigger.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 |
| 2 | the Triggers setting of the pipeline has been checked Override the YAML continuous integration trigger from here, the UI setting overrides the YAML | Edit → … → Triggers |
| 3 | trigger: 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 |
| 4 | The commit message contains [skip ci],***NO_CI*** skip markers such as | git log -1 |
| 5 | The pipeline is set to Paused / Disabled (Settings → Processing of new run requests) | Pipeline … → Settings |
| 6 | Scheduled 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 |
| 7 | The YAML file path was changed but the pipeline definition still points to the old path, or the YAML was deleted on the new branch | Pipeline Settings → YAML file path |
| 8 | GitHub repository: the GitHub App is not installed on the repository / the webhook was deleted / the service connection is invalid | GitHub 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,
extendsa required template is not used (the required-template check from Lesson 5), duplicate Job/Stage names,dependsOnpointing 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
Authorization check for protected resources
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.
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
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.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.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
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.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.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.
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)
Official documentation
- Triggers in Azure Pipelines
- Resource authorization in YAML pipelines
- steps.checkout
- Microsoft-hosted image deprecation schedule
Video storyboard script
Narration: No run is happening, so check the trigger first: branch and path filters read the YAML of the branch that was pushed.
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.
Narration: For queuing, distinguish between not enough slots and no agent that meets the requirements; buying more slots does not help the latter.
Narration: New pipelines default to shallow clones; when you need history and tags, always set them explicitly.
Module 3 · Self-hosted agents, VMSS and Managed DevOps Pools
- 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,--oncesingle-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.
What: four ways to run jobs
| Microsoft-hosted | Self-hosted (VM / physical machine / container) | VMSS agent pool | Managed DevOps Pools | |
|---|---|---|---|---|
| Where the machines are | Microsoft | Any environment you control | VMSS in your Azure subscription | Azure subscription managed by Microsoft (can inject your VNet) |
| Specs | Fixed: 2 cores / 7 GB / 14 GB SSD (about 10 GB free) | Any | Any VM SKU | Any supported SKU, default Standard D2ads v5; data disks configurable; up to 5 SKUs mixed (2026-09 Instance Mix) |
| Image | runner-images (updated weekly, cannot be rolled back) | Maintained by you | Marketplace / 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 |
| Scaling | Handled by the platform | Handled by you | Azure Pipelines samples every 5 minutes and scales up by a percentage of the maximum | Increments by 1; supports standby plans and automatic prediction |
| Billing | Hosted parallel jobs | Self-hosted parallel jobs + your machines | Self-hosted parallel jobs + Azure VMs | Self-hosted parallel jobs + Azure compute/storage/egress (cannot use VM reserved instances or Azure Hybrid Benefit) |
| Longest job | Free 1 hour / paid 31 hours | Unlimited (subject to timeout setting) | Unlimited | 2 days |
Self-hosted agent lifecycle
- Registration:
config.shUse 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. - Listening:
Agent.ListenerPulls jobs from the service via HTTPS long polling (requires only outbound 443; no inbound ports). - Execution: after picking up a job, it starts the
Agent.Workerprocess, which downloads tasks, runs steps and streams logs back. - 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.
- 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 userAzDevOps. - 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/poolsresource; quota is independent from your subscription's compute quota (by default 5 cores for some SKU families). - Prerequisites: Register
Microsoft.DevOpsInfrastructureandMicrosoft.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,
maxAgentLifetimedefault and maximum7.00:00:00,gracePeriodTimeSpanno 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.daysDataseven 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.cometc.).
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
Managed DevOps Pools architecture
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.
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
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.
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.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.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
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.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).docker exec azp-c1 ls /azp/_diag (the agent is extracted in WORKDIR /azp), and find the Worker log for this job.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.
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)
Official documentation
- Managed DevOps Pools overview
- MDP · Configure scaling
- Compare MDP with VMSS agents
- Azure Virtual Machine Scale Set agents
- Run a self-hosted agent in Docker
- Deploy an agent on Linux
Video storyboard script
Narration: The starting point of an elastic pool is the queue: slots available, no agents.
Narration: VMSS samples every five minutes and scales by percentage; MDP increments one machine at a time and can warm up on a schedule.
Narration: Agents pick up jobs after registering; stateless pools reclaim after each job; stateful pools reuse agents within the grace period.
Narration: No matter how many agents there are, concurrency will not exceed the number of self-hosted parallel jobs the organization purchased.
Module 4 · Performance: parallelism, caching and agent sizing
- 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: parallelslicing 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).
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
| Lever | Approach | Benefit | Cost / pitfall |
|---|---|---|---|
| Parallel jobs | split lint / unit tests / security scanning into jobs with no dependencies; strategy: matrix multiple versions; strategy: parallel: N test slicing | the critical path shrinks to the longest single job | each job consumes a parallel-job slot and repeats checkout/restore; with too few slots it can actually be slower |
| Caching | Cache@2 Cache package manager cache directories (pip, npm, NuGet, Maven, Gradle), ccache, Docker buildx local cache | restore drops from minutes to seconds | restoring and saving have overhead; caches are immutable, so a fixed key never updates; do not cache node_modules (npm ci will delete it) |
| Agent sizing | CPU-heavy work: more cores; memory-starved: more memory; disk short: add a data disk (MDP); stateful agents reuse workspace and package cache | compile/test scales roughly linearly (until I/O becomes the bottleneck) | billed hourly; hosted agents cannot be upsized |
| Reduce checkout | fetchDepth: 1 (when history is not needed),fetchTags: false,fetchFilter: blob:none (partial clone),sparseCheckoutDirectories, deployment jobs checkout: none | large-repo checkout drops from minutes to seconds | conflicts with M2's “needs history”; choose per job |
| Incremental builds | trigger.paths trigger only when relevant directories change; choose which jobs to run by git diff ; stateful agents workspace: clean: outputs keep the source | many commits do not need a full run at all | the 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
Cache scope
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
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.
inexact) → the job saves the new key when it finishes.--filter=blob:none and sparse-checkout-related commands; record the checkout step time.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.
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: 2Scenario 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)
Official documentation
Video storyboard script
Narration: Measure before optimizing: find the longest segment.
Narration: Cache the package manager's cache directory, use the lock file for the key, and use restoreKeys as a fallback.
Narration: Parallelism can shorten the critical path, but every job needs a slot.
Narration: If a job does not need history, do not fetch history.
Module 5 · Parallel jobs and cost optimization
- 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.
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 tier | Paid | Notes | |
|---|---|---|---|
| Microsoft-hosted | Private 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 job | The 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-hosted | 1 parallel job + each active Visual Studio Enterprise subscriber in the organization 1 each, no time limit | $15 / additional parallel job / month | Billed by the number of jobs running at the same time, not by the number of registered agents; any number of agents can be registered |
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
- First optimize duration (M4): halving the duration halves both hosted minutes and VM hours.
- Schedule standby for working hours, zero at night and on weekends; when unsure, use Automatic (MostCostEffective / MoreCostEffective).
- Stateless is the default; use stateful only when you really need to reuse caches, and set a reasonable grace period.
- Choose SKUs by bottleneck: memory-bound → memory-optimized, CPU-bound → more cores; use Instance Mix to improve availability.
- 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.
- 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 triggeringbatch: 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
Composition of MDP monthly cost
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
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.
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.
Official documentation
- Configure and pay for parallel jobs
- Azure DevOps Services pricing
- Pool consumption report
- Managed DevOps Pools pricing
Video storyboard script
Narration: Parallel jobs are like swimming lanes: one lane holds only one swimmer at a time.
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.
Narration: Look at the 30-day consumption report to decide whether the bottleneck is slots or agents.
Narration: Money in elastic pools is spent on machine-hours; a standby schedule must specify the time points where it returns to zero.
Module 6 · REST API, service hooks and extensions
- Call REST correctly: URL structure, the required
api-version, the lifecycle of preview versions, and Entra token authentication. - Paginate correctly:
$top+ continuation token (response headerx-ms-continuationtoken), do not$skippage forcibly. - Understand global rate limits: the TSTU definition, 200 TSTU per 5-minute sliding window, 200 TSTU per pipeline independently, 429 and
TF400733,Retry-AfterandX-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 taskstask.json) and the packaging and publishing workflow (tfx-cli).
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 examplevssps.dev.azure.comfor identity and graph,vsrm.dev.azure.comfor classic release,feeds.dev.azure.comfor Artifacts). - Version: every request must include
api-version(a query parameter orAccept: application/json;api-version=7.1). The format is{major}.{minor}[-preview[.{rev}]]. After an API is officially released, its-previewversion is deprecated,12 weeks later it may be retired, and preview requests are then rejected. The official getting-started docs' examples now use7.2; the examples in this lesson uniformly use7.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, useapplication/json-patch+json; when the proxy only allows GET/POST, useX-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, targetsMicrosoft.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) andazure-devops-extension-api; Custom tasks are made oftask.json(inputs, execution handler) +azure-pipelines-task-libimplementation; 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-Remainingappears 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
continuation token paging
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.
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)
faults/inject.sh 7 (shallow clone); after the run fails, the receiver prints build.complete … failed.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-builds.sh, and count the result distribution: jq -r .result builds.jsonl | sort | uniq -c.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.
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)
Official documentation
- Get started with the REST APIs
- REST API versioning
- Rate and usage limits
- Service hooks
- Extensions overview
Video storyboard script
Narration: Every request must include api-version, and preview versions may be retired twelve weeks after the general release.
Narration: For paging, look at the continuation token in the response header; without it, it is the last page.
Narration: 200 TSTU in five minutes; when near the threshold, the response headers warn you early to slow down.
Narration: If you can push events, don't poll; service hooks deliver changes directly to your system.
Module 7 · Migration: Azure DevOps to GitHub
- 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.
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
| Migrated | Not migrated / handled separately |
|---|---|
|
|
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)
| Command | Purpose |
|---|---|
inventory-report | Inventory organizations / projects / repositories / pipelines, generate CSVs for planning batches |
generate-script --all | Generate migrate.ps1: migrate repositories, and (with --all) create teams, rewire pipelines, configure Boards integration, etc. |
migrate-repo | Migrate a single repository (--ado-org --ado-team-project --ado-repo --github-org --github-repo, can --queue-only,--target-repo-visibility) |
wait-for-migration / download-logs | Wait for the queued migration to finish / download the migration log |
lock-ado-repo / disable-ado-repo | Lock the source repository before cutover to prevent new pushes / disable the source repository after cutover |
rewire-pipeline | Change 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-autolink | Configure the Azure Boards ↔ GitHub integration for the project / configure in the GitHub repository AB# auto-linking |
share-service-connection / test-pipelines | Share the GitHub service connection with the project / test the re-wired pipeline |
generate-mannequin-csv / reclaim-mannequin | Map 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
- 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.
- 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.
pullRequesttags, 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 --allpushed 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
Cutover window for one repository
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.
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).
workflow, 1 day) and an ADO PAT (the read-only scopes above, 1 day).configure and audit, then open tmp/audit/audit_summary.md, and record myapp-ci's classification and the items that need manual handling..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.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).rewire-pipeline --dry-run on it.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.
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)
Official documentation
- About migrations from Azure DevOps to GHEC
- github/gh-gei (ado2gh)
- Migrating from Azure DevOps with GitHub Actions Importer
- Azure Boards & GitHub
- Public projects retirement
Video storyboard script
Narration: GEI migrates code, pull requests and repository branch policies; it does not migrate pipelines, Boards or LFS objects.
Narration: Lock the source repository first, then migrate; LFS objects must be pushed separately.
Narration: Pipelines can be kept at first and rewired to GitHub; Boards integrates with GitHub using AB numbers.
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.
Module 8 · Comprehensive fault mystery box
- 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.
The 8 faults in the mystery box
| # | Fault | Stage | First symptom | Key evidence | Fix |
|---|---|---|---|---|---|
| F1 | Path filter mismatch | ① Trigger | No run after push | the YAML of that branch's paths.include | Correct paths |
| F2 | YAML unknown key | ② Compile | Run fails immediately, with Line/Col | Unexpected value 'step' | Change back to steps |
| F3 | Template file does not exist | ② Compile | The pipeline is not valid | Template path | Create the template / remove the reference |
| F4 | Service connection does not exist or is not authorized | ③ Authorize | The pipeline is not valid … could not be found / needs permission | service connection name, Pipeline permissions | Correct the name, Permit |
| F5 | Demands cannot be satisfied | ④ Queue | Job stays Queued | Agent capabilities | Remove the demand or add the capability to the agent |
| F6 | Image retired | ⑤ Agent | Job cannot be allocated / initialized | vmImage: ubuntu-20.04 | Change to ubuntu-24.04 |
| F7 | Shallow clone missing tags | ⑥checkout | Version step fails | No names found, in checkout --depth=1 | fetchDepth: 0 + fetchTags: true |
| F8 | Disk full | ⑦ Task / ⑤ Agent | No space left on device or agent lost contact | the verbose Agent environment resources | Clean up / switch to an agent with a larger disk |
Mystery box rules
- Do not look at
.fault-answer, and do not look at git diff (in real incidents you usually cannot see “what changed”). - 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.
- Timing: 2 minutes per question in the simulator; 10 minutes per fault in the real project.
- 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
refto 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 grepfor 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
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.
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)
lab-selfhosted the pool exists (F5 requires it), and the service connection sc-azure-lab is authorized correctly. Start a timer.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.faults/reset.sh after; open another one (it may repeat; if it does, open another). This round requires at least one “evidence” command output.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.gpu=true (pool → agent → Capabilities → Add), observe the queued job being picked up, then delete the capability.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.
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 table2. 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.
Official documentation
Video storyboard script
Narration: The mystery box holds eight faults; you can only see the symptoms.
Narration: Two questions can narrow the scope to one or two possibilities.
Narration: Evidence before conclusions: use a script to get the original text of the failing step.
Narration: Change only one thing, rerun to verify, and write down the record and preventive measures.
Command cheat sheet
Diagnostic logs
| Purpose | Command / setting |
|---|---|
| Verbose logs for all runs | variables: { system.debug: true } (automatically turned on Agent.Diagnostic) |
| Verbose log for a single run | Run pipeline → Enable system diagnostics |
| Resource utilization | Search in verbose logs Agent environment resources |
| Download all logs | Run 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 logs | echo "##vso[task.uploadfile]/path/file" |
Common failures
| Symptom | Check first |
|---|---|
| No run | trigger/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 error | Validate; POST _apis/pipelines/{id}/preview (previewRun: true) |
| The pipeline is not valid | template path/parameters; resource “does not exist, is disabled or is not authorized” (service connections unused for 100 days are disabled) |
| needs permission | View → Permit; resource Security → Pipeline permissions; use Open access with caution |
| Stuck in Queued | Parallel jobs → View in-progress jobs; demands vs capabilities (restart the agent after installing software) |
| Version / diff errors | fetchDepth: 0,fetchTags: true |
| image retirement | Windows 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
| Figure | Value |
|---|---|
| Hosted agent spec | 2 cores / 7 GB / 14 GB SSD (≥10 GB available); Linux step cgroup 6 GB physical memory |
| VMSS pool | Sampled every 5 minutes; scales by a percentage of the maximum, about 20 minutes per step; scales down after 30 minutes idle (configurable) |
| MDP | Increments 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 version | v5.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)
| Item | Value |
|---|---|
| Hosted parallel jobs | 1 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 jobs | 1 free + 1 per VS Enterprise subscriber; $15 per job per month |
| Do not use a slot | Waiting for approval, server jobs, deployment groups |
| MDP / VMSS | Self-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
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.
faults/ scripts, and the M1 faults/why.sh, and confirm main is green.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%.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'; donelab-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.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
| Topic | Verification conclusions | Source (verification date) |
|---|---|---|
| Diagnostic logs | Enable 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 problems | Error 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 Server | Troubleshoot pipeline runs(2026-11-15) |
| Parallel jobs | Hosted: 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 2027 | Configure and pay for parallel jobs(2026-11-15) |
| Prices | Hosted $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 page | Azure DevOps pricing(2026-11-15) |
| Microsoft-hosted agents | ubuntu-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 GB | Microsoft-hosted agents(2026-11-15; page date 2026-11-09) |
| Self-hosted agents | The 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.com | Linux agent · SP registration · agent releases(2026-11-15) |
| Container agents | Ubuntu 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 pool | Must 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 MDP | Scale set agents(2026-11-15) |
| Managed DevOps Pools | evolution 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-20 | Overview · Prerequisites · Scaling · Pricing · Timeline · CLI quickstart(2026-11-15) |
| Pipeline caching | Cache@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 supported | Pipeline caching(2026-11-15) |
| REST API | URL structure; api-version required; examples use 7.2; preview is deprecated after release and can be retired 12 weeks later; prefer Entra tokens | Call REST API · Versioning(2026-11-15) |
| Rate limits | TSTU 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 limit | Rate and usage limits(2026-11-15) |
| Service hooks | Consumer list (Webhooks, Slack, Teams (managed in Teams), Service Bus, Storage, Jenkins, Datadog, Grafana, etc.); Edit/View subscriptions permissions; outbound IPs must be allowed | Service hooks(2026-11-15) |
| Extension tool versions | tfx-cli 0.24.x, azure-devops-extension-sdk 5.0.0 (npm registry) | registry.npmjs.org (2026-11-15) |
| GitHub Enterprise Importer | Migrates: 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 source | GitHub Docs · github/gh-gei(2026-11-15) |
| GitHub Actions Importer | Requires 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 variables | GitHub 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 mdpJSON shape of Stateful/Automatic in the CLI (follow--helpand the CLI tab of the docs); automatic disabling behavior after service hooks keep failing;settingsSourceTypethe 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.