Study guide
7.5 YAML Environments, Checks & Deployment Approvals
Microsoft Certified: Azure DevOps Engineer Expert AZ-400
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Flow of Work, Traceability & Work Tracking
1.1 Flow of Work, GitHub Flow & Feedback Cycles 1.2 Work Tracking with Azure Boards & GitHub Projects 1.3 End-to-End DevOps Traceability & Quality Tracking
2 Chapter 2: DevOps Metrics, Dashboards & Team Collaboration
2.1 DORA Metrics, Flow Metrics & Dashboard Design 2.2 Lifecycle Metrics Across the Six DevOps Phases 2.3 Work Item Queries, WIQL Charts & Analytics 2.4 Project Documentation: Wikis, Mermaid Diagrams & Release Notes 2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
3 Chapter 3: Git Branching Strategies & Pull Request Workflows
3.1 Git Branching Models & Strategy Design 3.2 Pull Request Workflows & Merge Strategies 3.3 Branch Policies, Quality Gates & Compliance Restrictions
4 Chapter 4: Repository Management, Optimization & Git Data Operations
4.1 Git LFS Architecture & .gitattributes Tracking 4.2 LFS History Migration, git-fat & File Locking 4.3 Git Repository Scaling, Scalar & Monorepo Governance 4.4 Repository Permissions & Git Tag Governance 4.5 Git Data Recovery & Sensitive-Data Scrubbing
5 Chapter 5: Package Management & Dependency Versioning
5.1 Selecting Package Tools: Azure Artifacts vs. GitHub Packages 5.2 Feed Scoping, Upstream Sources & Pipeline Authentication 5.3 Package Views, Immutability & Quality Promotion 5.4 Dependency Versioning: SemVer, CalVer & Automated Versioning 5.5 Pipeline Artifact Versioning & Artifact Storage Strategy
6 Chapter 6: Pipeline Infrastructure, Agents & Integration
6.1 Selecting a CI/CD Solution: Azure Pipelines vs. GitHub Actions 6.2 GitHub-Azure Pipelines Integration & Hybrid Migration 6.3 Hosted vs. Self-Hosted Agents & Runners 6.4 VMSS Elastic Pools, Container Jobs & Agent Governance 6.5 Pipeline Triggers, Filters & Concurrency Management
7 Chapter 7: YAML Pipeline Architecture & Reusable Elements
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces 7.2 Job Execution Order: DAG Dependencies, Parallelism & Conditions 7.3 Reusable Elements: Templates, Parameters & Variables 7.4 Variable Groups, Secret Variables & Key Vault Linking 7.5 YAML Environments, Checks & Deployment Approvals
8 Chapter 8: Testing Strategy, Quality Gates & Code Coverage
8.1 Test Strategy Design: Local, Unit & Integration Testing 8.2 Load, Stress & Performance Testing in Pipelines 8.3 Test Execution Tasks, Agents & Results Integration 8.4 Code Coverage Analysis & SonarQube Integration 8.5 Quality Gates, Release Gates & Governance Checks
9 Chapter 9: Modern Deployment Strategies & Zero-Downtime Delivery
9.1 Progressive Delivery: Blue-Green, Canary & Ring Deployments 9.2 Minimizing Downtime: Deployment Slots & Rolling Updates 9.3 Feature Flags with Azure App Configuration & Feature Manager 9.4 Designing the High-Priority Hotfix Path 9.5 Ordered Dependency Deployments, Resiliency & Rollback
10 Chapter 10: Artifact Deployment & Database DevOps
10.1 Containerized Application Delivery: ACR, AKS & Container Apps 10.2 Binary, Web App, Function & Scripted Deployments 10.3 Database DevOps: State-Based & Migration-Based Strategies
11 Chapter 11: Infrastructure as Code (IaC) & Azure Deployment Environments
11.1 Infrastructure as Code Strategy: Bicep, ARM & Terraform 11.2 Desired State Configuration & Azure Machine Configuration 11.3 Azure Deployment Environments (ADE) & Developer Self-Service
12 Chapter 12: Pipeline Maintenance, Health & Modernization
12.1 Pipeline Health, Flaky Tests & Reliability Engineering 12.2 Pipeline Optimization: Caching, Slicing & Concurrency 12.3 Artifact & Build Retention Governance 12.4 Modernizing CI/CD: Classic to YAML Migration
13 Chapter 13: Authentication, Authorization & Identity Governance
13.1 Microsoft Entra Service Principals & Managed Identities 13.2 Service Connections, Workload Identity & Personal Access Tokens 13.3 Azure DevOps Projects, Teams & Permission Evaluation 13.4 Access Levels, GitHub Roles & Outside Collaborators
14 Chapter 14: Secrets Management, Sensitive Data & DevSecOps Scanning
14.1 Azure Key Vault, Secret Variables & Secretless CI/CD 14.2 Security Scanning Strategy, GHAS & Secret Scanning 14.3 CodeQL SAST in Pipelines and Containers 14.4 Software Supply Chain, Container Scanning & Cloud Defender
15 Chapter 15: Telemetry Collection, Azure Monitor & Alerting
15.1 Azure Monitor Architecture, AMA & Data Collection Rules 15.2 Application Insights & Specialized Azure Monitor Insights 15.3 Alerting Rules, Action Groups & GitHub Repository Insights
16 Chapter 16: Telemetry Analysis, Distributed Tracing & SRE Practices
16.1 Distributed Tracing, Application Map & Exception Triage 16.2 KQL Log Analytics, SRE Observability & Error Budgets
7.5 YAML Environments, Checks & Deployment Approvals
Key Takeaways Explain This Topic AI
Environments record deployment history per target and are the only construct that supports approvals and checks in YAML pipelines.
Approvals require a named human or group; branch control restricts which branches may deploy; business hours windows restrict when.
An Invoke REST API or Invoke Azure Function check calls an external system and can poll for a decision, which is how change-management systems gate a release.
The exclusive lock check serialises deployments to one environment, preventing two rapid releases from racing into the same target.
Checks run before the deployment job is dispatched, so a failed check consumes no agent time and leaves no partial deployment.
Last updated: September 2026
7.5 YAML Environments, Checks & Deployment Approvals
Variables configure a deployment; environments govern it. A YAML environment is the named deployment target that carries approvals, automated checks and deployment history, and its checks are evaluated before any agent is dispatched.
1. YAML Environments: Anatomy and Targets
An Environment is a logical collection of physical or virtual resources that can be targeted by deployments (e.g., development , staging , production ). Environments are created under Pipelines → Environments .
Why Use YAML Environments?
Deployment History & Auditing : Tracks every pipeline run, commit, and work item deployed to that specific target environment over time.
Resource Modeling : Environments can map directly to:
Kubernetes : Directly links to AKS clusters and namespaces, allowing teams to visualize pod health, container images, and workload statuses directly in the Azure DevOps portal.
Virtual Machines : Installs the Azure Pipelines agent directly on Linux or Windows VMs, grouping them into deployment pools for rolling in-place updates.
Generic / PaaS : Logical endpoints representing Azure App Services, Azure Functions, or serverless infrastructure.
Decoupled Governance : Critical release gates (approvals, business hours, automated checks) are configured on the Environment in the portal, meaning pipeline authors cannot bypass or disable checks by modifying the YAML file in the repository. # Targeting an Environment in a Deployment Job
- stage: DeployProd
- displayName: 'Production Deployment'
jobs:
- deployment: DeployApp
- displayName: 'Deploy Microservice'
pool:
- vmImage: 'ubuntu-latest'
- environment: 'production.billing-api' # <EnvironmentName>.<ResourceName>
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying to production billing-api workload..."
- 2. Environment Approvals and Automated Checks Matrix
Checks and approvals allow organizations to specify criteria that must be satisfied before a stage targeting an environment is permitted to execute. When a deployment job requests an environment, execution pauses, no agent compute is consumed, and the configured checks are evaluated.
Comprehensive Environment Checks Matrix
Check Type Execution Mode Purpose & Evaluation Mechanics Common AZ-400 Exam Scenario
Manual Approvals Human intervention Requires designated users or Entra ID security groups to review and approve the release. Supports timeout limits and "Prevent approver from deploying their own runs" (Four-Eyes Principle). Production releases requiring explicit sign-off from Release Managers or QA leads.
Branch Control Automated policy Verifies that the code being deployed originates only from approved branches (e.g., refs/heads/main , refs/heads/release/* ). Preventing developers from deploying experimental feature branches directly to staging or production.
Business Hours Automated scheduling Restricts deployments to predefined operational time windows (e.g., Monday through Friday, 09:00–17:00 UTC). If triggered outside, execution waits until the window opens. Enforcing deployments during normal business hours when on-call engineers are available to monitor for incidents.
Invoke REST API Automated external gate Calls an external REST API endpoint (e.g., ServiceNow, Jira, custom compliance service) and parses the response to verify approval status. Integrating with enterprise Change Advisory Boards (CAB) to verify that an approved change ticket exists before deploying.
Invoke Azure Function Automated serverless gate Invokes a serverless Azure Function with pipeline execution metadata to perform complex validation logic. Executing custom pre-deployment health checks, automated security verification, or IP address availability checks.
Azure Monitor Alerts Automated observability Queries Azure Monitor to ensure no active alerts (Sev 0, Sev 1, Sev 2) exist on the target infrastructure before proceeding. Ensuring production infrastructure is healthy and not experiencing active incidents before deploying updates.
Required Template Automated structural policy Mandates that the pipeline triggering the deployment extends a specified corporate YAML template. Enforcing that all pipelines targeting production inherit corporate security scanning and auditing stages.
Exclusive Lock Automated concurrency control Ensures that only a single pipeline run can deploy to the target environment at any given time. Preventing concurrent deployments from racing, executing out of order, or conflicting on database migrations.
The Exclusive Lock Check: Preventing Race Conditions
In fast-moving teams with multiple developers merging pull requests, multiple pipeline runs can be triggered in rapid succession. Without concurrency control, Pipeline Run #101 (older commit) might deploy after Pipeline Run #102 (newer commit), resulting in regression.
Configuring the Exclusive Lock check on an environment guarantees sequential, serialized execution. When Run #101 enters the deployment stage, it acquires the exclusive lock on production . Run #102 will wait until Run #101 completes its deployment and releases the lock. Furthermore, Azure Pipelines provides an option to deploy only the latest queued run upon lock release, automatically canceling superseded intermediate runs.
- 3. Realistic Exam Scenarios & Common Traps
- Scenario: Financial Core Banking Compliance Pipeline
Context : Contoso Bank is modernizing their core payment gateway deployment to an Azure Kubernetes Service (AKS) cluster. Banking regulations require:
Zero credentials stored in Azure DevOps.
Deployments to production must only happen from the main branch.
A Change Request in ServiceNow must be in the Approved state.
Deployments must occur between 02:00 and 05:00 UTC to minimize customer impact.
Only one pipeline run may deploy at any time to prevent database schema conflicts.
DevOps Solution Architecture :
Configure an Azure Key Vault Linked Variable Group connected via an ARM Service Connection using Workload Identity Federation to securely provide database connection strings and TLS certificates.
Define an Environment named Production-AKS .
Configure five automated checks on the Production-AKS environment in Azure DevOps Project Settings:
Branch Control : Allowed branches set to refs/heads/main .
Invoke REST API : Configured with a ServiceNow service connection to poll the change ticket status until it returns status: Approved .
Business Hours : Configured for 02:00–05:00 UTC daily.
Exclusive Lock : Enabled to serialize all deployments.
Manual Approvals : Assigned to the Core Banking CAB security group.
In the YAML pipeline, target the environment in a deployment job: environment: 'Production-AKS' .
Common Exam Traps to Avoid
Trap: Believing environment checks can be configured or bypassed inside YAML. Checks and approvals are managed exclusively through the Azure DevOps web portal under Pipelines → Environments → [Environment] → Approvals and checks . A developer cannot disable an approval gate or REST check by editing the YAML file in Git.
Trap: Forgetting to map secret variables in custom scripts. Attempting to call $MY_SECRET in a bash step without defining env: MY_SECRET: $(mySecret) results in an empty variable, causing scripts to fail with authentication errors.
Trap: Confusing Exclusive Lock on an Environment with Agent Pool concurrency. Agent pool concurrency limits how many jobs run across your pool. The Exclusive Lock on an Environment specifically serializes deployments to that target resource, regardless of how many parallel agent slots your organization has licensed.