Azure DevOps Hour 6: Enterprise Security and Governance in Practice
- Connect the organization to Microsoft Entra ID, using Conditional Access to protect Azure DevOps resources (resource ID
499b84ac-1321-427f-aa17-267ca6975798), and explain item by item the impact of each switch on the organization policies page: third-party OAuth, SSH, external guests, public projects, IP Conditional Access validation on non-interactive flows, and so on. - Define PAT governance: understand the retirement of global PATs (two dates appear in the official docs: 2026-12-01 and 2027-01-27 ), the difference between tenant-level “Restrict global PATs / Restrict full-scoped PATs / Enforce maximum lifespan” and organization-level “Restrict PAT creation”, and migrating automation to Entra tokens, service principals and managed identities.
- Understand how the pipeline's protected resources (service connections, agent pools, environments, variable groups, secure files, repositories) must pass “authorization → static checks → approvals → dynamic checks → exclusive lock” before a stage can use them, and enable “Limit job authorization scope”, “Protect access to repositories”, “shell task argument validation” and fork PR protection.
- Use Key Vault-linked variable groups,
AzureKeyVault@2and secure files to manage secrets, understand the limits of log masking, and avoid putting secrets into template parameters. - Enable GitHub Advanced Security for Azure DevOps (GHAzDO): secret scanning and push protection, CodeQL code scanning (default and advanced setup), dependency scanning, and understanding billing (per active committer).
- Use cross-repository branch policies,required template checks and organization-level pipeline settings to implement scaled governance; enable auditing, export and stream to Azure Monitor Logs / Splunk / Event Grid, and complete a governance architecture review.
1-hour time allocation
| # | Time | Module | Core content | Animation / interaction | Lab (project myapp-lab) |
|---|---|---|---|---|---|
| 0 | Before class | Preparation: governance lab project | Confirm the Entra tenant, organization roles and myapp-lab's current state; create Entra groups; self-assess the governance baseline | 12-item governance maturity self-assessment | Call the REST API with an Entra token |
| 1 | 00–07 | Organization governance and Entra ID integration | Connect the Entra tenant, Conditional Access, item-by-item explanation of organization policies, tenant policy (restrict organization creation), public project retirement | Request path × organization policy evaluator | Connect/verify Entra, turn off third-party OAuth, restrict invitations |
| 2 | 07–14 | PAT, identity and access governance | Global PAT retirement (two dates), PAT tenant/organization policies, maximum lifespan, automatic revocation of leaked PATs, Entra tokens, service principals/managed identities, access reviews | PAT policy evaluator | Set and verify PAT policies, call REST as a service principal |
| 3 | 14–22 | Pipeline security: protected resources and checks | Six types of protected resources, pipeline permissions, the five check categories and execution order, limiting job authorization scope, protecting repository access, shell argument validation, fork PRs | Core animation: deployment run gating flow | Add approvals + branch control + required template to myapp-prod |
| 4 | 22–29 | Secrets management: Key Vault variable groups and secure files | Key Vault-linked variable groups (values read at runtime), AzureKeyVault@2, secure files (10 MB), secret masking boundaries, template parameter pitfalls | Log masking simulator | RBAC Key Vault + variable group + masking verification |
| 5 | 29–37 | GitHub Advanced Security for Azure DevOps | Secret Protection ($19) / Code Security ($30) split, active committer billing, push protection and skip-secret-scanning:true, CodeQL default/advanced setup, dependency scanning, PR status checks | Push protection simulator | Enable GHAzDO (or open-source alternatives gitleaks / CodeQL CLI) |
| 6 | 37–45 | Scaling governance of branch policies and required templates | cross-repository branch policies, required template checks, extends secure templates, and locking organization-level pipeline settings | Required template check evaluator | Project-level main policy + secure template repository |
| 7 | 45–53 | Audit logs, compliance and streaming | Enable auditing (off by default, requires Entra), event areas and categories, 90-day retention, CSV/JSON export, REST, three stream targets, 7-day backfill | Audit event flow animation | Enable auditing, export, create a Log Analytics stream and query with KQL |
| 8 | 53–60 | Governance architecture review | Layered governance architecture, scorecard, common violations and remediation, interactive troubleshooting tree | Governance scorecard + troubleshooting tree | Review myapp-lab and produce a remediation list |
| — | After class | Cheat sheet · Capstone lab | Establish a complete governance baseline for myapp-lab and prove it with audit logs | Final quiz (12 questions) | Capstone lab |
Knowledge Coverage Matrix
| Target skill | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key commands / location | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Entra integration and Conditional Access | ✓ | ✓ | · | · | · | · | · | ✓ | Organization settings › Microsoft Entra | M1 |
| Organization policy switches | ✓ | ✓ | · | · | · | · | ✓ | ✓ | Organization settings › Policies | M1/M7 |
| PAT lifecycle and policies | · | ✓ | · | · | ✓ | · | ✓ | ✓ | _apis/tokens/pats, auditing Token.* | M2 |
| Non-human identities (SP / MI) | · | ✓ | ✓ | ✓ | · | · | · | ✓ | az account get-access-token --resource 499b84ac-… | M2 |
| Protected resource authorization and checks | · | · | ✓ | ✓ | · | ✓ | · | ✓ | Approvals and checks,pipelinepermissions | M3 |
| organization-level pipeline security settings | · | · | ✓ | · | · | ✓ | · | ✓ | Organization settings › Pipelines › Settings | M3/M6 |
| secrets management and masking | · | · | · | ✓ | ✓ | · | · | ✓ | AzureKeyVault@2,DownloadSecureFile@1 | M4 |
| secret scanning / push protection | · | ✓ | · | ✓ | ✓ | · | · | ✓ | skip-secret-scanning:true | M5 |
| code and dependency scanning | · | · | · | · | ✓ | ✓ | · | ✓ | AdvancedSecurity-Codeql-Init@1 etc. | M5 |
| cross-repository branch policies / required templates | · | · | ✓ | · | ✓ | ✓ | · | ✓ | az repos policy, Required template | M6 |
| auditing, export and streaming | ✓ | ✓ | · | · | · | · | ✓ | ✓ | auditservice.dev.azure.com,AzureDevOpsAuditing | M7 |
What this lesson does not cover (and where to learn it)
| Topic | Why it is not in this lesson | Where to learn it |
|---|---|---|
| Security groups, permission inheritance and “deny wins” evaluation, access levels and billing | This lesson builds governance on top of these and does not repeat the basics | Hour 1 |
| Creation details for workload identity federation (OIDC) for service connections, Environments basics | Covered in the Azure deployment course; this lesson only covers “how to govern them” | Hour 3 |
| extends / includes template syntax, parameter types | This lesson only covers required template checks and governance use of secure templates | Hour 5 |
| Self-hosted agent hardening, Managed DevOps Pools network isolation | Belongs to agent infrastructure topics | Hour 7 |
| Git signed commits, local credential management (GCM) | Git client-side content | Git 8-hour course(Azure Repos has no built-in “require signed commits” branch policy) |
| GHAS, rulesets and Actions security on GitHub | GitHub platform topics | GitHub 8-hour course |
| Entra ID's own PIM, identity protection and advanced Conditional Access design | Belongs to identity platform topics and goes beyond 1 hour | Entra Conditional Access documentation |
How to use this courseware
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · narration · video. Read “Principles” first, then play with the “Animation”, and finally do the “Lab” in your own organization. Most governance tasks are done in the web UI; the command pages give scriptable REST/CLI equivalents.
A quiz score ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (if local storage is disabled, progress is cleared on refresh).
The “Narration” page reads the script aloud with the browser's built-in Web Speech API (en-US); without a Chinese voice pack, the script can still be read or passed to a TTS tool.
Module 0 · Preparation: governance lab project (complete before class)
- An existing Azure DevOps organization
https://dev.azure.com/<org>and projectmyapp-lab(created in lesson 1), repositorymyapp(Flask + gunicorn + Redis,/healthz), pipelinemyapp-ci(lesson 2), environmentmyapp-dev,myapp-prodworkload identity federation service connectionsc-myapp-azure(lesson 3), template repositorypipeline-templates(lesson 5). - Roles: organization-level policies require Project Collection Administrator (PCA); tenant-level policies (restrict organization creation, restrict global/full-scoped PATs, maximum lifespan, automatic revocation of leaked PATs) require the Entra Azure DevOps Administrator role; creating Conditional Access policies requires at least Conditional Access Administrator.
- Entra tenant: the organization should connect to Microsoft Entra ID. Auditing, PAT organization policies, “Restrict PAT creation” and similar features all require an Entra-supported organization. A personal MSA organization can first create a free developer tenant or use a company test tenant.
- Azure subscription: resource group
rg-ado-lab(regioncanadacentral), used for Key Vault and the Log Analytics workspace. - Local machine: Azure CLI 2.6x+ and
azure-devopsextension (az extension add --name azure-devops),jq,curl.
Environment variables and sign-in (reused by all later commands)
# Shared variables (adjust for your environment) export ORG=https://dev.azure.com/<org> export ORGNAME=<org> export PROJ=myapp-lab export RG=rg-ado-lab export LOC=canadacentral az login # Interactive sign-in, satisfies Conditional Access (MFA) az devops configure --defaults organization=$ORG project=$PROJ # Call the Azure DevOps REST API with an Entra token instead of a PAT (resource ID is fixed) 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
Note:499b84ac-1321-427f-aa17-267ca6975798 is the Azure DevOps resource (application) ID in Entra, and Conditional Access policies also target it. Entra access tokens expire after about 1 hour; after expiry, rerun get-access-token the command; this is one reason it is safer than a PAT.
Create an Entra group for this lesson (authorize by group, not by individual)
# Requires permission to create groups in Entra; if you lack it, ask an admin to create it
az ad group create --display-name grp-ado-myapp-contributors --mail-nickname grp-ado-myapp-contributors
az ad group create --display-name grp-ado-myapp-approvers --mail-nickname grp-ado-myapp-approvers
az ad group create --display-name grp-ado-pat-exempt --mail-nickname grp-ado-pat-exempt
az ad group member add --group grp-ado-myapp-approvers --member-id $(az ad signed-in-user show --query id -o tsv)
az ad group list --display-name grp-ado- --query "[].{name:displayName,id:id}" -o table
Name Id --------------------------- ------------------------------------ grp-ado-myapp-contributors 3f0c…-… grp-ado-myapp-approvers 9a41…-… grp-ado-pat-exempt c27e…-…
Continuity with the previous lesson
pipeline-templatesIn the repositorytemplates/secure-deploy.yml(the extends template from lesson 5); this lesson enforces it in m6 with a “Required template check”.- Environment
myapp-prod: lesson 3 added a simple approval; this lesson adds branch control, required templates and exclusive lock. - Service connection
sc-myapp-azure(workload identity federation, subject in the formsc://<org>/myapp-lab/sc-myapp-azure).
- Key Vault
kv-myapp-lab-<suffix>(RBAC mode) and variable groupvg-myapp-kv. - Log Analytics workspace
law-ado-audit(audit stream target). - Estimated cost: Key Vault Standard tier is billed per operation, and lab usage is well under $1; Log Analytics is billed by ingested volume, and audit event volume is very small, usually under $1 per month; GHAzDO is billed per active committer (see m5; open-source alternatives avoid the cost).
Governance maturity self-assessment (tick what your organization already does)
Module 1 · Organization governance and Entra ID integration
- Explain the changes that come with connecting the organization to Microsoft Entra ID: unified account lifecycle, group-based authorization, Conditional Access, and the prerequisites for auditing and PAT policies.
- Create Conditional Access policies for Azure DevOps resources, understand how enforcement differs between web (interactive) and PAT/REST (non-interactive) flows, and the switch “IP Conditional Access policy validation on non-interactive flows”.
- Explain each setting on the organization policies page: third-party OAuth, SSH authentication, validate SSH key expiration, log audit events, restrict PAT creation, allow public projects, external guest access, allow team/project administrators to invite new users, request access; and the tenant-level “Restrict organization creation”.
What: where Azure DevOps identities come from
At any moment, each Azure DevOps organization trusts only one identity source: either a Microsoft account (MSA, a personal account) or one Microsoft Entra tenant. After connecting Entra, users sign in with their work accounts, and organization membership can be managed through Entra groups, and a person disabled in Entra can no longer access Azure DevOps.
- Where to connect: Organization settings Microsoft Entra › Connect directory. The operator must be the PCA of this organization and a member of the target Entra tenant.
- Impact after connecting: existing MSA users must be mapped to Entra accounts (unmapped users lose access); PATs and SSH keys must be re-established after identity mapping; afterward you can add Entra groups directly to Azure DevOps security groups and “group rules” (which assign access levels automatically).
- Features that depend on Entra: Conditional Access, auditing, organization-level “Restrict PAT creation”, tenant-level PAT policies, “Restrict organization creation”, and IP Conditional Access validation on non-interactive flows.
Why: why enterprises must do this
Organizations without Entra can only add people one by one, and cannot enforce MFA, device compliance or network location. Auditing directly requires Entra. More importantly, governance needs to be provable: who accessed code and pipelines, under what conditions and with which identity. This depends on Entra sign-in logs working together with Azure DevOps audit logs (Azure DevOps itself does not record sign-in events).
How: how Conditional Access applies to Azure DevOps
| Flow | Example | Conditional Access behavior (official docs, 2026-03) |
|---|---|---|
| Interactive (web) | Browser opens dev.azure.com | At sign-in, Entra evaluates all policies: MFA, device compliance, location, etc.; the web authentication stack has moved to Entra tokens, so every interactive flow is subject to CA checks |
| Non-interactive | PAT calls to REST, Git over HTTPS, client credentials | PAT requests in Entra-supported organizations must satisfy sign-in policies; MFA can only be completed in interactive flows, so non-interactive requests that do not satisfy the policy are blocked; IP fencing the policy is only validated on PAT and other non-interactive calls after the organization policy “Enable IP Conditional Access policy validation on non-interactive flows” is turned on (IPv4/IPv6 supported) |
| Continuous access evaluation (CAE) | User disabled, password changed, IP changed | Azure DevOps supports CAE; when critical events occur, tokens can be revoked in near real time instead of waiting for expiry |
Policy target: In Entra Conditional Access, select the resource “Azure DevOps” (may also appear as “Microsoft Visual Studio Team Services”), resource ID 499b84ac-1321-427f-aa17-267ca6975798. From 2025-09 onward, Azure DevOps sign-in and token refresh no longer depend on the Azure Resource Manager (https://management.azure.com) audience; policies previously set for ARM or “Microsoft Azure classic deployment model”no longer cover Azure DevOps sign-in. You need a separate policy for Azure DevOps. However, “service connection creators” and “billing administrators” still need ARM access, so consider excluding them from ARM policies.
Organization policies explained item by item (Organization settings › Policies)
| Policy | Level | Default | Governance recommendation |
|---|---|---|---|
| Third-party application access through OAuth | Organization | New orgs default to off | Only affects legacy Azure DevOps OAuth apps, not Entra ID OAuth apps; keep off if nothing depends on it |
| SSH authentication | Organization | On | Organizations that do not use SSH can turn it off; after turning off, all SSH clones/pushes fail immediately (note that Azure DevOps SSH supports only RSA and does not support LFS) |
| Validate SSH key expiration | Organization | On | Keep on; sends notifications 7 days before expiry and once after expiry; when off, expired keys still work |
| Log audit events | Organization | Off | Turn on now (see m7) |
| Restrict personal access token (PAT) creation | Organization | Off | See m2; you can allow only packaging-scoped PATs, or allow Entra groups on the allow list |
| Allow public projects | Organization | — | Public projects have been announced as retiring,starting in 2027 existing public projects become private; keep off, and move open-source projects to GitHub |
| Additional protections when using public package registries | Organization | — | Azure Artifacts upstream behavior protection, against dependency confusion; recommended on |
| Enable IP Conditional Access policy validation on non-interactive flows | Organization | Off | Turn on when an IP fencing policy exists, so PAT/REST also respect network location |
| External guest access | Organization | — | After turning off, you can no longer invite Entra B2B guests; turn on when outsourced collaboration is needed, together with access reviews |
| Allow team and project administrators to invite new users | Organization | — | Recommended off; let PCAs or group rules add people centrally to avoid uncontrolled licensing |
| Request access | Organization | — | Can provide an internal request URL; turning it off reduces noise |
| Restrict organization creation | Tenant | Off | When on, only people on the allow list can create organizations under this tenant, preventing “shadow organizations” |
When: which tool to use when
- Require MFA / compliant devices: Entra Conditional Access (targeting the Azure DevOps resource; evaluate first in “report-only” mode).
- Require the corporate network: Conditional Access named locations + the organization policy “IP CA validation on non-interactive flows”. Watch out for VPN tunnels that make the sign-in page and API egress IPs differ.
- Reduce the attack surface: turn off unneeded authentication methods (OAuth, SSH, PAT creation).
Comparison with similar technologies
| Azure DevOps | GitHub Enterprise Cloud | GitLab | |
|---|---|---|---|
| Enterprise identity | Connect an Entra tenant (one per organization) | SAML SSO or Enterprise Managed Users (OIDC can work with Entra CA) | SAML / SCIM |
| Conditional Access | Native Entra CA support, including the non-interactive IP validation switch and CAE | With EMU + OIDC, the IdP's CA policies apply | Relies on validation at IdP sign-in |
| Organization policies | Organization settings › Policies | Enterprise policies | Admin Area › Settings |
Architecture diagram: identity and policy checkpoints a request passes through
Flowchart: steps and risk points for connecting an Entra tenant
Interactive evaluator: request path × organization policy × Conditional Access
Choose a request type and source conditions, toggle organization policy switches, then click “Evaluate request”. The evaluation order mirrors the real path: whether the authentication method is allowed by the organization → Entra Conditional Access (interactive vs non-interactive differences) → organization/project permissions.
Core operations and scriptable interfaces
| Operation | Location / command | Notes |
|---|---|---|
| View the Entra tenant connected to the organization | Organization settings › Microsoft Entra | Shows the tenant name and ID; you can download the “disconnected users” list |
| Organization policy switches | Organization settings › Policies | Requires PCA; tenant policies require Azure DevOps Administrator (on the Microsoft Entra page) |
| Create Conditional Access policy | entra.microsoft.com › Entra ID › Conditional Access › Policies | Target resource: Azure DevOps; start with Report-only |
| Add Entra group to a project group | az devops security group membership add | Requires the Entra group's descriptor |
| Grant access level via group rules | Organization settings › Users › Group rules (or az devops user manage individual users) | Map Entra groups to Basic/Stakeholder and projects |
| View users' recent access | az devops user list | lastAccessedDate Used to clean up inactive users |
# 1. Find the project's Contributors group and the Entra group's descriptor
PROJ_CONTRIB=$(az devops security group list --project $PROJ \
--query "graphGroups[?displayName=='Contributors'].descriptor" -o tsv)
AAD_GROUP_ID=$(az ad group show --group grp-ado-myapp-contributors --query id -o tsv)
# Before first reference, an Entra group must be “materialized” in ADO: create the reference by originId with the Graph API
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"https://vssps.dev.azure.com/$ORGNAME/_apis/graph/groups?groupDescriptors=$PROJ_CONTRIB&api-version=7.1-preview.1" \
-d "{\"originId\":\"$AAD_GROUP_ID\"}" | jq '{displayName, origin, descriptor}'
{
"displayName": "grp-ado-myapp-contributors",
"origin": "aad",
"descriptor": "aadgp.Uy0xLTkt…"
}
Note: The Graph API groupDescriptors parameter adds the Entra group to Contributors while creating the reference. How to verify: Project settings › Permissions › Contributors › Members should show the Entra group. Common errors: If the organization is not connected to Entra, or the token's tenant does not match the organization's tenant, you get errors such as “identity not found / not authorized”.
# 2. List users, access levels and last access times to find people who have not accessed in 90 days az devops user list --top 500 -o json | jq -r ' .members[] | [.user.principalName, .accessLevel.licenseDisplayName, .lastAccessedDate] | @tsv' \ | sort -k3 | head
contractor1@fabrikam.com Basic 2026-06-02T08:11:45Z alice@fabrikam.com Basic 2026-11-14T22:40:03Z build-sp (service principal) Basic 2026-11-15T03:01:10Z
Minimal working Conditional Access policy configuration (text version)
Name: CA-ADO-RequireMFA Users: include All users; exclude break-glass accounts Target resource: Azure DevOps (499b84ac-1321-427f-aa17-267ca6975798) Grant: Grant access → Require authentication strength → Multifactor authentication State: Report-only (observe sign-in logs for 1–2 weeks, then switch to On)
Production use: Create another policy “allow only corporate named locations”, and turn on “IP CA validation on non-interactive flows” in organization policies so PAT calls are also bound by network restrictions.
Lab 1: verify the Entra connection, tighten organization policies, authorize with an Entra group (about 6 min)
# Use an Entra token to confirm the current identity can access the organization
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/_apis/connectionData" | jq '{user: .authenticatedUser.providerDisplayName, instanceId}'
{ "user": "Andy Example", "instanceId": "8b5c…" }git ls-remote git@ssh.dev.azure.com:v3/$ORGNAME/$PROJ/myapp 2>&1 | head -3
remote: Public key authentication failed. fatal: Could not read from remote repository.
After verifying, if your daily work depends on SSH, turn the switch back on.
grp-ado-myapp-contributors to myapp-lab's Contributors. Then go to Organization settings › Users › Group rules create a rule: Group grp-ado-myapp-contributors → access level Basic → project myapp-lab (Contributors).CA-ADO-RequireMFA, set the state to Report-only. Then sign in to dev.azure.com in a private window and check the “Report-only: Success/Failure” result for this policy in the Entra sign-in logs.curl -s -H "Authorization: Bearer $ADO_TOKEN" \ "https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/auditlog?batchSize=20&api-version=7.1-preview.1" \ | jq -r '.decoratedAuditLogEntries[] | [.timestamp, .actionId, .details] | @tsv' | head
2026-11-15T14:02:11Z OrganizationPolicy.PolicyValueUpdated Policy "Allow public projects" was changed to Off 2026-11-15T14:01:57Z OrganizationPolicy.PolicyValueUpdated Policy "Third-party application access via OAuth" was changed to Off
Actual actionId names and details text depend on your organization's output; use _apis/audit/actions to list all actionIds your organization can generate.
Case 1: merging identity sources after an acquisition
Problem: The acquired company's Azure DevOps organization uses MSA accounts; 200 developers need to move to the parent company's Entra tenant without interrupting CI. Approach: First export the user list and PAT dependency inventory; prepare identities in Entra via B2B or new accounts; in the weekend maintenance window, connect the directory and map each user with “Map disconnected users”; change pipeline service connections to workload identity federation (lesson 3) to avoid depending on personal PATs. Limitations: Each organization can connect only one tenant at a time; before mapping, personal PAT/SSH keys become invalid.
Case 2: a nightly sync script failed after Conditional Access went live
Problem: After enabling a CA policy that requires MFA, a ticket sync script that called REST with a personal PAT failed overnight. Approach: First observe in report-only mode and see that non-interactive flows are blocked; migrate the script to a service principal + Entra token (m2), and set a separate CA policy for the service principal as a workload identity (workload identity CA requires the appropriate license). Limitations: MFA cannot be satisfied in non-interactive flows; you can only change the identity or exclude it.
Case 3: preventing “shadow organizations”
Problem: The security team found 37 unmanaged Azure DevOps organizations under the tenant, some still containing public projects. Approach: Turn on the tenant policy Restrict organization creation, allowing only the platform team's Entra group to create organizations; for existing organizations, assign an owner to each, turn off public projects and turn on auditing; move public projects to GitHub before they become private in 2027. Configuration: In any organization connected to this tenant, go to Organization settings › Microsoft Entra › tenant policies (requires the Azure DevOps Administrator role).
Common errors and fixes
AADSTS53003: Access has been blocked by Conditional Access policies.
Cause: An Entra Conditional Access policy blocked this sign-in (location, device or client does not meet requirements).
Diagnosis: Entra admin center › Sign-in logs; filter by user and time, and check the “Conditional Access” tab for which policy shows Failure.
Fix: Meet the requirements (corporate network / compliant device), or have a CA admin adjust the policy; break-glass accounts should be excluded.
TF400813: The user '…' is not authorized to access this resource. (old account signing in after connecting Entra)
Cause: The user is still signing in with MSA, or their MSA identity has not yet been mapped to an Entra account.
Fix: Organization settings › Microsoft Entra › download/map disconnected users; have the user sign in again with their Entra account.
PAT calls to REST return 401 while browser access works (after enabling IP CA validation)
Cause:“IP CA policy validation on non-interactive flows” is on, but the script's egress IP (for example IPv6 or a VPN split tunnel) is not in a named location.
curl -s https://api64.ipify.org; echo; curl -s https://api.ipify.org; echo
Fix: Add the actual egress IPv4/IPv6 (and the IPv4-mapped address for IPv6) to a named location, or run the script from a fixed egress.
git@ssh.dev.azure.com: Permission denied (publickey) / Public key authentication failed
Cause: The organization turned off SSH authentication; or the SSH key has expired and expiry validation is on; or a non-RSA key such as ed25519 is used (Azure DevOps supports only RSA).
Fix: Check organization policies; regenerate an RSA key and upload it; or switch to HTTPS + GCM (OAuth).
When inviting external users you get: cannot be added: External guest access is disabled
Cause: The organization policy “External guest access” is off.
Fix: Have a PCA turn it on only when really needed, and set up Entra access reviews for guests (m2); turn it off afterward.
1. Without using a PAT, obtain a token that can call the Azure DevOps REST API.
az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv
2. List the 10 users in the organization with the oldest last-access times.
az devops user list --top 500 -o json | jq -r '.members[] | [.lastAccessedDate, .user.principalName] | @tsv' | sort | head -10
The security team requires that “all access to Azure DevOps must come from the corporate network”, including PAT calls. What do you need to configure? What are the side effects?
① Entra Conditional Access: target resource Azure DevOps, block when the location is not a corporate named location; start with Report-only. ② Turn on the organization policy Enable IP Conditional Access policy validation on non-interactive flows, otherwise PAT and other non-interactive calls do not validate IP. Side effects: Microsoft-hosted agents and cloud integrations (SaaS tools) fail when their egress IPs are not in a named location — pipelines use the job access token internally, but external SaaS calling the Azure DevOps REST API needs a fixed egress or a different identity; VPN split tunnels and IPv6 egress must be added as well.
Verified teaching videos
Official documentation
- Change application connection and security policies for organizations
- Conditional Access policies on Azure DevOps
- Connect your organization to Microsoft Entra ID
- Restrict organization creation via tenant policy
Video storyboard (about 90 seconds)
This courseware cannot generate video/MP3 directly; a storyboard and narration script are provided for a video tool to produce them.
Visual: four clients (browser, PAT script, SSH, OAuth app) rush toward one gate labeled “Azure DevOps organization”.
Narration: before entering the organization, every request passes two checkpoints: Entra identity and Conditional Access, and organization policies.
Visual: the browser request brings up an MFA prompt; the PAT request gets no popup and is blocked directly by a red barrier.
Narration: MFA can only be completed in interactive flows. A PAT call that does not meet the policy does not prompt for verification; it is simply rejected.
Visual: the organization policy panel; the OAuth, SSH and external guest switches turn off one by one, and the corresponding clients turn gray.
Narration: turning off unneeded authentication methods shrinks the attack surface. Third-party OAuth is already off by default in new organizations.
Visual: the calendar flips to 2027, and the lock on the “Public projects” icon closes.
Narration: public projects have been announced as retiring and will become private starting in 2027. Please move open-source projects to GitHub.
Module 2 · PAT, identity and access governance
- Explain the impact of the global PAT retirement and its two official dates, and plan a migration to organization-scoped PATs or Entra authentication.
- Distinguish tenant-level PAT policies (restrict global PATs, restrict full-scoped PATs, enforce maximum lifespan, automatically revoke leaked PATs) from the organization-level “Restrict PAT creation” (including packaging-scope-only and allow lists).
- Migrate automation identities to service principals or managed identities: join the organization, assign access levels, obtain Entra tokens to call REST; complete user access governance with audit events and Entra access reviews.
What: what a PAT actually is
A PAT (Personal Access Token) is the user's “backup password”, sent in an HTTP Basic header (the username can be empty,:{PAT} Base64-encoded) to access Azure DevOps. It always belongs to the user who created it, its permissions can never exceed that user's; you can limit the organization, scopes and expiry. The new-format PAT is 84 characters (including 52 random characters), and positions 76–80 always contain AZDO a signature, so secret scanning can identify it.
Why: why it needs governance
- A PAT is a long-lived bearer credential that works once leaked; it bypasses interactive MFA.
- Official position (PAT docs, 2026-09): Avoid PATs; apps and automation should prefer Microsoft Entra tokens, managed identities or service principals; only when a tool does not support Entra, use organization-scoped, minimum-scope, shortest-lived PATs.
- The audit log records only PAT lifecycle events (created, modified, revoked, expired, found in a public repository, system-revoked),and does not record PAT usage, so audit logs cannot tell you whether a PAT is still in use.
Global PAT retirement: know both dates
| Source | Wording |
|---|---|
| “Important” notice at the top of the PAT doc (links to the sprint 270 release notes) | Existing global PATs: 2027-01-27 — they stop working. |
| “Best practices › Create PATs” section of the same doc; sprint 270 release notes (verified against other courseware in this repository) | Global PATs: 2026-12-01 — they stop working. |
How: PAT policy matrix
| Policy | Level / location | Required role | Default | Effect |
|---|---|---|---|---|
| Restrict global personal access token creation | Tenant · Organization settings › Microsoft Entra | Azure DevOps Administrator | Off | New PATs must be bound to a specific organization |
| Restrict full-scoped personal access token creation | Tenant | Same as above | Off | New PATs must select custom scopes |
| Enforce maximum personal access token lifespan | Tenant | Same as above | Off | Set the maximum lifespan of new PATs in days |
| Automatically revoke leaked personal access tokens | Tenant | Same as above | On | PATs found in public GitHub repositories are automatically revoked and the user is notified; when off, only notify without revoking |
| Restrict personal access token (PAT) creation | Organization · Organization settings › Policies | PCA | Off | Prohibit creating/regenerating PATs; sub-options: allow only packaging-scope PATs, allow any scope for Entra users/groups on the allow list; also block GCM from auto-generating PATs |
- Applies only to new creation or renewal: existing PATs remain valid for their remaining lifetime; renewals must comply with the new policy.
- Use groups for allow lists: each policy has its own allow list; the official guidance is to use groups rather than individuals (individual identity references are stored in the US, EU and Singapore).
- Entra-enabled organizations: a new PAT becomes inactive if not used to sign in within 90 days; Conditional Access sign-in frequency may also require full re-authentication.
Non-human identities: service principals and managed identities
| Identity | Use case | How to get a token | Notes |
|---|---|---|---|
| User + Entra token | One-off commands, local scripts | az account get-access-token --resource 499b84ac-… | Expires in about 1 hour; satisfies CA |
| Service principal (app registration) | External systems, cross-organization automation | Client credentials flow; preferably use federated credentials (keyless) | The SP must first be added to the organization and given an access level and permissions; an SP cannot create or manage PATs |
| Managed identity | Services running on Azure (Functions, VMs, self-hosted agents) | Get tokens via IMDS; same resource as above | Keyless; also needs to be added to the organization |
| Pipeline job access token | Pipeline internal calls to ADO | $(System.AccessToken) | Subject to “Limit job authorization scope” (m3) |
| Azure DevOps service connection (WIF) | Pipelines accessing Azure Repos and others across organizations | Service connection + workload identity federation | Officially recommended to replace PATs for cross-organization access |
When: user access reviews
- Use Entra groups to grant access, then run Entra access reviews (Access reviews; requires the appropriate Entra ID Governance license); review external guests separately.
- Monthly, use
az devops user listtolastAccessedDateclean up inactive users and reclaim Basic licenses (the first 5 are free, then $6 per user per month). - Offboarding: disable the account in Entra → revoke its PATs with the Token Administration API → review the service connections and pipelines it owns. Note: after the account is disabled, its PATs can no longer access the organization, but Azure DevOps does not automatically delete PATs; if the account is restored, unexpired PATs become valid again.
Decision diagram: which identity should automation use
Timeline: PAT policies take effect and global PAT retirement
Interactive evaluator: can this PAT be created?
On the left is the PAT the user wants to create; on the right are the tenant and organization policies. Click “Try to create”; the evaluator checks in real order: organization-level restrictions → global → full scope → maximum lifespan. You can also simulate “leaked to a public GitHub repository”.
Core commands and APIs
| Purpose | Command / API | Notes |
|---|---|---|
| Entra token | az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 | Available after a user or SP signs in |
| List your own PATs | GET https://vssps.dev.azure.com/{org}/_apis/tokens/pats?api-version=7.1 | PAT Lifecycle API; must use a user-delegated Entra token (scope vso.pats) |
| Create PAT | POST …/_apis/tokens/pats | body: displayName,scope,validTo,allOrgs:false |
| Revoke PAT | DELETE …/_apis/tokens/pats?authorizationId=… | Rotation = create new → update dependencies → test → revoke old one |
| Admin revokes a user's PAT | Token Administration API | For offboarding; requires admin permissions |
| Audit PAT events | Token.PatCreateEvent,Token.PatUpdateEvent,Token.PatRevokeEvent,Token.PatExpiredEvent,Token.PatPublicDiscoveryEvent,Token.PatSystemRevokeEvent | Filter in Organization settings › Auditing |
# Use an Entra token to list your own PATs, and find global (allOrgs) and long-lived PATs curl -s -H "Authorization: Bearer $ADO_TOKEN" \ "https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \ | jq -r '.patTokens[] | [.displayName, .targetAccounts==null, .scope, .validTo] | @tsv'
git: https://dev.azure.com/myorg on LAPTOP-7 false vso.code_write 2026-12-20T00:00:00Z legacy-sync true app_token 2027-06-01T00:00:00Z
How to read it: A true in the second column means no organization is bound (a global PAT); app_token fullScope indicates full scope. Action: legacy-sync is both global and full-scope and should be migrated immediately. Field names follow what the API actually returns.
# Create a single-organization, minimum-scope, 30-day PAT (only do this when a tool truly does not support Entra)
VALID_TO=$(date -u -d "+30 days" +%Y-%m-%dT%H:%M:%SZ)
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \
-d "{\"displayName\":\"lab-code-read\",\"scope\":\"vso.code\",\"validTo\":\"$VALID_TO\",\"allOrgs\":false}" \
| jq '{name: .patToken.displayName, validTo: .patToken.validTo, err: .patTokenError}'
{ "name": "lab-code-read", "validTo": "2026-12-15T…Z", "err": "none" }
Service principal as an Azure DevOps identity
# 1) Create an app and SP in Entra (lab uses a secret; for production use federated credentials or managed identities) az ad sp create-for-rbac --name sp-ado-myapp-automation --skip-assignment -o json > sp.json # 2) In Azure DevOps: Organization settings › Users › Add users, search for sp-ado-myapp-automation, # access level Basic (or Stakeholder), project myapp-lab, group Readers # 3) Sign in as the SP and get a token az login --service-principal -u $(jq -r .appId sp.json) -p $(jq -r .password sp.json) \ --tenant $(jq -r .tenant sp.json) --allow-no-subscriptions SP_TOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv) curl -s -H "Authorization: Bearer $SP_TOKEN" "$ORG/$PROJ/_apis/build/builds?\$top=3&api-version=7.1" | jq -r '.value[].buildNumber' shred -u sp.json 2>/dev/null || rm -f sp.json
20261115.3 20261115.2 20261114.1
Common errors: If the SP has not joined the organization, you get 401 with an identity-not-found message; if it has joined but is not in the project group, you get 403/TF401019.
Lab 2: PAT policies, service principal and access reviews (about 6 min)
grp-ado-pat-exempt. Confirm that Automatically revoke leaked PATs = On.curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \
-d '{"displayName":"should-fail","scope":"app_token","validTo":"2027-11-01T00:00:00Z","allOrgs":true}' | jq '.patTokenError'
"globalPatPolicyViolation"
The error enum value follows what the API actually returns (it may be one of the violations for global, full scope, or lifespan).
grp-ado-pat-exempt allow any scope, then turn on the main switch. Verify with an account not on the allow list: the creation page only offers packaging scope.sp-ado-myapp-automation, add it to the organization (Readers), and read the build list with an Entra token.grp-ado-myapp-contributors quarterly reviews (reviewer: group owner; non-responses are removed automatically). Without this license, at least export monthly az devops user list and review manually.lab-code-read PAT; after the lab, delete the SP: az ad sp delete --id <appId>, and remove it on the Users page.Case 1: zeroing out global PATs
Problem: A company has 4 organizations and found 312 global PATs, 40% of which are used for IDE plugins and GCM, with the rest used for scripts. Approach: First turn on “Restrict global PAT creation” to stop the bleeding; switch GCM users to OAuth (since GCM 3.0, Azure Repos defaults to OAuth); migrate scripts to service principals or managed identities; convert remaining tools to single-organization PATs and register them; push to finish by the 2026-12-01 deadline. Limitation: The PAT Lifecycle API can only manage the caller's own PATs; admins use the Token Administration API to handle others'.
Case 2: nightly build failed after a leaked PAT was automatically revoked
Problem: A developer pushed a PAT-containing .npmrc to a personal public GitHub repository; Azure DevOps detected it and revoked it automatically, causing the packaging pipeline that depended on it to fail. Approach: This is the expected behavior; change the pipeline to use npmAuthenticate@0 a task (using the job token) instead of a PAT; search the audit log for Token.PatPublicDiscoveryEvent and Token.PatSystemRevokeEvent review the incident. Configuration: Keep “Automatically revoke leaked PATs” on; also enable GHAzDO push protection (m5) to block at the source.
Case 3: contractor still had access after leaving
Problem: A contractor was added directly as an organization user (not via an Entra group), and nobody removed them after they left. Approach: Switch to authorization via “group rules + Entra groups”; put external guests in a separate group with quarterly access reviews; add PAT revocation and a check of owned service connections to the offboarding process. Limitation: Changes to Entra group membership do not appear in the Azure DevOps audit log; check the Entra audit logs instead.
Common errors and fixes
Symptom: when creating a PAT, you get a message that the organization/tenant policy does not allow “All accessible organizations” (global PAT)
Cause: The tenant policy “Restrict global PAT creation” is on.
Fix: Select a single organization; people who truly need a global PAT join the allow-list group (this should be very few).
Symptom: when creating or renewing a PAT, you get a message that the expiry exceeds the maximum lifespan allowed by policy
Cause: The “Enforce maximum PAT lifespan” limit.
Fix: Shorten the lifetime; set up a rotation process before expiry (you receive an email before a PAT expires).
TF400813 / HTTP 401: PAT suddenly stops working
Possible causes: Expired; revoked by the user or system (leak); inactive after 90 days unused; user disabled or removed from the organization; Conditional Access requires re-sign-in; global PAT blocked by the organization-level “Restrict PAT creation”.
curl -s -o /dev/null -w "%{http_code}\n" -u ":$AZURE_DEVOPS_PAT" "$ORG/_apis/projects?api-version=7.1"
Fix: Check the audit log for Token.* events to determine the cause; create a compliant PAT or migrate to Entra authentication.
Service principal calls to REST return 401: TF400813 / identity not found
Cause: The SP has not been added to the organization, or the wrong token resource was used (for example, ARM's https://management.azure.com).
Fix: Add the SP under Organization settings › Users; the token resource must be 499b84ac-1321-427f-aa17-267ca6975798.
PAT Lifecycle API returns that admin consent is required (admin approval required)
Cause: The tenant requires admin consent for Entra apps to access organization resources.
Fix: Ask the tenant admin to grant consent; or manage PATs manually in the web UI.
1. Use an Entra token to list the names and expiry dates of all your PATs.
curl -s -H "Authorization: Bearer $(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)" \ "https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" | jq -r '.patTokens[] | "\(.displayName)\t\(.validTo)"'
2. Use a PAT to quickly check whether it is still valid (look only at the HTTP status code).
curl -s -o /dev/null -w "%{http_code}\n" -u ":$AZURE_DEVOPS_PAT" "$ORG/_apis/projects?api-version=7.1"You turned on “maximum lifespan 90 days”. A week later, a backup script using a two-year global PAT is still running normally, and the audit team questions whether the policy works. How do you explain and handle this?
PAT policies apply only to newly created or renewed PATs; existing PATs remain valid for their remaining lifetime, so the policy has not failed. Handling: ① use the PAT list API or register to find the owner of that PAT; ② migrate the script to a service principal or managed identity; ③ global PATs stop working on the official retirement date (2026-12-01 or 2027-01-27; follow the latest release notes), so finish the migration before then; ④ turning on the organization-level “Restrict PAT creation” also immediately blocks global PATs in that organization (except the allow list); it can serve as an enforcement measure, but notify people first.
Verified teaching videos
Official documentation
- Use personal access tokens
- Manage personal access tokens using policies
- Use service principals & managed identities
- Sprint 270 release notes (global PAT retirement)
Video storyboard (about 90 seconds)
Visual: a key engraved with “PAT · all organizations · all permissions · 2 years” falls from a pocket into a public GitHub repository.
Narration: a PAT is the user's backup password. A global, full-scope, long-lived PAT is a master key once it leaks.
Visual: three switches light up in turn: restrict global, restrict full scope, maximum ninety days; the key is cut into “single organization, read-only code, thirty days”.
Narration: tenant-level policies make new PATs shorter, narrower and bound to a single organization. Existing PATs are not affected; they only need to comply when renewed.
Visual: two red circles on a calendar: December 1, 2026 and January 27, 2027.
Narration: global PATs are being retired, and the official docs show two dates. Complete the migration by the earlier date.
Visual: the script icon gets “service principal” and “managed identity” badges and walks through the gate holding a one-hour Entra token.
Narration: automation should use Entra tokens — service principals or managed identities — with no long-lived secrets and protected by Conditional Access.
Module 3 · Pipeline security: protected resources and checks
- List the six types of protected resources (service connections, agent pools, environments, variable groups, secure files, repositories), and distinguish three control layers: “security roles”, “pipeline permissions (authorization)” and “approvals and checks”.
- State the five check categories in official order: static checks (branch control, required template, evaluate artifact) → pre-check approvals → dynamic checks (approval, invoke Azure Function, invoke REST API, business hours, query Azure Monitor alerts) → post-check approvals → exclusive lock.
- Turn on and explain the organization-level pipeline settings: limit job authorization scope (non-release / release), protect access to repositories in YAML pipelines, limit variables that can be set at queue time, shell task argument validation, and disallow creating classic pipelines; configure secret and approval protections for fork PRs.
What: protected resources and the three control layers
The “real infrastructure” pipelines depend on is abstracted in Azure Pipelines as protected resources (protected resources). The official docs list the objects that checks can be configured on: environments, service connections, repositories, variable groups, secure files, agent pools. Each resource has three layers of control:
| Layer | Question answered | Who configures it | Location |
|---|---|---|---|
| ① Security role (Security) | Who can manage or use this resource (Reader / User / Creator / Administrator) | Resource administrator | Resource › Security |
| ② Pipeline permissions (Pipeline permissions) | Which YAML pipelines are authorized to use it (“Open access” or specified pipelines) | Resource administrator | Resource › Pipeline permissions |
| ③ Approvals and checks (Approvals and checks) | In this stage of this run, what conditions must be met before using it | Resource owner | Resource › Approvals and checks |
Key design: Approvals and checks are not written in YAML, so anyone who edits the YAML cannot change or bypass them. Before a stage starts, Azure Pipelines pauses the run and collects the checks on all resources used by all jobs in that stage; all must pass before the stage starts. If any check fails terminally (for example, an approval is rejected), the stage does not run; if not all checks pass before timeout, the stage is skipped or fails.
The five check categories and execution order (official docs)
| Order | Category | Includes | Notes |
|---|---|---|---|
| 1 | Static checks | Branch control, Required template, Evaluate artifact | Independent of people, decided immediately; branch names must be written in the form refs/heads/main |
| 2 | Pre-check approvals | Approval | Approvals that need a person to confirm before dynamic checks |
| 3 | Dynamic checks | Approval, Invoke Azure Function, Invoke REST API, Business Hours, Query Azure Monitor alerts | Re-evaluated at the “evaluation interval” until timeout |
| 4 | Post-check approvals | Approval | For example, wait until automated checks pass before the change manager approves |
| 5 | Exclusive lock | lockBehavior: runLatest (default) or sequential | only one stage may use the same resource at any given time |
- Within the same category, checks run in creation order; the execution order is visible on the resource's Approvals and checks page.
- Approvals: when a group is specified, any one member of the group can approve; you can prevent approvers from approving runs they triggered; the approver list is fixed when the check starts; supports deferring approvals (Defer approval).
- Branch control: all linked resources (including
resourcesother repositories/pipelines in it) must have their source branches on the allow list; you can require the branch to be “protected” (at least one policy, including GHAzDO push protection). - Required template: the pipeline must
extendsspecify the template's repo/ref/path, otherwise the check fails (see m6 for details). - Bypass: resource administrators can skip approvals, business hours, and Function/REST invocation checks Bypass check (for hotfix scenarios), the Checks panel records who bypassed them.
- service connection cannot be set via a variable (otherwise the checks to evaluate cannot be determined at compile time).
Why: why organization-level pipeline settings matter
| Settings (Organization/Project settings › Pipelines › Settings) | Effect |
|---|---|
| Limit job authorization scope to current project for non-release pipelines | Job access token usage Project-level build identity, can only access this project's resources; check this especially for organizations created before 2019-08 |
| Limit job authorization scope to current project for release pipelines | Same as above, applies to classic release pipelines. |
| Protect access to repositories in YAML pipelines | Protect access to repositories in YAML pipelines Any Azure Repos repositories must be explicitly authorized (the first run prompts for “Permit”); in scripts, the git clone other repository fails, change it to checkout:; not applicable to GitHub repositories. |
| Limit variables that can be set at queue time | At queue time, only variables marked “Settable at queue time / Let users override” can be set, which prevents overriding system variables. |
| Enable shell tasks arguments validation | validates the arguments of built-in shell tasks such as Bash, PowerShell, BatchScript, Ssh, AzureCLI, and AzurePowerShell arguments, blocking command injection through semicolons, quotes, parentheses, and similar characters. |
| Disable creation of classic build / release pipelines | New organizations already have this disabled by default; it reduces the risk of YAML and classic pipelines sharing resources. |
| Task restrictions (Disable Marketplace tasks / built-in tasks) | Controls where runnable tasks come from; note that GHAzDO scanning tasks come from Marketplace. |
Once it is turned on at the organization level: once enabled, projects cannot turn it off; if it is not enabled at the organization level, a project can enable it itself.
When: fork PRs (public GitHub repositories)
- Enabled by default; configure it together with Limit building pull requests from forked GitHub repositories the Disable building pull requests from forked repositories (Project/Organization settings › Pipelines › Settings › Triggers).
- To build forks, choose Securely build pull requests from forked repositories: do not provide secrets, do not use the same permissions as regular builds, and require a team member to comment on the PR before the build is triggered. Or Customize rules configure it in detail.
- In the pipeline trigger, keep “Make secrets available to builds of forks” and “Make fork builds have the same permissions as regular builds” unchecked; use Microsoft-hosted agents for fork builds where possible.
Compared with similar technologies
| Azure Pipelines | GitHub Actions | |
|---|---|---|
| Where deployment gates attach | Resources (environments/service connections/variable groups/secure files/repositories/agent pools) | Environment (protection rules) |
| Check types | Approvals, branch control, required template, business hours, Function/REST, Azure Monitor, evaluate artifact, exclusive lock | Required reviewers, wait timer, deployment branches/tags, custom deployment protection rules |
| Enforced template | Required template check + extends | Required workflows / rulesets |
condition can replace approvals”—YAML is controlled by the committer and its conditions can be changed; approvals and checks are controlled by the resource owner, which is the real security boundary. ② “Granting access to all pipelines on the service connection is easier”—any pipeline (including YAML modified on a new branch) can then use it; specify pipelines instead. ③ “Checks are evaluated when the job starts”—they are evaluated before the stage starts; the stage begins only after its conditions are met. ④ “Changing the approver list updates runs that are already waiting”—no, the list is fixed when the check starts.Architecture diagram: who controls what
Flowchart: gate order before a stage starts
Core animation: the gate flow of a deployment run passing approvals and checks
Scenario: myapp-cd 's Deploy_Prod stage uses environment myapp-prod, service connection sc-myapp-azure and variable group vg-myapp-kv. Adjust the conditions below, then click “Play” or “Step” to see at which gate the request is allowed or blocked.
Core commands and REST API
| Purpose | Command / API | Notes |
|---|---|---|
| List service connections | az devops service-endpoint list --query "[].{name:name,id:id,shared:isShared}" | Get the resource ID |
| List environments | GET {org}/{project}/_apis/pipelines/environments?api-version=7.1 | Environment ID |
| View pipeline permissions | GET {org}/{project}/_apis/pipelines/pipelinepermissions/{type}/{id}?api-version=7.1-preview.1 | type: endpoint,queue,variablegroup,securefile,environment,repository |
| Authorize specific pipelines | PATCH Same as above, with the body {"pipelines":[{"id":N,"authorized":true}]} | Replaces Open access |
| View check configuration | GET {org}/{project}/_apis/pipelines/checks/configurations?resourceType=environment&resourceId={id}&$expand=settings&api-version=7.1-preview.1 | Export as a baseline for “checks as code” |
| View the status of checks on a run | Run page › Stage › “View checks” | Shows the status and bypass records of each check |
# 1. Environment and service connection IDs
ENV_ID=$(curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/$PROJ/_apis/pipelines/environments?name=myapp-prod&api-version=7.1" | jq -r '.value[0].id')
SC_ID=$(az devops service-endpoint list --query "[?name=='sc-myapp-azure'].id" -o tsv)
PIPE_ID=$(az pipelines show --name myapp-cd --query id -o tsv)
echo "env=$ENV_ID sc=$SC_ID pipeline=$PIPE_ID"
# 2. View the pipeline permissions of the service connection (check whether it is Open access)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$SC_ID?api-version=7.1-preview.1" \
| jq '{allPipelines: .allPipelines.authorized, pipelines: [.pipelines[].id]}'
env=3 sc=6a2f…-… pipeline=12
{ "allPipelines": true, "pipelines": [] }
Interpretation:allPipelines: true This means “Open access”: any pipeline can use this service connection, so it needs to be tightened.
# 3. Turn off Open access and authorize only myapp-cd
curl -s -X PATCH -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$SC_ID?api-version=7.1-preview.1" \
-d "{\"allPipelines\":{\"authorized\":false},\"pipelines\":[{\"id\":$PIPE_ID,\"authorized\":true}]}" \
| jq '{allPipelines: .allPipelines.authorized, pipelines: [.pipelines[].id]}'
# 4. Export the checks on the environment (for audit/backup)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/$PROJ/_apis/pipelines/checks/configurations?resourceType=environment&resourceId=$ENV_ID&\$expand=settings&api-version=7.1-preview.1" \
| jq -r '.value[] | [.type.name, .settings.displayName // "-", .timeout] | @tsv'
{ "allPipelines": false, "pipelines": [12] }
Approval - 43200
Task Check Branch control 1440
ExclusiveLock - 43200
Check type names and fields follow what the API actually returns; the timeout unit is minutes. Recommendation: Create the checks in the UI first, then export them with this API and archive them as the basis for change audits.
YAML side: exclusive lock and repository resource declaration
resources:
repositories:
- repository: templates # Subject to “Protect access to repositories”, requires authorization
type: git
name: myapp-lab/pipeline-templates
ref: refs/heads/main
stages:
- stage: Deploy_Prod
lockBehavior: sequential # Takes effect when Exclusive lock is configured on the resource
jobs:
- deployment: deploy
environment: myapp-prod # Protected resource → triggers the checks on it
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: AzureCLI@2
inputs:
azureSubscription: sc-myapp-azure # Cannot be specified with a variable
scriptType: bash
scriptLocation: inlineScript
inlineScript: az webapp list -g $(rg) -o table
Lab 3: Add a full set of gates to myapp-prod (about 7 minutes)
sc-myapp-azure from Open access to authorizing only myapp-cd; apply the same to vg-myapp-kv (created in m4) and the environment myapp-prod with the same change (types variablegroup,environment).- Approvals: approvers
grp-ado-myapp-approvers, select “Don’t allow approvers to approve their own runs”, timeout 1 day. - Branch control: allow
refs/heads/main,refs/heads/hotfix/*, select Verify branch protection. - Exclusive lock.
pipeline-templates, Ref refs/heads/main, Path templates/secure-deploy.yml.feature/login branch, run myapp-cd manually:
az pipelines run --name myapp-cd --branch feature/login --query "{id:id,state:state}"
Open the run: the Deploy_Prod stage shows Branch control failed in the Checks panel (the branch is not on the allow list), and the stage fails. Then run from main: static checks pass and it waits for approval; after a member of the other approval group approves, the stage starts.
Branch control ✗ Failed refs/heads/feature/login is not in the allowed list Required template ✓ Passed Approval ⏸ Skipped
git clone $(System.CollectionUri)$(System.TeamProject)/_git/pipeline-templates (using System.AccessToken), after running you should see TF401019; change it to checkout: templates and, on the first run, click Permit to authorize.Bash@3 (filePath mode) task and pass arguments: '$(userInput)', set the variable at queue time to a; rm -rf ~ (this variable must allow overriding at queue time); the run will fail with the message “Detected characters in arguments that may not be executed correctly by the shell…”.Case 1: malicious YAML on a branch misuses the production service connection
Problem: An insider modified the YAML on a new branch to reference the production service connection that had Open access, and ran az keyvault secret list. Approach: Restrict the service connection to specific pipelines; add branch control (allow only main/hotfix) and a required template; turn on “Limit job authorization scope”; search the service connection’s usage history (Usage history) in audit. Limitation: Branch protection has limits: anyone with Create Branch permission can push a new branch even without Contribute permission, so gates must be attached to the resource rather than relying on YAML.
Case 2: two deployments overwrite each other
Problem: Two merges triggered almost simultaneously; the older version finished deploying after the newer one and overwrote it. Approach: Add an Exclusive lock to the environment, and set the stage’s lockBehavior: runLatest: only the latest run gets the lock, and earlier queued runs are canceled. When every version must go live (such as database migrations), use sequential.
Case 3: change management system integration
Problem: Compliance requires that production deployments be linked to an approved change request. Approach: Add an Invoke REST API check on the environment to call the change management system (or use a check from the ServiceNow Change Management extension), use asynchronous callbacks in the officially recommended way so the decision is final, and write the change request number into the linked variable group so the check can read it (checks can only access predefined variables by default). Limitation: A non-zero “evaluation interval” makes the result of a synchronous check non-final, so you need to understand re-evaluation behavior.
Common errors and fixes
This pipeline needs permission to access a resource before this run can continue to Deploy_Prod
Cause: The pipeline has not been authorized to use a protected resource (service connection, environment, variable group, secure file, agent pool, or repository).
Fix: Someone with admin permission on the resource clicks View › Permit; or add the pipeline in the resource’s Pipeline permissions. Don’t take the shortcut of switching to Open access.
Checks: Branch control failed — the branch is not in the allowed list / branch is not protected
Cause: The branch of the run (or of another repository resource it references) is not on the allow list; the branch name is not fully written out (it must be refs/heads/…), or Verify branch protection is checked but the branch has no policy.
Fix: Correct the allow list format; add a branch policy for main (m6); use a wildcard for hotfix branches refs/heads/hotfix/*.
Required template check failed: the pipeline does not extend the required template
Cause: The YAML does not contain extends, or the extends repository/ref/path does not match the check configuration (for example, the ref points to a feature branch).
Fix: See m6 troubleshooting; use “Download full YAML” on the run page to view the actual expanded result.
remote: TF401019: The Git repository with name or identifier pipeline-templates does not exist or you do not have permissions for the operation you are attempting.
Cause:“Limit job authorization scope” or “Protect access to repositories” is turned on, and the script uses git clone to access other repositories or projects.
Fix: Declare it in the resources.repositories section and check it out with checkout:; for cross-project access, grant the pipeline’s project access to the target project and give the build identity Read permission on the target repository; submodules must first be checked out explicitly.
Detected characters in arguments that may not be executed correctly by the shell. Please escape special characters using backtick (`).
Cause: Shell argument validation is turned on, and the arguments contains semicolons, quotes, parentheses, and other characters that could inject commands.
Fix: Escape as the message indicates; a better approach is to change user input to typed runtime parameters (parameters + values allowlist), and pass them through env: to the script.
You can't set the following variables (X). If you want to be able to set these variables, then edit the pipeline and select Settable at queue time…
Cause:“Limit variables that can be set at queue time” is turned on.
Fix: In the pipeline variable, select Let users override this value when running this pipeline, or use runtime parameters instead.
1. Check whether service connection sc-myapp-azure is Open access.
SC_ID=$(az devops service-endpoint list --query "[?name=='sc-myapp-azure'].id" -o tsv) curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$SC_ID?api-version=7.1-preview.1" | jq '.allPipelines'
2. Export the types and timeouts of all checks on environment myapp-prod.
curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/pipelines/checks/configurations?resourceType=environment&resourceId=$ENV_ID&\$expand=settings&api-version=7.1-preview.1" | jq -r '.value[] | "\(.type.name)\t\(.timeout)"'
Environment myapp-prod has these configured: approval (group A), branch control, business hours, and an exclusive lock; the service connection has a required template. For a run started from main that does not use extends, at which step does it fail? Will the approvers receive a notification?
The checks on all resources are merged and run by category: static checks (branch control and required template) are evaluated first. The main branch passes, but the required template check fails (no extends). This is a terminal failure, so the stage fails immediately. Approval belongs to a later category, so the run never enters the waiting-for-approval state, and approvers usually do not need to act. This is the benefit of “static checks first”: it saves people’s attention.
Verified training videos
Official documentation
- Pipeline deployment approvals (check types and order)
- Protect resources and secure access
- Access repositories from pipelines
- Securely use variables and parameters
- Secure agents, projects, and containers
Video storyboard (about 100 seconds)
Visual: a train (the run) heads toward the “production station,” with five gates ahead: authorization, static checks, approval, dynamic checks, and exclusive lock.
Narration: before a deployment stage starts, it must first get resource authorization, then pass the five check categories in a fixed order.
Visual: a train coming from the feature branch is stopped by a red light at the first static-check gate.
Narration: static checks run first. If the branch is not on the allow list or the required template is not used, the run fails immediately, and approvers are never bothered.
Visual: the approver’s phone shows a notification and they tap Approve; the business-hours gate shows a clock; the exclusive-lock gate lets only one train through at a time.
Narration: any one person in the approval group can approve. The business-hours check waits for the time window, and the exclusive lock ensures only one deployment runs at a time.
Visual: a developer tries to delete a gate in the YAML, and the eraser bounces off.
Narration: checks are not written in the YAML, so whoever edits the YAML cannot bypass them. This is the separation of duties between developers and resource owners.
Module 4 · Secrets management: Key Vault variable groups and secure files
- Create a variable group linked to Azure Key Vault: understand that it “maps only names, reads the latest values at run time, requires manually updating the mapping when secrets are added or deleted, and supports only secrets, not keys or certificates.”
- Compare Key Vault variable groups with
AzureKeyVault@2tasks, regular secret variables, and secure files (10 MB each): their use cases and permission requirements (Get/List or Key Vault Secrets User). - Know how secret variables are masked, when masking fails (transformed, split, or encoded values), and why secrets must not be passed as template parameters.
What: the four sources of secrets in pipelines
| Source | Storage location | When read | Protected resource / checks | Best for |
|---|---|---|---|---|
| Pipeline secret variable (“Keep this value secret” in the UI) | Azure DevOps (encrypted) | Run time | No (tied to the pipeline) | A few secrets for a single pipeline |
| Variable group (with secret variables) | Azure DevOps Library | Run time | Yes (pipeline permissions, approvals and checks) | Shared across multiple pipelines |
| Key Vault-linked variable group | Azure Key Vault | Run time; latest value read from Key Vault | Yes | Recommended for enterprises: rotation happens in Key Vault, and pipelines automatically get the new value |
AzureKeyVault@2 Task | Azure Key Vault | At task execution time (can RunAsPreJob) | indirectly protected through service connections | retrieve only selected secrets on demand, dynamically selecting the Key Vault |
| Secure files | Azure DevOps (encrypted) | DownloadSecureFile@1 Downloaded to the agent | Yes | Certificates, keystores, config files; each ≤ 10 MB; cannot be edited after upload, only deleted and re-uploaded |
Key rules for Key Vault variable groups (official documentation)
- Only map the secret names to the variable group,values are not copied; each run reads the latest value from Key Vault — so after you rotate a secret in Key Vault, the next run picks it up automatically.
- In Key Vault adding or deleting secrets do not sync automatically to the variable group; you must manually “+ Add” them in the variable group to update the mapping.
- Only supports mapping secrets, not keys and certificates.
- The service connection (ARM, workload identity federation recommended) needs at least Get and List secret permissions (access policy model), or under the RBAC model, the Key Vault Secrets User role (use Key Vault Secrets Officer when write access is needed).
- Network: RBAC-model Key Vaults are supported only when they are reachable through a public endpoint; RBAC Key Vaults behind a private endpoint are not supported (Azure DevOps is not an Azure trusted service). In that case, switch to the access policy model, or, on a self-hosted agent that can reach the private network, use the
AzureKeyVault@2task. - Variable name mapping: Key Vault secret names can contain only letters, digits, and hyphens, for example
redis-password, referenced in the pipeline as$(redis-password).
How: secret lifecycle and masking during a run
- Secret variables are not automatically passed to scripts as environment variables; you must explicitly use the
env:mapping in the step (this prevents scripts from accidentally printing all environment variables). - The agent registers known secret values as masks; when the exact same string appears in logs, it is replaced with
***. Scripts can use the logging command##vso[task.setvariable variable=X;issecret=true]valueto register a value generated at run time as a secret, or##vso[task.setsecret]valueto register only the mask. - Masking is best-effort (official term “best-effort”): if a secret is Base64-encoded, reversed, truncated, output one character at a time, URL-encoded, or embedded in structured output, masking may fail. Official guidance: do not echo secrets, do not put them in command-line arguments, and do not write them to files or logs.
- Fork builds do not get secrets by default (m3).
Why: why secrets must not be written into template parameters
Template parameters (${{ parameters.x }}) are expanded at compile time into the final YAML. The expanded YAML can be viewed with “Download full YAML” on the run page, and parameter values may also appear in run metadata and logs; they are not protected by secret masking. The correct approach: pass only variable names or variable group names, and read secret values at run time via $(secretName) macro syntax, and pass them through env: into scripts. Likewise, do not hard-code plaintext secrets in variables: or concatenate secrets into displayName.
When: selection guidance
- Default: Key Vault-linked variable group + approvals/checks on the variable group + authorization for specific pipelines.
- If Key Vault is on a private network, or you need to choose a Key Vault dynamically per environment:
AzureKeyVault@2+ self-hosted agents/Managed DevOps Pools. - Certificates/keystores/provisioning profiles: secure files +
DownloadSecureFile@1(files are downloaded to$(Agent.TempDirectory), and cleaned up after the job ends). - Avoid secrets whenever you can: use workload identity federation (keyless) for Azure deployments, and use
System.AccessTokenor Microsoft Entra ID identities.
condition or in template expressions”—secret values are unavailable in compile-time expressions and should not be compared. ④ “Setting Key Vault to a private endpoint + RBAC still lets the variable group work”—officially, this is not supported.Architecture diagram: run-time retrieval for a Key Vault-linked variable group
Comparison: parameters vs runtime variables
Interactive simulator: what log masking can and cannot block
Secret redis-password value has been registered as a mask. Pick a way of writing the script, click “Run step,” and observe what the agent writes to the log. The simulation matches the agent: it only replaces exactly matching substrings.
Core command
| Purpose | Command | Notes |
|---|---|---|
| Create an RBAC Key Vault | az keyvault create --enable-rbac-authorization true | The newer CLI defaults to RBAC |
| Grant access to the service connection | az role assignment create --role "Key Vault Secrets User" | assignee is the application or managed identity behind the service connection |
| List variable groups | az pipelines variable-group list | Key Vault-linked groups’ type for AzureKeyVault |
| Key Vault task | AzureKeyVault@2 | Inputs: azureSubscription,KeyVaultName,SecretsFilter,RunAsPreJob |
| secure file | DownloadSecureFile@1 | output variable $(name.secureFilePath); agent ≥ 2.182.1 |
| Register the secret at run time | echo "##vso[task.setvariable variable=tok;issecret=true]$VALUE" | Subsequent steps $(tok) are masked |
# 1. Create a Key Vault (RBAC) and write secrets
SUFFIX=$RANDOM
KV=kv-myapp-lab-$SUFFIX
az keyvault create -n $KV -g $RG -l $LOC --enable-rbac-authorization true -o none
ME=$(az ad signed-in-user show --query id -o tsv)
KV_ID=$(az keyvault show -n $KV --query id -o tsv)
az role assignment create --role "Key Vault Secrets Officer" --assignee $ME --scope $KV_ID -o none
sleep 30 # wait for RBAC propagation
az keyvault secret set --vault-name $KV -n redis-password --value "$(openssl rand -base64 24)" -o none
az keyvault secret set --vault-name $KV -n flask-secret-key --value "$(openssl rand -hex 32)" -o none
# 2. Grant the service connection’s identity Key Vault Secrets User
SC_APPID=$(az devops service-endpoint show --id $SC_ID --query authorization.parameters.serviceprincipalid -o tsv)
az role assignment create --role "Key Vault Secrets User" --assignee $SC_APPID --scope $KV_ID -o none
az role assignment list --scope $KV_ID --query "[].{role:roleDefinitionName,who:principalName}" -o table
Role Who -------------------------- ------------------------------------ Key Vault Secrets Officer andy@fabrikam.com Key Vault Secrets User 7c1d…-…(the application ID of sc-myapp-azure)
Common errors: RBAC role assignments take time to propagate; the role was also granted to the wrong identity (it should be the service connection’s service principal or managed identity, not your own account).
In YAML, use
variables:
- group: vg-myapp-kv # Key Vault-linked variable group (protected resource)
steps:
- script: ./scripts/smoke.sh
displayName: Smoke test with secret
env:
REDIS_PASSWORD: $(redis-password) # explicit mapping; use $REDIS_PASSWORD in the script
# Alternatively, retrieve selected secrets from Key Vault on demand
- task: AzureKeyVault@2
inputs:
azureSubscription: sc-myapp-azure
KeyVaultName: kv-myapp-lab-12345
SecretsFilter: 'flask-secret-key'
RunAsPreJob: false
# Secure file: download a TLS certificate
- task: DownloadSecureFile@1
name: tlsCert
inputs:
secureFile: myapp-tls.pfx
- script: ls -l "$(tlsCert.secureFilePath)"
Lab 4: Key Vault variable group + masking verification (about 6 minutes)
vg-myapp-kv, turn on Link secrets from an Azure key vault as variables, select sc-myapp-azure the Azure subscription and Key Vault, + Add two secrets, and save. Verify:
az pipelines variable-group list --query "[?name=='vg-myapp-kv'].{id:id,type:type,vars:variables}" -o json
[ { "id": 7, "type": "AzureKeyVault",
"vars": { "flask-secret-key": { "isSecret": true, "value": null },
"redis-password": { "isSecret": true, "value": null } } } ]
value: null This shows the values were not copied to Azure DevOps.
refs/heads/main).- script: |
echo "plain: $REDIS_PASSWORD"
echo "base64: $(printf %s "$REDIS_PASSWORD" | base64)"
env:
REDIS_PASSWORD: $(redis-password)
plain: *** base64: UzNjcjN0LVJlZGlzLTIwMjY=
The second line shows that masking does not recognize the transformed value. After the lab,immediately rotate in Key Vault redis-password, and delete that run (or the pipeline run logs).
flask-secret-key without modifying the variable group, then run again — the new value takes effect automatically (verify through app behavior or a hash comparison; do not print it).myapp-tls.pfx (≤ 10 MB), authorize myapp-cd, and use DownloadSecureFile@1 to download it and ls its path.Case 1: rotating the database password no longer requires changing pipelines
Problem: 20 pipelines each store the database password; quarterly rotation requires editing each one, and things often get missed. Approach: Move the password into Key Vault and create a Key Vault-linked variable group that these pipelines reference; rotation just sets a new version in Key Vault, and the next run picks it up automatically. Add approval on the variable group, and allow only the main branch to use it. Limitations: New secrets must be mapped manually; the Key Vault firewall must allow the egress of Microsoft-hosted agents, or switch to self-hosted agents.
Case 2: a template parameter leaked an API key
Problem: The platform team’s deployment template defined apiKey as a string parameter; callers passed $(apiKey) which is safe, but someone wrote the plaintext value directly, and the expanded YAML was visible to all Readers. Approach: Change the template to receive secretVariableName or variable group names; add YAML checks to the push protection and code scanning from m5; rotate the leaked key.
Case 3: Key Vault on a private network
Problem: Security policy requires Key Vault to use only a private endpoint, and the variable group link fails. Approach: Per the official documentation, RBAC with a private endpoint is not supported for variable groups: use the AzureKeyVault@2 task on Managed DevOps Pools (injected into a VNet) to read secrets, or switch this Key Vault to the access policy model. Limitation: Microsoft-hosted agents cannot reach private endpoints.
Common errors and fixes
The user, group or application '…' does not have secrets get permission on key vault 'kv-…' (or Forbidden / Caller is not authorized to perform action on resource)
Cause: The service connection’s identity lacks Get/List permission (access policy model), or lacks the Key Vault Secrets User role (RBAC model); RBAC role assignment may also not have propagated yet.
az keyvault show -n $KV --query properties.enableRbacAuthorization az role assignment list --scope $KV_ID --assignee $SC_APPID -o table
Fix: Grant the correct permission for the model; wait a few minutes and retry.
Key Vault variable group: Client address is not authorized and caller is not a trusted service / cannot list secrets
Cause: The Key Vault firewall or private endpoint blocks access from Azure DevOps; RBAC with a private endpoint is not supported.
Fix: Allow the required egress, or switch to the access policy model; or use an agent that can reach the private network with the AzureKeyVault@2.
Secret variable is empty in the script: $REDIS_PASSWORD is an empty string
Cause: Secret variables are not automatically exposed as environment variables; or the variable group is not referenced in the current stage or job; or the run is a fork build.
Fix: Add env: REDIS_PASSWORD: $(redis-password) to the step; confirm where the variable group is referenced and its authorization.
Secret file myapp-tls.pfx could not be found / Invalid Resource (DownloadSecureFile)
Cause: Name mismatch; the pipeline is not authorized to use the secure file; (Server edition) IIS basic authentication is enabled.
Fix: Check the name; authorize in the secure file’s Pipeline permissions; agent version ≥ 2.182.1.
A secret newly added to Key Vault cannot be retrieved in the pipeline
Cause: Variable group mappings do not automatically include new secrets.
Fix: Edit the variable group › + Add the new secret › Save; or use the AzureKeyVault@2 of SecretsFilter: '*'.
1. Grant the service connection’s identity the Key Vault secret read role.
az role assignment create --role "Key Vault Secrets User" --assignee $SC_APPID --scope $(az keyvault show -n $KV --query id -o tsv)
2. In a script, register a token generated at run time as a secret for later steps.
echo "##vso[task.setvariable variable=deployToken;issecret=true]$TOKEN"
The team wants the platform template deploy.yml to accept a database password parameter so that “one parameter covers all environments.” How would you review this design?
Reject passing the password as a parameter: parameters are expanded into the final YAML at compile time, can be seen through Download full YAML and similar routes, and are not protected by masking. Instead, the parameter takes the environment name and the template variables: - group: vg-myapp-${{ parameters.env }}-kv references the matching Key Vault variable group; the script reads the value through env: to get $(db-password); each variable group should have pipeline authorization and branch-control checks, and production variable groups should also get approvals.
Verified training videos
Official documentation
- Link a variable group to secrets in Azure Key Vault
- Use Azure Key Vault secrets in Azure Pipelines
- Secure files for Azure Pipelines
- Set secret variables
- Protect secrets in Azure Pipelines
Video storyboard (about 80 seconds)
Visual: the variable group card shows only names, no values; an arrow points to a Key Vault safe.
Narration: a Key Vault-linked variable group stores only the names of secrets; the values stay in the safe and are read at each run.
Visual: the key in the safe is replaced with a new one, and the next run automatically gets the new key.
Narration: rotation happens only in Key Vault, so pipelines do not need to change. When adding a new secret, remember to update the mapping.
Visual: in the logs, a plaintext password becomes three asterisks, while the Base64 version is displayed unchanged; a red frame flashes.
Narration: log masking only recognizes identical strings. Once a secret is encoded or split, masking no longer applies.
Visual: a template parameter box contains a password and is crossed out; replacing it with a variable group name gets a checkmark.
Narration: do not use secrets as template parameters. Parameters are expanded at compile time and are not protected by masking.
Module 5 · GitHub Advanced Security for Azure DevOps
- Explain GHAzDO’s product forms: the bundled version (for legacy customers) and the split-out products GitHub Secret Protection for Azure DevOps,GitHub Code Security for Azure DevOps and “active committer” billing (committers who appear in pushes over the past 90 days), with deduplication within the same Azure subscription.
- Enable secret scanning and push protection, and know how to bypass false positives with the commit message token
skip-secret-scanning:true(alerts are still generated), as well as validity checks. - Configure CodeQL code scanning (default setup / advanced setup task
AdvancedSecurity-Codeql-Init@1,AdvancedSecurity-Codeql-Analyze@1) and dependency scanning (AdvancedSecurity-Dependency-Scanning@1), and use PR status checks to block merging of high-severity vulnerabilities.
What: products and features
| Product (after the split) | Features | Price (Azure pricing page, verified 2026-11; estimated prices) |
|---|---|---|
| GitHub Secret Protection for Azure DevOps | Push protection; secret scanning alerts (including historical commits); validity checks; security overview | US$19 / active committer / month |
| GitHub Code Security for Azure DevOps | CodeQL code scanning; dependency scanning alerts; third-party tool results (SARIF publishing); security overview | US$30 / active committer / month |
| GitHub Advanced Security for Azure DevOps (bundled) | All of the above | Existing customers see no change. They can request “Billing migration from bundled to standalone products” through an Azure portal support ticket, which migrates the whole subscription at once; the migration is irreversible. |
- Supports only Azure Repos Git repositories in Azure DevOps Services (for GitHub repositories, use GitHub’s GHAS).
- Active committers: identities that appear in pushes over the past 90 days (even if the commit itself is older) and must be organization members; across repositories and organizations within the same Azure subscription (and the same product), they are deduplicated. Counted daily and billed monthly to the Azure subscription linked to the organization; Organization settings › Billing shows the previous day’s count, and an estimate is shown before enabling.
- When there is no extra license fee: the Azure DevOps pricing page lists cases with “no additional license cost” (for example, Visual Studio subscribers and GitHub Enterprise Cloud customers whose users are managed through Microsoft Entra ID); confirm against the exact pricing page wording and with sales whether these apply to GHAzDO. Copilot Autofix (public preview) is billed separately by AI credits (metered as AI Credit for AzDO GAC).
How: how the three scans work
| Capability | Where it runs | How to enable | Results |
|---|---|---|---|
| Push protection | Azure DevOps Git server side,git push on push and during web edits | Automatically enabled once Secret Protection (or the bundled version) is turned on; can be disabled in repository settings | Rejects pushes containing high-confidence secrets; only evaluates pushes made after it is enabled |
| Repository secret scanning | Background service | Same as above; automatically scans the full history | Repos › Advanced Security › Secrets; one alert per unique credential, all Critical; paired credentials require both halves to appear in the same file |
| Dependency scanning | Pipeline task | Repository settings “Scan for vulnerable dependencies” injects it with one click (into pipelines for the default branch), or add the task manually | Known vulnerabilities in direct and transitive dependencies |
| Code scanning (CodeQL) | Pipeline | Default setup: runs on a schedule (weekly; the date and agent pool can be set in organization settings) with automatic language detection; supports C#, C/C++, Java, JS/TS, Python, Ruby, and Rust; Advanced setup: add your own CodeQL task (supports Go, Swift, etc.) | Alerts aggregated by repository: Critical/High/Medium/Low |
Handling push protection false positives
- First confirm whether it is really a secret; a real secret must be removed from the entire branch history (
git commit --amendor interactive rebase), and rotated immediately. - Example and placeholder values: official guidance is to add
Placeholdertext before fake values. - If confirmed as a false positive or acceptable, in the commit message add
skip-secret-scanning:trueand push. Even when bypassed, secret scanning alerts are still generated on the alerts page after the push. - Alert dismissal reasons: Fixed (revoked) / Risk accepted / False positive; closing (dismissing) requires Project administrator permission.
Why: the value of having this in Azure DevOps
Secrets are before they reach the server; blocking them is far cheaper than after-the-fact scanning; alerts appear directly in PR comments and on the Advanced Security tab; combined with status checks in branch policies AdvancedSecurity/AllHighAndCritical or AdvancedSecurity/NewHighAndCritical, you can block PRs that introduce new high-severity vulnerabilities from merging; branch control checks also treat “GHAzDO push protection is enabled” as one of the conditions for a protected branch.
When: alternatives when no license is available
| Capability | Open source / free alternative | Gap |
|---|---|---|
| Push protection | Local pre-commit + gitleaks / detect-secrets; cannot block on the server side | Client-side hooks can be skipped |
| Secret scanning | Run gitleaks in the pipeline to scan history; a failure blocks PR build validation | No validity checks, no unified alert center |
| Code scanning | CodeQL CLI is free for open source code; private code requires the appropriate license; Semgrep Community Edition and similar tools can also be used | Note the CodeQL CLI license terms |
| Dependency scanning | OWASP Dependency-Check,pip-audit,npm audit, Trivy fs | Results are scattered |
Architecture diagram: where GHAzDO sits in the development flow
Billing illustration: how active committers are counted
Interactive simulator: will push protection block this push?
Edit the commit contents and commit message, then click “git push.” The simulator uses simplified rules to recognize “high-confidence” secret patterns (examples use obviously fictitious values). The real service uses GitHub’s provider pattern library with validity checks, so actual results may differ.
Core tasks and settings
| Task / setting | Purpose | Key inputs |
|---|---|---|
AdvancedSecurity-Codeql-Init@1 | Initialize CodeQL | languages (csharp, cpp, go, java, javascript, python, ruby, rust, swift),buildtype (none/manual),enableAutomaticCodeQLInstall (self-hosted agent) |
AdvancedSecurity-Codeql-Analyze@1 | Analyze and upload results | When there are multiple tasks, turn on Wait for Processing to support status checks |
AdvancedSecurity-Dependency-Scanning@1 | Dependency vulnerability scanning | Run package restore first to improve accuracy |
AdvancedSecurity-Publish@1 | Publish third-party tool SARIF | CodeQL CLI or other SAST |
| Repository settings | Enable Secret Protection / Code Security, push protection, dependency scanning default setup, CodeQL default setup, Autofix | Project settings › Repos › Repositories › repository |
| Organization settings | Enable all + automatically enable for new projects; agent pool and scan day for CodeQL default setup | Organization settings › Repositories |
# Advanced setup: security scanning pipeline for myapp (Python)
trigger:
branches: { include: [ main ] }
pr:
branches: { include: [ main ] }
pool:
vmImage: ubuntu-latest
steps:
- task: AdvancedSecurity-Codeql-Init@1
inputs:
languages: 'python'
buildtype: 'none' # Python is interpreted; no build needed
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: Restore dependencies (improves dependency scanning)
- task: AdvancedSecurity-Dependency-Scanning@1
- task: AdvancedSecurity-Codeql-Analyze@1
Initializing CodeQL for languages: python … Dependency scanning: found 1 vulnerable package (High): … CodeQL analysis complete. Uploading results… Results are available in Repos > Advanced Security
Push blocked and false-positive bypass
# After the push is blocked (confirmed false positive), add the bypass token to the commit message git commit --amend -m "test: add fixture token for parser tests skip-secret-scanning:true" git push origin feature/parser-tests
Note: This leaves an alert in the alert center; close it as False positive with the reasoning documented in the alert details, as audit evidence.
Alternative without a license (gitleaks + build validation)
- script: |
docker run --rm -v "$(Build.SourcesDirectory):/repo" zricethezav/gitleaks:latest \
detect --source /repo --redact --exit-code 1 --report-format sarif --report-path /repo/gitleaks.sarif
displayName: Secret scan (gitleaks, OSS alternative)
Put it into main’s Build validation policy to block at the PR stage; it is not server-side push protection. Pin the image version to an evaluated tag.
Lab 5: Enable GHAzDO (or an open-source alternative) for myapp (about 7 minutes)
echo "AZDO_TOKEN = \"<paste the revoked test PAT>\"" >> config/settings.py git add -A && git commit -m "test push protection" && git push
remote: error: … push rejected: secrets detected … ! [remote rejected] feature/test -> feature/test (…)
The actual error text depends on what the service returns. Then git reset --hard HEAD~1 revert that commit.
azure-pipelines-security.yml from the Commands tab to create a new pipeline run (advanced setup).AdvancedSecurity, Name NewHighAndCritical, Required. (This option appears after the first successful run of the GHAzDO task.)pip-audit -r requirements.txt; set them as main’s Build validation. Record the gap versus GHAzDO (no server-side blocking, no validity checks).Case 1: phased rollout to control costs
Problem: 500 developers, 1,200 repositories, and a budget that covers only some of the features. Approach: Phase 1: enable across the whole organization Secret Protection (push protection gives the most benefit at lower cost), and check “Automatically enable for new projects”; in phase 2, enable Code Security only for internet-facing service repositories; before enabling, forecast active committers using the estimates, and attach multiple organizations to the same subscription to deduplicate. Limitation: Migrating from the bundled version to the split products is done for the whole subscription at once and is irreversible.
Case 2: test fixtures frequently trigger push protection
Problem: Parser tests need samples that “look like tokens,” and developers frequently use skip-secret-scanning:true, which makes the alert center noisy. Approach: Add a consistent Placeholder prefix to sample values, or generate them at run time; close confirmed false-positive alerts as False positive with written reasons; track bypass counts in audit and alert reports, with the security team reviewing them when they exceed a threshold.
Case 3: block new high-severity vulnerabilities without blocking existing ones
Problem: Legacy code has 300 medium/low and 12 high-severity alerts; requiring “all cleared before merging” would freeze development. Approach: Use in main’s policy AdvancedSecurity/NewHighAndCritical (which only blocks new alerts); set a quarterly goal to work down the existing backlog; when needed, use Copilot Autofix (preview) to generate fix PRs, which are merged after human review.
Common errors and fixes
git push rejected: push rejected because secrets were detected (push protection)
Cause: The commits in this push contain high-confidence secrets.
Fix: Real secrets: remove them from the commit (git commit --amend; for earlier commits, use git rebase -i), and rotate immediately. False positives: in the commit message, add skip-secret-scanning:true and push again, then close the alert as False positive.
AdvancedSecurity-Codeql-Init: CodeQL bundle not found in the tool cache (self-hosted agent)
Cause: The self-hosted agent does not have the CodeQL bundle preinstalled.
Fix: Set the task input enableAutomaticCodeQLInstall: true, or install it manually into the agent tool cache following the official instructions; also allow advsec.dev.azure.com,governance.dev.azure.com and similar domains.
Code scanning default setup does not run / reports a missing task
Cause: The organization has Disable Marketplace tasks turned on, or the agent pool selected in default setup has no available agents.
Fix: Turn off the Marketplace task restriction; check the agent pool under Organization settings › Repositories › CodeQL default setup configurable options.
CodeQL: build mode 'none' is not supported for language 'swift'
Cause:buildtype: none Only interpreted languages and cpp, java, and csharp are supported; mixing them with languages such as swift fails.
Fix: Split into separate jobs; for compiled languages, use manual and add a build step.
The AdvancedSecurity/NewHighAndCritical status is not found in the branch policy
Cause: These statuses appear only after the first successful run of a pipeline with the GHAzDO task; or the authorization identity was changed in the advanced options.
Fix: Run a security pipeline once; keep advanced options at their defaults.
1. A push was blocked by a false positive; write the corrected commit command with the bypass token.
git commit --amend -m "test: add parser fixture skip-secret-scanning:true" && git push
2. Write the minimal CodeQL advanced setup steps (YAML) for a Python project.
- task: AdvancedSecurity-Codeql-Init@1
inputs: { languages: 'python', buildtype: 'none' }
- task: AdvancedSecurity-Codeql-Analyze@1Finance asks: “The organization has 80 Basic users. Does enabling Secret Protection cost 80 × US$19 per month?” How do you answer?
Not per Basic user; it is billed per active committer: only organization members who appear in pushes over the past 90 days are counted, in enabled repositories; they are deduplicated across repositories and organizations within the same Azure subscription (same product). Before enabling, the UI shows an estimate; after enabling, Organization settings › Billing shows the actual count for the previous day, and billing is daily and settled monthly to the linked Azure subscription. Stakeholders who do not write code and people who only use Boards are not counted. Check the Azure pricing page for current prices (as of 2026-11: Secret Protection US$19 and Code Security US$30 per active committer per month, estimated).
Verified training videos
Official documentation
- Configure GitHub Advanced Security for Azure DevOps features
- Billing for GitHub Advanced Security for Azure DevOps
- Secret scanning
- Code scanning
- Azure DevOps Services pricing
Video storyboard (about 90 seconds)
Visual: two boxes, “Secret Protection US$19” and “Code Security US$30,” with small text below: “per active committer per month.”
Narration: GHAzDO is now split into two products, billed by active committers who pushed in the past ninety days.
Visual: a git push is bounced back by the server-side shield, and the terminal shows “rejected.”
Narration: push protection blocks secrets on the server. When a block is confirmed as a false positive, add skip-secret-scanning:true to the commit message, but an alert is still generated.
Visual: in the pipeline, the CodeQL initialization, dependency scanning, and CodeQL analysis tasks light up in turn.
Narration: code scanning and dependency scanning run in pipelines. Default setup scans the default branch weekly; advanced setup lets you control languages and branches.
Visual: on the PR page, the NewHighAndCritical status check turns red and the merge button turns gray.
Narration: add the Advanced Security status check to the branch policy, and new high-severity vulnerabilities cannot reach the main branch.
Module 6 · Scaled governance of branch policies and enforced templates
- Set cross-repository branch policies at project level for “current and future default branches” or branch patterns (reviewers, linked work items, comment resolution, merge types, build validation, status checks, automatically included reviewers), and understand how they stack with repository-level policies.
- Design a “secure template + required template check”: the template repository itself is protected, the ref is pinned, and control steps are inside the template; checks are attached to service connections or environments.
- Treat organization-level pipeline settings as guardrails that projects cannot turn off, forming three-layer governance: organization → project → repository/resource.
What: three layers of governance
| Layer | Object | Location | Characteristics |
|---|---|---|---|
| Organization | Pipeline settings, task restrictions, organization policies | Organization settings › Pipelines › Settings / Policies | Once enabled at the organization level, projects cannot turn it off |
| Project (cross-repository) | Branch policies, repository policies | Project settings › Repos › Policies | Applies to all repositories in the project, including repositories created later |
| Repository / resource | Single-repository policies; checks on resources | Repository settings; resource Approvals and checks | Can add on top of project-level policies to add stricter rules |
Cross-repository branch policy
- Project settings › Repos › Policies › Branch policies › “+”: select Protect current and future default branches (the default branch of all repositories, whether named main or master), or Protect current and future branches matching a specified pattern (for example,
release/*). - Available policies: Require a minimum number of reviewers (can prohibit the submitter from approving their own changes, prohibit approval by the most recent pusher, and reset votes on new pushes), Check for linked work items, Check for comment resolution, Limit merge types, Build validation, Status checks, Automatically included reviewers.
- Project-level and repository-level policies stack, and both must be satisfied; repository admins cannot weaken project-level policies through repository settings.
- Branches with policies cannot be pushed to directly (changes must go through a PR), unless the user has the “Bypass policies when pushing” permission — this permission must be strictly controlled and audited.
- Repository-level (project scope) repository policies: committer email validation, file path validation, case enforcement, reserved names, maximum file size, etc., to prevent accidentally committing large files or sensitive paths.
- Azure Repos has no built-in branch policy to “require signed commits” (if needed, build it with custom status checks).
Enforced templates: extends + Required template check
Merely “offering” a template is not enough — developers can simply not use it. The required template check (Required template) attaches to protected resources (usually production service connections and production environments): pipelines whose stages use that resource must extends specify the repository type + repository + ref + path of a template, otherwise static checks fail. Multiple allowed templates can be configured for the same resource.
- The template repository must itself be protected: main branch policy (2 reviewers, build validation), with the template maintainer group authorized separately; otherwise an attacker can simply modify the template.
- Pin the ref: in the check, specify
refs/heads/mainor a tagrefs/tags/v2; if a pipeline references the template from a feature branch, the check fails. - Control inside the template: use
stepListparameters to receive user steps, then iterate over checks with template expressions (for example, rejectingscript/task: CmdLine@2), enforcing injected security scanning, audit steps, and fixed deployment tasks. - Organization-level settings combined with: protect repository access (template repositories also need authorization), limit queue-time variables, disable classic pipelines, to prevent bypassing the YAML system.
Why: why scale needs these
In large organizations, “standards” often exist only in the wiki. Project-level policies make newly created repositories compliant by default; required templates make “production deployments must go through the secure template” a platform-enforced rule rather than a convention; organization-level settings ensure project admins cannot turn off guardrails. Together with audit (m7), these let you demonstrate to auditors that the controls work.
When: trade-offs
- Reviewer count: 2 for production repositories, 1 for internal tools; do not apply 2 across all repositories, or small teams will misuse the bypass permission.
- Required templates should be attached only to production resources; keep flexibility in development environments.
- Version templates (tags) and allow multiple template versions for smooth upgrades.
Comparison with similar technologies
| Azure DevOps | GitHub | |
|---|---|---|
| Cross-repository branch rules | Project-level branch policies (current and future default branches / patterns) | Organization-level rulesets |
| Enforced pipelines | Required template check + extends | Required workflows in rulesets |
| Bypass | Bypass policies permission | Ruleset bypass list |
Architecture diagram: three-layer structure of scaled governance
Flowchart: how the required template check decides
Interactive evaluator: can this YAML use the production service connection?
Service connection sc-myapp-azure Configured required template: Azure Repos · pipeline-templates · refs/heads/main · templates/secure-deploy.yml. Select a pipeline YAML, click “Submit run”, and the evaluator compares each item (simulating the step allowlist inside the template).
Core commands
| Purpose | Command / API | Notes |
|---|---|---|
| List policies | az repos policy list -o table | Includes project-level (empty repositoryId) and repo-level |
| Single-repo reviewer policy | az repos policy approver-count create … --repository-id ID --branch main | In the CLI, --repository-id is required |
| Prefix match | --branch release --branch-match-type prefix | Applies to all branches under release/ |
| Cross-repo policy | POST {org}/{project}/_apis/policy/configurations?api-version=7.1, in scope repositoryId: null | or in the UI: Project settings › Repos › Policies |
| Build validation | az repos policy build create | Specify build definition |
| Status check | az repos policy required-reviewer / … , UI Status checks | AdvancedSecurity/NewHighAndCritical |
# 1. Single repo: main requires at least 2 reviewers; committer votes do not count; new pushes reset votes
REPO_ID=$(az repos show --repository myapp --query id -o tsv)
az repos policy approver-count create --repository-id $REPO_ID --branch main \
--minimum-approver-count 2 --creator-vote-counts false --allow-downvotes false \
--reset-on-source-push true --blocking true --enabled true \
--query "{id:id,type:type.displayName}" -o json
# 2. Cross-repo (main of all repos in the project): REST, scope.repositoryId = null
# fa4e907d-c16b-4a4c-9dfa-4906e5d171dd = "Minimum number of reviewers" policy type
# First confirm the type ID with GET _apis/policy/types
curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/policy/types?api-version=7.1" \
| jq -r '.value[] | [.id, .displayName] | @tsv'
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"$ORG/$PROJ/_apis/policy/configurations?api-version=7.1" -d '{
"isEnabled": true, "isBlocking": true,
"type": { "id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd" },
"settings": {
"minimumApproverCount": 2, "creatorVoteCounts": false,
"resetOnSourcePush": true,
"scope": [ { "repositoryId": null, "refName": "refs/heads/main", "matchKind": "exact" } ]
} }' | jq '{id, type: .type.displayName, scope: .settings.scope}'
fa4e907d-c16b-4a4c-9dfa-4906e5d171dd Minimum number of reviewers
0609b952-1397-4640-95ec-e00a01b2c241 Build
40e92b44-2fe1-4dd6-b3d8-74a9c21d0c6e Work item linking
…
{ "id": 21, "type": "Minimum number of reviewers",
"scope": [ { "repositoryId": null, "refName": "refs/heads/main", "matchKind": "exact" } ] }
How to verify: The policy appears under Project settings › Repos › Policies; on any repo's main branch policy page it shows as “Inherited from project”. Use the type ID from _apis/policy/types as the authoritative result.
Secure template: allow only controlled steps
parameters:
- name: environment
type: string
values: [ myapp-dev, myapp-prod ] # only allow known environments
- name: buildSteps
type: stepList
default: []
stages:
- stage: Build
jobs:
- job: build
steps:
- ${{ each step in parameters.buildSteps }}:
- ${{ each pair in step }}:
# Reject inline scripts and CmdLine@2: a YAML error makes compilation fail (official security-through-templates pattern)
${{ if or(eq(pair.key, 'script'), eq(pair.key, 'bash'), eq(pair.key, 'powershell'), eq(pair.key, 'pwsh'), eq(pair.value, 'CmdLine@2')) }}:
'${{ pair.value }}': error
${{ else }}:
${{ pair.key }}: ${{ pair.value }}
- task: AdvancedSecurity-Dependency-Scanning@1 # injected by the platform
- stage: Deploy
dependsOn: Build
jobs:
- deployment: deploy
environment: ${{ parameters.environment }}
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: sc-myapp-azure
appName: app-myapp-lab
package: $(Pipeline.Workspace)/drop/*.zip
This pattern comes from the official “Security through templates” example: it loops over each step's key-value pairs and, when it hits a banned key (script/bash/powershell/pwsh) or task CmdLine@2 when it emits an illegal key that makes YAML compilation fail, with an error like Unexpected value '…'. In practice, first verify the template expansion in a test pipeline (run page › Download full YAML).
Lab 6: project-level main policy + required template (about 7 minutes)
*@fabrikam.com).az repos create --name policy-probe -o none
az repos policy list --query "[?settings.scope[0].repositoryId==null].{id:id,type:type.displayName,ref:settings.scope[0].refName}" -o table
git clone $ORG/$PROJ/_git/policy-probe && cd policy-probe && git commit --allow-empty -m init && git push origin HEAD:main
Id Type Ref ---- --------------------------- --------------- 21 Minimum number of reviewers refs/heads/main 22 Work item linking refs/heads/main … ! [remote rejected] HEAD -> main (TF402455: Pushes to this branch are not permitted; you must use a pull request to update this branch.)
The first push to an empty repo may behave differently because the default branch does not exist yet; after there is a commit, push again to see TF402455. Delete policy-probe after the lab.
pipeline-templates Require 2 reviewers on the main branch. In Security, grant Contribute only to Platform-Template-Maintainers group, and tag it v1.azure-pipelines.yml to extend the secure template:
resources:
repositories:
- repository: templates
type: git
name: myapp-lab/pipeline-templates
ref: refs/heads/main
extends:
template: templates/secure-deploy.yml@templates
parameters:
environment: myapp-prod
buildSteps:
- task: UsePythonVersion@0
inputs: { versionSpec: '3.12' }
The run should pass the required template check. Then add a - script: echo hi, failing at compile time with Unexpected value 'echo hi', and the run cannot start.Case 1: Standardizing branch policies across 800 repos
Problem: Each team configured its own branch policies; an audit spot check found that 30% of repos had no reviewer requirement on main. Approach: Create a project-level policy for “current and future default branches” in each project; use a script to iterate over _apis/policy/configurations to generate a compliance report; review the “Bypass policies when pushing” permission quarterly. Limitation: Project-level policies cannot span projects; they must be scripted and deployed to each project.
Case 2: The platform engineering “golden path”
Problem: The security team requires that all production deployments go through dependency scanning and a fixed deployment task. Approach: The platform team maintains secure-deploy.yml, with production service connections and environments attached to a required template check; the template forces injection of the scanning step and blocks inline scripts; templates are released with tags, and the check also allows v2 and v3 to ease the transition. Limitation: Overly rigid templates push teams to look for workarounds, so provide enough extension points (stepList, controlled parameters).
Case 3: Emergency fixes and bypass
Problem: A production outage in the early hours, and the reviewers are offline. Approach: Define an “emergency change” process in advance: the on-call lead belongs to a group with bypass permission; when completing the PR, select “Override branch policies and enable merge” and enter a justification; afterwards, search the audit log for bypass events and review them. Configuration: In the audit stream (m7), set an alert for policy bypass events.
Common errors and fixes
TF402455: Pushes to this branch are not permitted; you must use a pull request to update this branch.
Cause: The branch has a policy (project-level or repo-level) that blocks direct pushes.
Fix: Push to a feature branch and create a PR; do not grant bypass permission just for convenience.
Required template check failed (the pipeline uses extends but still fails)
Cause: The repository resource's ref is inconsistent with the check (for example, a feature branch of the template repo was selected at runtime); the path casing or prefix differs; or the repo name points to a fork.
Run page › … › Download full YAML: confirm the source of the extends expansion Check configuration: Repository / Ref (refs/heads/main) / Path (templates/secure-deploy.yml)
Fix: Pin in the YAML ref: refs/heads/main (a fixed ref or tag); the path must exactly match the check.
/templates/secure-deploy.yml@templates (Line: …, Col: …): Unexpected value 'echo hi'
Cause: The secure template's step allowlist rejected the inline script (this is the expected behavior).
Fix: Use a task the template allows, or request an extension point from the platform team.
The PR keeps showing “Waiting for required reviewers” even though 2 people have approved
Cause: One of them is the PR creator (creatorVoteCounts=false) or the most recent pusher; a new push reset the votes; or project-level and repo-level policies together require more reviewers or specific reviewers.
Fix: Check each policy's status and source in the PR's Policies panel.
az repos policy approver-count create: the following arguments are required: --repository-id
Cause: This CLI command requires a repo ID and cannot create a cross-repo policy directly.
Fix: Use the UI or REST for cross-repo policies (set scope to repositoryId: null).
1. List all cross-repo (project-level) branch policies in the project.
az repos policy list --query "[?settings.scope[0].repositoryId==null].{id:id,type:type.displayName,ref:settings.scope[0].refName}" -o table2. In the myapp repo, require 1 reviewer for all branches with the release/ prefix.
az repos policy approver-count create --repository-id $REPO_ID --branch release --branch-match-type prefix \ --minimum-approver-count 1 --creator-vote-counts false --allow-downvotes false --reset-on-source-push true \ --blocking true --enabled true
A team copies secure-deploy.yml into its own repo, modifies it, and extends its own copy. What happens when it deploys to production? How do you prevent this?
If the production service connection or environment has a required template check configured (pointing to the pipeline-templates repo + ref + path), this run fails at the static check stage and the stage does not execute. If no check is configured, the copied template can use production resources; this is exactly the risk of “templates are just conventions.” Prevention: configure a required template check on all production resources; protect main and Contribute permissions on pipeline-templates; enable “Protect access to repositories” so access to the template repo requires authorization; monitor changes to check configurations and bypasses in the audit log.
Verified training videos
Official docs
- Branch policies and settings
- Repository settings and policies
- Security through templates
- Required template check
- az repos policy
Video storyboard (about 80 seconds)
Visual: new repos keep appearing in the project, and each repo's main branch automatically gets the same lock.
Narration: choose “current and future default branches” in the project-level branch policy, so new repos are compliant from the moment they are created.
Visual: an inspector stands in front of the production service connection, holding a checklist of “repo + ref + path” and checking each pipeline's extends.
Narration: the required template check requires the pipeline to extend the specified template, with the repo, branch, and path all matching.
Visual: when the template expands, a line of inline script is blocked and marked in red.
Narration: a secure template can inspect the steps passed in by the caller, reject inline scripts, and force-inject the scanning step.
Visual: the toggle on the organization settings page turns grey on the project page.
Narration: a pipeline setting enabled at the organization level cannot be turned off by a project. This is three-layer governance.
Module 7 · Audit logs, compliance, and streaming
- Turn on auditing (organization policy Log Audit Events); understand the prerequisites (an Entra-backed organization, PCA or audit permissions), the non-configurable 90-day retention period, and the event fields (Actor, IP, Timestamp, Area, Category, Details, ID / CorrelationID).
- Export CSV / JSON by time range, query with the audit REST API, and know the blind spots of auditing (sign-in events, Entra group membership changes, PAT usage).
- Create audit streams to Azure Monitor Logs (Log Analytics),Splunk,Azure Event Grid, understanding “batches delivered every half hour or less”, “at most two streams per target type”, and “backfill of 7 days when re-enabled”, and use KQL in the
AzureDevOpsAuditingtable for compliance queries and alerts.
What: what Azure DevOps auditing records
When a user or service identity in the organization changes the state of an object an audit event is generated, for example: permission changes, resource deletions, branch policy changes, log access and downloads, PAT lifecycle, service connection and check modifications, organization policy changes, extension installs, and so on. For the full list, see the official “Auditing events” page, or call https://auditservice.dev.azure.com/{org}/_apis/audit/actions to list all actionIds this organization can produce.
| Field | Meaning |
|---|---|
| Actor | Actor display name (the export includes UPN, authentication mechanism, User Agent, and so on) |
| IP | Actor IP |
| Timestamp | Timestamp (the UI shows local time) |
| Area | Product area, for example Git, Pipelines, Policy, Permissions, Token, Library, Checks, Licensing, etc. |
| Category | Action type: modify, rename, create, delete, remove, execute, access |
| Details | Summary |
| ID / CorrelationID | An event whose ID equals its CorrelationID is the “original event”; operations such as creating a project produce dozens of related events that share the same CorrelationID |
Prerequisites and limitations (official docs)
- Auditing is still in public preview; available only to organizations that connect Microsoft Entra ID . Azure DevOps Server (on-premises) is not supported.
- All organizations are off by default: Organization settings › Policies › Security › Log Audit Events After turning it on, refresh the page to see Auditing appear in the left menu.
- Permissions: PCA, or be granted View audit log; managing streams requires Manage audit streams, deleting streams requires Delete audit streams.
- Retention: 90 days, not configurable; if you need longer, export or stream the data.
- Blind spots: ① does not record sign-ins events (see the Entra sign-in logs); ② adding or removing members via Entra groups is not in Azure DevOps auditing (see the Entra audit logs); ③ does not record PAT usage; ④ some indirect additions (for example, adding a person by assigning a work item) show only “Added by Azure DevOps Services”.
- When the “Limit user visibility and collaboration to specific projects” preview feature is on, the Project-Scoped Users group cannot access auditing.
How: streaming
| Target | Requires | Notes |
|---|---|---|
| Azure Monitor Logs (Log Analytics) | Workspace Resource ID + tenant ID; sign in with an Entra identity that has access to the workspace | Table name AzureDevOpsAuditing; can connect to Microsoft Sentinel; the workspace retains data for 30 days by default, so adjust it if you need longer (extra cost) |
| Splunk | HTTP Event Collector URL (with port, default 8088) + HEC token | When creating the HEC token,do not check Enable indexer acknowledgment, or no events arrive; for on-premises Splunk, allow the Azure DevOps inbound IP ranges |
| Azure Event Grid | Topic endpoint + access key | The topic's event schema must be Event Grid Schema; then use subscriptions to route events to Functions, Storage, third-party SIEMs, and so on |
- New events Every 30 minutes or less are batched and pushed; each target type currently allows at most two streams.
- A stream that hits a failure may be automatically disabled; after re-enabling it, up to the past 7 days of events are backfilled; anything older than 7 days is lost.
- Deleting a stream cannot be undone; unsent events will never be sent.
Why: the compliance perspective
Frameworks such as ISO 27001, SOC 2, and PCI DSS all require “changes are traceable” and “log retention periods.” The built-in 90-day retention is usually not enough (1 year is a common requirement), so streaming is a must-have for compliance. A SIEM also enables correlation analysis, for example “a policy is disabled and the same person then pushes past a branch policy.”
When: which events are worth alerting on
| Scenario | Approach (use the actual actionIds) |
|---|---|
| Organization/security policy modified | Area = Policy / actionIds related to organization policy |
| Auditing turned off or stream deleted | Auditing area events (turning off auditing itself is a high-risk signal) |
| PAT found in a public repo | Token.PatPublicDiscoveryEvent,Token.PatSystemRevokeEvent |
| check deleted or bypassed, service connection modified | Checks / Pipelines / Library areas |
| Privilege escalation | Permissions / Group areas: joining Project Collection Administrators |
| Branch policy changes or bypasses | Policy / Git areas |
Architecture diagram: where audit data goes
Evidence chain: investigating a “policy turned off” event
Animation: audit events from creation to SIEM
Click “Generate event” to simulate a governance action; events first enter the 90-day audit storage, then are pushed to enabled streams in batches (simulating “≤30 minutes”). You can disable a stream, fast-forward time, then re-enable it to observe the 7-day backfill rule.
Core commands and queries
| Purpose | API / command | Notes |
|---|---|---|
| Query audit log | GET https://auditservice.dev.azure.com/{org}/_apis/audit/auditlog?startTime=…&endTime=…&batchSize=…&api-version=7.1-preview.1 | Returns decoratedAuditLogEntries and continuationToken |
| download | GET …/_apis/audit/downloadlog?format=csv|json&startTime=…&endTime=… | equivalent to the UI's Download |
| Events that can be generated | GET …/_apis/audit/actions | list of actionId, area, category |
| Streams | GET …/_apis/audit/streams | View stream status (enabled / disabled / error) |
| Log Analytics | az monitor log-analytics workspace create / query | Table AzureDevOpsAuditing |
# 1. Audit events from the past 24 hours (Entra token, requires View audit log permission)
START=$(date -u -d "-1 day" +%Y-%m-%dT%H:%M:%SZ)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/auditlog?startTime=$START&batchSize=200&api-version=7.1-preview.1" \
| jq -r '.decoratedAuditLogEntries[] | [.timestamp, .area, .category, .actorDisplayName, .ipAddress, .actionId] | @tsv' | head
# 2. Only PAT-related events
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/auditlog?startTime=$START&api-version=7.1-preview.1" \
| jq -r '.decoratedAuditLogEntries[] | select(.actionId|startswith("Token.")) | [.timestamp,.actionId,.details] | @tsv'
# 3. Download CSV archive (recommended: store in immutable storage)
curl -s -H "Authorization: Bearer $ADO_TOKEN" -o audit-$(date +%F).csv \
"https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/downloadlog?format=csv&startTime=$START&api-version=7.1-preview.1"
wc -l audit-*.csv
2026-11-15T15:20:41Z Token create Andy Example 203.0.113.10 Token.PatCreateEvent 2026-11-15T15:02:09Z Checks modify Andy Example 203.0.113.10 CheckConfiguration.Updated 2026-11-15T14:58:30Z Library create Andy Example 203.0.113.10 Library.VariableGroupCreated … 2026-11-15T15:20:41Z Token.PatCreateEvent Created personal access token "lab-code-read" 37 audit-2026-11-15.csv
Except for Token.* (listed in the PAT docs), the other actionId names are illustrative; treat the _apis/audit/actions returned values as authoritative. Field names follow the actual JSON from the API.
Log Analytics: create the workspace and KQL
az monitor log-analytics workspace create -g $RG -n law-ado-audit -l $LOC --retention-time 90 -o none az monitor log-analytics workspace show -g $RG -n law-ado-audit --query id -o tsv # enter the Resource ID for the stream config az account show --query tenantId -o tsv # enter the Tenant ID
// Count by area and category for the last 7 days
AzureDevOpsAuditing
| where TimeGenerated > ago(7d)
| summarize count() by Area, Category
| order by count_ desc
// PAT leaks and system revocations (should trigger alerts)
AzureDevOpsAuditing
| where OperationName in ("Token.PatPublicDiscoveryEvent", "Token.PatSystemRevokeEvent")
| project TimeGenerated, OperationName, ActorUPN, IpAddress, Details
// Organization policy changes (use the actual data for Area names)
AzureDevOpsAuditing
| where Area == "Policy" or OperationName startswith "OrganizationPolicy"
| project TimeGenerated, OperationName, ActorUPN, IpAddress, Details
az monitor log-analytics query -w $(az monitor log-analytics workspace show -g $RG -n law-ado-audit --query customerId -o tsv) \ --analytics-query "AzureDevOpsAuditing | where TimeGenerated > ago(1d) | summarize count() by Area" -o table
Area Count_ ----------- ------ Token 3 Checks 4 Library 2 Permissions 1
Column names (OperationName,ActorUPN,IpAddress,Area,Category,Details etc.) follow the actual schema of that table in the workspace.
Lab 7: turn on auditing, export, create a stream, write an alert (about 7 minutes)
law-ado-audit (see the commands above); Auditing › Streams › New stream › Azure Monitor Logs, enter the Resource ID and Tenant ID, Sign in to Azure. The status should be Enabled.az monitor log-analytics workspace delete -g $RG -n law-ado-audit --yes); keep them in production organizations.Case 1: SOC 2 audit requires 1 year of logs
Problem: The auditor requires 12 months of records for “production deployment approvals and permission changes”; built-in retention is only 90 days. Approach: Create a stream to Log Analytics, with the workspace retaining data for 1 year (or interactive retention of 90 days plus long-term archive), and connect to Sentinel; export CSVs monthly to immutable blob storage (WORM) as a second copy of the evidence; use KQL to generate quarterly reports. Limitation: Events from before the stream was enabled can only be backfilled from exports made while they were still within the 90-day window.
Case 2: Splunk receives no events
Problem: The stream shows Enabled, but Splunk has no data. Approach: Check the HEC token per the official instructions: if “Enable indexer acknowledgment” is checked, no events flow in; unchecking it restores the flow. The URL must include the port; on-premises Splunk must allow the Azure DevOps outbound IP ranges.
Case 3: an insider turned off auditing
Problem: A PCA turned off auditing before performing a sensitive operation, then turned it back on. Approach: Turning off auditing itself generates an event that appears in the stream; in the SIEM, set a high-priority alert for “auditing turned off / stream disabled or deleted”; keep PCA membership to a minimum and use granular permissions for day-to-day work; on the Entra side, use PIM to manage activation of high-privilege groups.
Common errors and fixes
There is no Auditing menu in Organization settings
Cause: Auditing is not enabled (Log Audit Events is off); you do not have View audit log permission; the organization is not connected to Entra; you belong to Project-Scoped Users.
Fix: A PCA enables the policy and grants the permission; connect Entra first (m1).
Audit stream status changes to Disabled / shows an error
Cause: The target is unreachable or the credentials are no longer valid (the Splunk token was rotated, the Event Grid access key was regenerated, or the workspace was deleted or its permissions changed).
Fix: Edit stream to update the credentials and then re-enable it. Only the last 7 days will be backfilled, so act quickly.
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/streams?api-version=7.1-preview.1" | jq '.value[] | {id, consumerType, status, statusReason}'There is no AzureDevOpsAuditing table in Log Analytics
Cause: The stream was just created and has no events yet (up to about 30 minutes); the stream points to a different workspace; or the identity used to create the stream has no permission on the workspace.
Fix: Generate an audit event, then wait for one batch; double-check the Resource ID and Tenant ID.
Audit REST returns 401/403
Cause: Missing View audit log; used a PAT that does not meet Conditional Access; called dev.azure.com instead of auditservice.dev.azure.com.
Fix: Use an Entra token and the correct hostname; grant the permission.
Cannot find a record of someone being added to an Entra group and gaining access
Cause: Entra group membership changes do not appear in Azure DevOps auditing.
Fix: Check the Entra audit logs; Azure DevOps auditing only records membership changes for Azure DevOps groups themselves (Area = Groups).
1. List all audit actions (actionId) this organization can generate.
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/actions?api-version=7.1-preview.1" | jq -r '.value[].actionId' | sort | head -50
2. Write a KQL query: top 10 actors by audit event count over the past 30 days.
AzureDevOpsAuditing | where TimeGenerated > ago(30d) | summarize n = count() by ActorUPN | top 10 by n
The security team wants to know “who approved production deployments in the past year, and who modified the checks on myapp-prod.” Auditing was only turned on today. Can this be done? How should it be designed going forward?
Turning it on today only shows events from this point on; built-in retention is at most 90 days, so the past year's data cannot be obtained from auditing (some deployment approval records can be partly found in each run's check history, but that is not equivalent to audit evidence). Design: turn on auditing now and create a stream to Log Analytics/Sentinel with the workspace retention set to ≥ 1 year; export regularly to immutable storage for redundancy; set alerts for check configuration changes, approval bypasses, and auditing turned off or stream disabled; and keep Entra sign-in and audit logs to supplement identity information.
Verified training videos
Official docs
Video storyboard (about 80 seconds)
Visual: the Log Audit Events toggle on the organization policy page is switched on, and Auditing appears in the left menu.
Narration: auditing is off by default and is only available for organizations connected to Entra ID. The first step is to turn it on.
Visual: event cards are arranged in a table by Actor, IP, Area, and Category, and cards older than ninety days gradually fade away.
Narration: each event records who did what, from where, and in which area. Built-in retention is only ninety days.
Visual: events are packed into a box every thirty minutes and shipped to three docks: Log Analytics, Splunk, and Event Grid.
Narration: audit streams push every half hour or less, with at most two streams per target type. After a stream is disabled and re-enabled, only seven days can be backfilled.
Visual: a Sentinel alert pops up: “PAT found in a public repo.”
Narration: only when you write queries and alerts in the SIEM does the audit log actually become a governance capability.
Module 8 · Comprehensive governance architecture review
- Review an Azure DevOps organization using the seven-layer governance architecture, checking layer by layer in the order “control objective → platform control → evidence source.”
- Identify the most common governance gaps (Open access service connections, global PATs, no auditing, non-mandatory templates, secrets written in YAML, fork builds getting secrets), and set remediation priorities.
- Use the troubleshooting tree to quickly locate failures caused by governance controls: service connection authorization failures, blocked checks, Key Vault variable group access denied, pushes blocked, PATs rejected by policy, and so on.
What: the seven-layer governance architecture
| Layer | Control objective | Platform controls (this course's modules) | Evidence source |
|---|---|---|---|
| 1 Identity | Only managed identities, accessing under controlled conditions | Entra connection, Conditional Access, group rules, external guest/invitation policies, restrict organization creation (M1) | Entra sign-in logs, organization policy audit events |
| 2 Credentials | No long-lived, broad, or ownerless credentials | PAT tenant/organization policies, global PAT retirement, SP/MI, automatic revocation of leaked PATs (M2) | Token.* Audit events, PAT inventory |
| 3 Pipeline resources | Production resources can only be used by controlled pipelines under controlled conditions | Pipeline permissions, approvals and checks, limiting job authorization scope, protecting repository access, shell argument validation, fork rules (M3) | Check configuration exports, the run's Checks panel, Checks/Pipelines audit events |
| 4 Secrets | Secrets do not end up in code or logs, and can be rotated | Key Vault variable groups AzureKeyVault@2, secure files, no secrets as parameters (M4) | Key Vault diagnostic logs, Library audit events |
| 5 Code security | Secrets and vulnerabilities are blocked before merge | GHAzDO push protection, CodeQL, dependency scanning, PR status checks (M5) | Advanced Security alerts and dismissal reasons |
| 6 Scale | New projects/new repos are compliant by default, and guardrails cannot be turned off | Project-level branch policies, required templates, organization-level pipeline settings (M6) | Policy configuration exports, Policy audit events |
| 7 Evidence | Any change is traceable for ≥ the compliance period | Auditing, export, streaming to SIEM, alerts (M7) | SIEM retention and reporting |
Why: the review order
Start with the evidence layer (turn on auditing and streams), otherwise later remediation cannot be proven; then do identity and credentials (largest attack surface); then pipeline resources and secrets (direct path to production); finally code security and scale (continuous prevention). This matches the order of this course's “comprehensive lab.”
How: common gaps and remediation priorities
| Gap | Risk | Remediation | Priority |
|---|---|---|---|
| Auditing not enabled / no stream | Cannot investigate or prove | Enable + Log Analytics stream + alerts | P0 |
| Long-lived global or full-scope PAT | One leak can sweep through multiple organizations | Tenant PAT policy + migrate to SP/MI (deadline 2026-12-01 / 2027-01-27) | P0 |
| Production service connection Open access | Any branch's YAML can deploy to production | Specific pipelines + branch control + required template | P0 |
| Project does not limit job authorization scope | Job tokens move laterally into other projects | Enable at organization level | P1 |
| Secrets written in YAML / parameters | Exposed in plain text | Key Vault variable group + push protection + rotation | P1 |
| No Conditional Access | Stolen credentials are enough to sign in | CA requires MFA (report-only mode first) | P1 |
| Branch policies configured per repo | New repos are unprotected | Project-level “current and future default branches” | P2 |
| Self-hosted agent runs under a high-privilege account | A compromised pipeline takes over the organization | Low-privilege local account / gMSA, with pools split by project (Lesson 7) | P1 |
When: ongoing governance cadence
- Weekly: review SIEM alerts (policy changes, check deletion/bypass, PAT leaks, auditing turned off).
- Monthly: clean up inactive users; PAT inventory and expirations; new high-severity GHAzDO alerts; service connection Usage history (Azure Pipelines is beginning to automatically disable service connections unused for 100 days).
- Quarterly: Entra access reviews; bypass permission review; re-score this scorecard; template version upgrades.
Architecture diagram: target governance architecture for myapp-lab
Review process
Interactive scorecard: score your organization
Check the boxes that match reality. The scorecard weights the seven layers (P0 items weigh more), a radar bar shows each layer's score, and a remediation list sorted by priority is generated automatically. Results are saved in this browser.
Review evidence script (read-only)
The following commands only read configuration and are used to collect evidence before the review. They require PCA or the corresponding read permission, and use an Entra token.
#!/usr/bin/env bash
# Usage: ORG=https://dev.azure.com/myorg ORGNAME=myorg PROJ=myapp-lab ./governance-review.sh
set -euo pipefail
T=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)
H=(-s -H "Authorization: Bearer $T")
echo "== 1. Users and access levels (earliest access first)"
az devops user list --top 500 -o json | jq -r '.members[] | [.lastAccessedDate,.user.principalName,.accessLevel.licenseDisplayName] | @tsv' | sort | head -5
echo "== 2. Global/full-scope in my PATs"
curl "${H[@]}" "https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \
| jq -r '.patTokens[] | select(.targetAccounts==null or .scope=="app_token") | [.displayName,.scope,.validTo] | @tsv'
echo "== 3. Service connections with Open access"
for id in $(az devops service-endpoint list --project $PROJ --query "[].id" -o tsv); do
open=$(curl "${H[@]}" "$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$id?api-version=7.1-preview.1" | jq -r '.allPipelines.authorized // false')
name=$(az devops service-endpoint show --id $id --project $PROJ --query name -o tsv)
echo -e "$name\topenAccess=$open"
done
echo "== 4. Number of checks on environments"
for e in $(curl "${H[@]}" "$ORG/$PROJ/_apis/pipelines/environments?api-version=7.1" | jq -r '.value[] | "\(.id):\(.name)"'); do
n=$(curl "${H[@]}" "$ORG/$PROJ/_apis/pipelines/checks/configurations?resourceType=environment&resourceId=${e%%:*}&api-version=7.1-preview.1" | jq '.count')
echo -e "${e#*:}\tchecks=$n"
done
echo "== 5. Project-level branch policies"
az repos policy list --project $PROJ --query "[?settings.scope[0].repositoryId==null].type.displayName" -o tsv | sort | uniq -c
echo "== 6. Auditing availability / stream status"
curl "${H[@]}" "https://auditservice.dev.azure.com/$ORGNAME/_apis/audit/streams?api-version=7.1-preview.1" \
| jq -r '.value[]? | [.consumerType,.status] | @tsv' || echo "Cannot read (auditing not enabled or no permission)"
== 1. Users and access levels (earliest access first) 2026-03-02T… contractor1@fabrikam.com Basic == 2. Global/full-scope in my PATs legacy-sync app_token 2027-06-01T00:00:00Z == 3. Service connections with Open access sc-myapp-azure openAccess=true == 4. Number of checks on environments myapp-dev checks=0 myapp-prod checks=1 == 5. Project-level branch policies == 6. Auditing availability / stream status Cannot read (auditing not enabled or no permission)
Interpretation: This output corresponds to four P0 gaps on the scorecard: long-unused contractors, global full-scope PATs, Open access production service connections, and no audit stream. Organization-level policies (Policies page) and pipeline settings currently have no public, stable REST interface, so capture evidence with screenshots in the UI.
Lab 8: Review myapp-lab and produce a remediation list (about 6 minutes)
governance-review.sh, run it, and save the output as review-before.txt.review-after.txt; use KQL in Log Analytics to list the audit events generated during remediation as evidence that the controls were implemented.
diff review-before.txt review-after.txt
< sc-myapp-azure openAccess=true > sc-myapp-azure openAccess=false < myapp-prod checks=1 > myapp-prod checks=3
Case 1: Quarterly governance review for a financial customer
Problem: Regulators require quarterly proof that “production deployments are subject to dual control and are traceable.”Approach: Use the seven-layer scorecard as a template; the evidence package includes: check configuration export (REST), project-level branch policy export, KQL reports (approval events, check changes, bypass events), and Entra access review results. Result: The review went from two weeks of manual collection to a half-day scripted process.
Case 2: A supply chain attack drill
Problem: The red team simulated “a developer laptop is compromised.”Process: The stolen PAT, limited by the 90-day lifetime and single-organization restriction, could only read code from one organization; an attempt to edit YAML to reference the production service connection was stopped by the required template and branch control; an attempt to push configuration containing secrets was blocked by push protection; all attempts triggered alerts in Sentinel. Improvement: A self-hosted agent was found running under a high-privilege account; it was logged as a P1 remediation item.
Case 3: Over-governance reduces efficiency
Problem: Every environment required 2-person approval, developers waited an average of 3 hours per day, and approvers started approving mechanically. Approach: Remove manual approval for dev/test environments and keep only branch control and automated checks (Azure Monitor alerts, REST quality gates); keep approvals for production and add business hours; include approval fatigue metrics in reviews.
Interactive troubleshooting tree: failures caused by governance controls
Start from the symptom and make selections step by step; the tree ends with diagnostic commands and fix suggestions. It covers service connection authorization failures, blocked checks, Key Vault variable group access denied, blocked pushes, PATs rejected by policy, Conditional Access blocks, and so on.
1. Find all service connections with Open access in the project.
for id in $(az devops service-endpoint list --query "[].id" -o tsv); do curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$id?api-version=7.1-preview.1" \ | jq -r --arg id $id 'select(.allPipelines.authorized==true) | $id' done
2. Count the checks on the myapp-prod environment.
curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/pipelines/checks/configurations?resourceType=environment&resourceId=$ENV_ID&api-version=7.1-preview.1" | jq '.count'
You take over an organization that has had no governance for 3 years (40 projects, no Entra, no auditing, many global PATs). Give a 30-day plan.
Week 1: connect Entra (maintenance window, identity mapping plan, break-glass accounts) → turn on auditing and create a Log Analytics stream right away (this depends on Entra). Week 2: tenant PAT policies (restrict global, full-scope, maximum lifetime); inventory global PATs and migrate them before 2026-12-01 (the earlier official date); turn off third-party OAuth, public projects, and project administrator invitations. Week 3: organization-level pipeline settings (job authorization scope, protect repository access, shell argument validation, queued variable limits); change all production service connections to specific pipelines + branch control + required template. Week 4: migrate Key Vault variable groups, enable Secret Protection across the organization, project-level branch policies, Conditional Access (report-only → on), scorecard re-review and alerts. For every step, notify people first and validate in a pilot project first.
Verified training videos
Official docs
Video storyboard (about 90 seconds)
Visual: seven layers of blocks stack from bottom to top: evidence, identity, credentials, pipeline resources, secrets, code security, scale.
Narration: governance is not a single switch, but seven layers of controls. Build the evidence layer first, or no remediation can be proven.
Visual: the red P0 items on the scorecard turn green one by one: audit stream, PAT policy, service connection authorization.
Narration: prioritize P0: turn on auditing and the stream, tighten PATs, and close open access to production service connections.
Visual: red team attack arrows hit layer after layer of shields, and Sentinel lights up an alert with each hit.
Narration: the point of layered controls is that if one layer is breached, the next layer can still stop the attack, and it leaves evidence behind.
Visual: weekly, monthly, and quarterly review markers on a calendar.
Narration: governance is an ongoing rhythm. Re-score every quarter to keep up with platform and threat changes.
Command cheat sheet
Identity and Entra tokens
export ORG=https://dev.azure.com/<org> ORGNAME=<org> PROJ=myapp-lab az login && az devops configure --defaults organization=$ORG project=$PROJ 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' az devops user list --top 500 -o json | jq -r '.members[]|[.lastAccessedDate,.user.principalName]|@tsv' | sort | head az devops security group list --project $PROJ --query "graphGroups[].displayName" -o tsv
PAT governance
# List / create / revoke your own PATs (requires a user-delegated Entra token)
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1"
curl -s -X POST -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \
-d '{"displayName":"tool-x","scope":"vso.code","validTo":"2026-12-31T00:00:00Z","allOrgs":false}'
curl -s -X DELETE -H "Authorization: Bearer $ADO_TOKEN" \
"https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?authorizationId=<id>&api-version=7.1"
# Global PAT deactivation: 2026-12-01 (documented best practice) / 2027-01-27 (top of docs)Protected resources and checks
SC_ID=$(az devops service-endpoint list --query "[?name=='sc-myapp-azure'].id" -o tsv)
# Pipeline permissions (type: endpoint|queue|variablegroup|securefile|environment|repository)
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$SC_ID?api-version=7.1-preview.1"
curl -s -X PATCH -H "Authorization: Bearer $ADO_TOKEN" -H "Content-Type: application/json" \
"$ORG/$PROJ/_apis/pipelines/pipelinepermissions/endpoint/$SC_ID?api-version=7.1-preview.1" \
-d '{"allPipelines":{"authorized":false},"pipelines":[{"id":12,"authorized":true}]}'
# Export check configuration
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
"$ORG/$PROJ/_apis/pipelines/checks/configurations?resourceType=environment&resourceId=3&\$expand=settings&api-version=7.1-preview.1"
# Check order: static (branch/template/artifact) → pre-approval → dynamic (approval/Function/REST/business hours/Monitor) → post-approval → exclusive lockSecrets
az keyvault create -n kv-myapp-lab-$RANDOM -g rg-ado-lab -l canadacentral --enable-rbac-authorization true
az role assignment create --role "Key Vault Secrets User" --assignee <service connection appId> --scope <kv id>
az pipelines variable-group list --query "[].{name:name,type:type}" -o table
echo "##vso[task.setvariable variable=tok;issecret=true]$VALUE" # register the secret at runtime
echo "##vso[task.setsecret]$VALUE" # register the mask only
# YAML: env: { REDIS_PASSWORD: $(redis-password) } ← secrets must be mapped explicitly
# AzureKeyVault@2: azureSubscription / KeyVaultName / SecretsFilter / RunAsPreJob
# DownloadSecureFile@1 → $(name.secureFilePath), up to 10 MB per fileGHAzDO
- task: AdvancedSecurity-Codeql-Init@1
inputs: { languages: 'python', buildtype: 'none' } # for self-hosted, add enableAutomaticCodeQLInstall: true
- task: AdvancedSecurity-Dependency-Scanning@1
- task: AdvancedSecurity-Codeql-Analyze@1
- task: AdvancedSecurity-Publish@1 # third-party SARIF
# Push protection false positive: add skip-secret-scanning:true to the commit message (an alert is still generated)
# PR status checks: AdvancedSecurity/AllHighAndCritical or AdvancedSecurity/NewHighAndCritical
# Pricing: Secret Protection $19, Code Security $30 / active committer / month (pushes in the last 90 days, deduplicated within the subscription)Branch policies and templates
az repos policy list -o table
az repos policy approver-count create --repository-id $REPO_ID --branch main \
--minimum-approver-count 2 --creator-vote-counts false --allow-downvotes false \
--reset-on-source-push true --blocking true --enabled true
curl -s -H "Authorization: Bearer $ADO_TOKEN" "$ORG/$PROJ/_apis/policy/types?api-version=7.1"
# Cross-repo: POST _apis/policy/configurations, settings.scope=[{"repositoryId":null,"refName":"refs/heads/main","matchKind":"exact"}]
# Required template check: Repository + Ref(refs/heads/main) + Path; the pipeline must extendsAuditing
A=https://auditservice.dev.azure.com/$ORGNAME/_apis/audit curl -s -H "Authorization: Bearer $ADO_TOKEN" "$A/auditlog?startTime=2026-11-14T00:00:00Z&api-version=7.1-preview.1" curl -s -H "Authorization: Bearer $ADO_TOKEN" -o audit.csv "$A/downloadlog?format=csv&api-version=7.1-preview.1" curl -s -H "Authorization: Bearer $ADO_TOKEN" "$A/actions?api-version=7.1-preview.1" | jq -r '.value[].actionId' curl -s -H "Authorization: Bearer $ADO_TOKEN" "$A/streams?api-version=7.1-preview.1" az monitor log-analytics workspace create -g rg-ado-lab -n law-ado-audit -l canadacentral --retention-time 90
KQL (AzureDevOpsAuditing)
AzureDevOpsAuditing | where TimeGenerated > ago(7d) | summarize count() by Area, Category AzureDevOpsAuditing | where OperationName startswith "Token." | project TimeGenerated, OperationName, ActorUPN, IpAddress AzureDevOpsAuditing | summarize n=count() by ActorUPN | top 10 by n
Quick reference: key locations
| Task | Where | Who can do it |
|---|---|---|
| Connect / view Entra tenant; tenant PAT policy; restrict organization creation | Organization settings › Microsoft Entra | PCA (connect); Azure DevOps Administrator (tenant policies) |
| OAuth / SSH / auditing / public projects / external guests / IP CA / restrict PAT creation | Organization settings › Policies | PCA |
| Conditional Access | entra.microsoft.com › Conditional Access (resource 499b84ac-…) | Conditional Access Administrator |
| Job authorization scope / repo protection / shell validation / queued variables / classic pipelines / forks | Organization or Project settings › Pipelines › Settings | PCA / Project Administrator |
| Approvals and checks, pipeline permissions | Resource › Approvals and checks / Pipeline permissions | Resource Administrator |
| GHAzDO enablement and default settings | Project settings › Repos › Repositories; Organization settings › Repositories | PCA or Advanced Security: manage settings |
| Cross-repo branch policies | Project settings › Repos › Policies | Project Administrator |
| Auditing and streams | Organization settings › Auditing (Logs / Streams) | View audit log / Manage audit streams |
Comprehensive lab + final quiz
governance-review.sh, save as evidence/00-before.txt; take screenshots of three settings pages (Policies, Microsoft Entra, Pipelines › Settings).law-ado-audit (retention set per target) and create an Azure Monitor Logs stream; create two alerts: “PAT leak” and “check configuration change.”
AzureDevOpsAuditing
| where Area in ("Checks", "Policy", "Token", "Library", "Permissions")
| project TimeGenerated, Area, OperationName, ActorUPN, Details
| order by TimeGenerated descgrp-ado-myapp-contributors to Contributors, create group rules (Basic + myapp-lab); turn off third-party OAuth, public projects, and project administrator invitations; (if you have permission) create CA-ADO-RequireMFA in report-only mode.grp-ado-pat-exempt; revoke or migrate the global PATs found in the inventory; use sp-ado-myapp-automation (Readers) to replace one script's PAT.
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://vssps.dev.azure.com/$ORGNAME/_apis/tokens/pats?api-version=7.1" \ | jq '[.patTokens[] | select(.targetAccounts==null)] | length' # expect 0
sc-myapp-azure,vg-myapp-kv, and myapp-prod change to authorize only myapp-cd; myapp-prod: approvals (approvers group, self-approval blocked) + branch control (main, hotfix/*, verify protected) + exclusive lock; sc-myapp-azure and myapp-prod: required template check pipeline-templates/templates/secure-deploy.yml@refs/heads/main; change the myapp pipeline to use extends.kv-myapp-lab-* (RBAC) + vg-myapp-kv; grant Key Vault Secrets User to the service connection identity; the pipeline uses secrets through env: ; confirm there are no secret values in the YAML or template parameters.
git grep -nEi "(password|secret|token)\s*[:=]\s*['\"][^$]" -- '*.yml' '*.yaml' '*.py' || echo "no inline secrets found"
AdvancedSecurity/NewHighAndCritical status check. No-license alternative: Run gitleaks and pip-audit in the PR validation pipeline, and set them as Required.- From
feature/xrun myapp-cd → branch control fails (screenshot the Checks panel). - From main, run the branch version without extends → required template fails.
- From main, run normally → wait for approval → another approver approves → deployment succeeds.
- Try pushing a test secret → blocked (or gitleaks makes PR validation fail).
- Run KQL and export the audit events from this lab session as
evidence/90-audit.csv; run againgovernance-review.shand save asevidence/99-after.txt.
Acceptance checklist
az keyvault delete note soft delete; if needed, az keyvault purge). Organization-level policies can stay on, since they are the recommended configuration.Open-ended self-check (answer first, then expand the reference answer)
1. Why is “approvals and checks are not written in YAML” central to the Azure Pipelines security model?
YAML is controlled by anyone with push permission (including a modified version on a new branch); checks are configured by the resource owner on the resource, and changing the YAML cannot remove or bypass them. This separates duties between developers and resource owners: developers decide “what to do,” and resource owners decide “under what conditions my resources may be used for that.”
2. What are the two retirement dates for global PATs? How would you schedule the migration?
The top of the official PAT docs (linking the sprint 270 release notes) says 2027-01-27, while the best-practices section of the same doc says 2026-12-01. Complete the migration by the earlier date: stop the bleeding by turning on “Restrict global PAT creation,” inventory, migrate to organization-scoped PATs or Entra authentication (SP/MI/GCM OAuth), and watch the latest release notes.
3. What does “runtime value retrieval” mean for a Key Vault variable group? What are its limitations?
The variable group stores only secret names; each run reads the latest values from Key Vault through the service connection, so rotated values take effect automatically. Limitations: adding or deleting secrets requires manually updating the mapping; only secrets are supported; the service connection needs Get/List or Key Vault Secrets User; RBAC + private endpoint is not supported.
4. What is the execution order of the five check categories? Why are static checks placed first?
Static checks (branch control, required template, evaluate artifact) → pre-check approval → dynamic checks (approval, Azure Function, REST API, business hours, Azure Monitor alerts) → post-check approval → exclusive lock. Static checks need no human involvement and their result is final, so placing them first prevents approvers from wasting time on a run that is doomed to fail.
5. What are the blind spots of auditing? How do you compensate during an investigation?
It does not record sign-in events, Entra group membership changes, or PAT usage; some indirect additions only show as added by the system. To compensate: combine Entra sign-in logs and audit logs; use an inventory plus lifecycle events for PATs; send both log types to the same SIEM for correlation.
6. Without a GHAzDO license, how do you get as close as possible to equivalent code security controls? Where are the gaps?
Run gitleaks (secrets), CodeQL CLI (free only for open-source code) or Semgrep (code), and pip-audit/OWASP Dependency-Check (dependencies) in PR build validation, set as a Required policy; plus a local pre-commit hook. Gaps: no server-side push protection (secrets are found only after they reach the server), no validity checks, no unified alert center or PR comments, and higher maintenance cost.
Final quiz (12 questions, covering all modules)
Sources and version notes
| Topic | Verified finding | Source (accessed 2026-11-15) |
|---|---|---|
| Organization policies | Third-party OAuth (off by default for new organizations; affects only Azure DevOps OAuth apps), SSH, SSH key expiration validation (on by default; notifications 7 days before and after expiry), Log audit events, restrict PAT creation, allow public projects, additional protection for public registries, IP CA non-interactive validation, external guests, invitations, access requests, feedback; tenant level: restrict organization creation, restrict global/full-scope PATs, maximum lifespan; public projects are retired and become private starting 2027 | Change application connection and security policies(page updated 2026-11-03) |
| Conditional Access | Resource ID 499b84ac-1321-427f-aa17-267ca6975798; all interactive flows are validated; non-interactive flows are blocked if MFA cannot be satisfied; IP validation requires an organization policy; IPv4/IPv6; no longer depends on the ARM audience since 2025-09; supports CAE | Conditional Access policies on Azure DevOps |
| PAT | Avoid PATs; prefer Entra tokens/MI/SP; global PAT deactivation dates: 2027-01-27 at the top of the doc and 2026-12-01 in the best-practices section; 84 characters including the AZDO signature; in Entra organizations, PATs unused for 90 days become inactive; audit events Token.Pat*; usage is not recorded; the Lifecycle API requires a user-delegated Entra token | Use personal access tokens(ms.date 2026-09-21) · Sprint 270 |
| PAT policies | Restrict global/full-scope/maximum lifespan: off by default; automatic revocation of leaked PATs: on by default; organization-level restrict PAT creation: off by default (packaged scopes only, allowlist, block global PAT use and GCM-generated PATs); applies only to new or renewed PATs; for the allowlist, use a group | Manage PATs using policies |
| Checks and approvals | Five categories and their order; configurable objects: environments, service connections, repositories, variable groups, secure files, agent pools; a service connection cannot be specified with a variable; the approver list is fixed at the start; bypass requires the resource administrator; exclusive lock runLatest (default) / sequential | Pipeline deployment approvals |
| Pipeline security settings | Limit job authorization scope (non-release/release), protect access to repositories in YAML pipelines (does not apply to GitHub repos), new organizations block creating classic pipelines by default; forks: restrict and disable fork PR builds by default, secure build options; restrict queued variables; shell task argument validation (task list and original error text); service connections start being automatically disabled after 100 days unused; Project Collection Service Accounts inherit PCA | Access repositories from pipelines · Securely use variables and parameters · Secure agents, projects, and containers |
| Key Vault variable groups | Only names are mapped, values are retrieved at runtime, new secrets require manual mapping, only secrets are supported; Get/List or Key Vault Secrets User; RBAC + private endpoint not supported | Link a variable group to Key Vault |
| Secure files | 10 MB per file; cannot be edited after upload; YAML needs authorization; DownloadSecureFile@1, agent ≥ 2.182.1 | Secure files |
| GHAzDO products and features | Split into Secret Protection / Code Security; push protection evaluates only pushes after it is enabled; repository scanning includes history; CodeQL default setup languages and weekly schedule; advanced setup task names; status checks AllHighAndCritical / NewHighAndCritical; Copilot Autofix public preview | Configure GHAzDO features(2026-11-06) · Code scanning |
| GHAzDO billing and pricing | Active committers (pushes in the last 90 days), deduplicated across subscriptions and products, metered daily and billed monthly; Code Security $30, Secret Protection $19 / committer / month (the pricing page marks these as estimates); migration from the bundled version is irreversible | Billing for GHAzDO · Azure DevOps Services pricing |
| Push protection bypass | The commit message includes skip-secret-scanning:true; an alert is still generated after a bypass; for fake values, add a Placeholder prefix. | Secret scanning |
| Auditing | Public preview; Entra organizations only; off by default (Log Audit Events); 90 days, not configurable; fields; CSV/JSON; blind spots (sign-ins, Entra group members, indirect additions) | Access, export, and filter audit logs |
| Audit streams | Splunk (HEC; do not enable indexer acknowledgment), Azure Monitor Logs (table AzureDevOpsAuditing, workspace default 30 days), Azure Event Grid (Event Grid Schema); ≤ 30-minute batches; 2 streams per target type; 7-day backfill on re-enable | Create audit streaming(2026-11-09) |
| Branch policy CLI: | az repos policy approver-count create the --repository-id is required; --branch-match-type exact|prefix | az repos policy approver-count |
| Pricing (users and parallel jobs) | The first 5 Basic users are free, then $6/user/month; 1 free Microsoft-hosted parallel job (1,800 minutes/month) and 1 self-hosted parallel job; additional hosted jobs $40/month, self-hosted $15/month | Azure DevOps Services pricing |
Video verification notes
The following videos were all checked for title and channel on 2026-11-15 via the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json) verified the titles and channels: John Savill's Technical Training “Azure AD Conditional Access Overview” (G0pyhveHJmg), “Using Conditional Access with Authentication Flows” (A1-kSuLLNLI), “Microsoft Azure Managed Identity Deep Dive” (rC1TV0_sIrM); An IT Professional “Personal Access Tokens (PATs) in Azure DevOps | Azure DevOps” (pmhrSatw-kQ); CoderDave “Azure DevOps Environments: Checks and Gates DEEP DIVE” (FbXKpo6oEyg), “Templates in Azure Pipelines: What, Why, and How” (UQlRITs7veM); Azure Infrastructure, Security & DevOps Series “Approval checks on Azure DevOps service connection” (xDfMK8iVsdc), “Environments and approvals in Azure DevOps” (tCZ3958W3WI); Julie Ng “Azure Pipelines Variables - Naming, Reuse and Secrets” (55A6v0mu64g); MadeForCloud “Variables and Variables Group in Azure DevOps YAML Pipeline | Key Vault Secret Integration Demo” (HMKGjiOqXo8); Microsoft Developer “Implementing GitHub Advanced Security for Azure DevOps” (Rdlo33QYvXk); Microsoft Global Black Belts “GitHub Advanced Security, Azure DevOps and Microsoft Defender for Cloud DevOps Security” (1lH2q3pQB1I); GitHub “Introduction to secret leaks and getting started with GitHub Secret Protection” (vMhDkt5JNN0); Houssem Dellai “Adding Security to DevOps using CodeQL” (GCtkz6qllcA); DevStoriesEU “Azure Pipelines · 10/10 · Enterprise Gates: Approvals and Checks” (LDuYtOlrsxY); DevOps & GitHub Meetup Brighton & London “Azure DevOps Auditing Streams” (gaY_IVUukeA); Captain Hyperscaler “Analyzing Azure DevOps auditing streams in your SIEM of choice with James Cook and Peter De Tender” (KHL19h3Pufo); Cyber With Adnan “Azure DevOps Audit Logs Stream in Microsoft Sentinel | Microsoft Sentinel Tutorial” (BckKoovD7m8); Microsoft Learn “Introduction to GitHub Advanced Security | GH-500 | Episode 1” (hb7AllAd7l0). oEmbed can only verify titles and channels; it does not include publish dates; some videos were recorded before product renames or splits, so the body text of this lesson takes precedence.
Audio narration notes
The “Audio” tab uses the browser's Web Speech API (speechSynthesis, en-US) to read the narration script aloud in real time, with English terms pronounced in en-US. The result depends on the voices installed in the operating system. The environment that generated this courseware cannot call a TTS service, so there is no embedded MP3; for offline audio, pass the narration script to any TTS tool.
Known limitations
- The global PAT deactivation date is inconsistent within the official docs (2026-12-01 vs. 2027-01-27); this lesson lists both and recommends following the earlier date. Check the latest release notes for the authoritative date.
- Auditing is still in public preview, and event names (actionId) and fields may change; in this lesson, except for
Token.*(listed in the PAT docs), the other actionId examples are illustrative; use what the_apis/audit/actionsreturns as authoritative.AzureDevOpsAuditingTable column names follow the workspace schema. - IDs, IPs, times, counts, error enum values, and so on in “Expected output” are examples; some REST response fields (such as the PAT's
targetAccounts, check configuration'stype.name, and audit stream'sstatus) follow the actual JSON. - Organization policies and organization-level pipeline settings have no public, stable write REST interface, so this lesson focuses on UI operations; create check configurations in the UI and export them for archiving via REST.
- GHAzDO prices come from the Azure pricing page (marked as estimates) and may vary by region, agreement, and currency; confirm the pricing page's original text for cases with no additional license fee.
- The push protection simulator uses simplified rules and is only for explaining the mechanism; the detection patterns and validity checks of the real service are determined server-side. The times, batches, and scores in the animations are illustrative values.
- Conditional Access, Entra access reviews, and workload identity CA require the corresponding Entra licenses and admin roles; without permissions, you can only read or use report-only mode.