Study guide
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces
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.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces
Key Takeaways Explain This Topic AI
The hierarchy is pipeline, stage, job, step; a stage is a governance and approval boundary while a job is the unit scheduled onto an agent.
Stages run sequentially by default and jobs inside a stage run in parallel by default, limited only by available parallelism.
Each job is allocated its own agent and its own workspace, so files written by one job are not visible to another without a published artifact.
A deployment job differs from a regular job by targeting an environment, recording deployment history and supporting strategies such as runOnce, rolling and canary.
Steps are tasks or scripts executed sequentially in a single job; a failing step fails the job unless continueOnError is set.
Last updated: September 2026
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces
Azure Pipelines uses YAML (YAML Ain't Markup Language) to define CI/CD pipelines as version-controlled code residing directly within your source code repository. Modern enterprise delivery architectures demand pipelines that can cleanly separate concerns: compiling code, executing static analysis, deploying infrastructure, and running integration tests across diverse environments with granular gates.
To pass the AZ-400 exam and architect resilient enterprise delivery systems, candidates must master the core hierarchical anatomy of Azure Pipelines YAML, understand agent and workspace execution boundaries, orchestrate parallel and sequential execution using Directed Acyclic Graphs (DAGs), and configure advanced execution condition expressions.
1. Core Hierarchical Anatomy: Pipeline, Stages, Jobs, Steps
The Azure Pipelines YAML document follows an explicit four-tier hierarchy. Every element in the pipeline belongs to a parent container that dictates scheduling, agent assignment, and execution isolation. Pipeline (Root Configuration, Triggers, Global Variables, Resources)
- └── Stages (Major Milestone Boundaries: Build, QA, Staging, Production)
- └── Jobs (Scheduling Units Assigned to Individual Agents)
- └── Steps (Sequential Execution Units: Tasks, Scripts, Checkouts)
- The Root Pipeline
The root level of the YAML document defines global attributes governing the entire pipeline lifecycle:
trigger : Dictates continuous integration (CI) triggers based on branch commits, tags, or path filters.
pr : Controls pull request validation triggers.
schedules : Configures cron-based recurring execution schedules.
resources : Declares dependent external artifacts, repositories, container registries, packages, or build pipelines.
variables : Sets pipeline-wide variables accessible across all stages.
pool : Defines the default agent pool if not overridden at the stage or job level.
stages : The top-level collection containing one or more deployment or build stages.
Stages ( stage: ) — Architectural Isolation Boundaries
A Stage represents the highest-level operational milestone within a pipeline (e.g., Build , SecurityScan , DeployDev , DeployProd ). Stages provide critical isolation boundaries:
Security & Governance : Approvals, checks, and release gates can be enforced at stage boundaries.
Agent Pool Selection : Stage A can run on a Linux Microsoft-hosted pool ( ubuntu-latest ), while Stage B executes on a private, self-hosted Windows agent pool with on-premises network line-of-sight.
Independent Topologies : Stages can run sequentially or in parallel based on explicit dependsOn declarations.
If a pipeline defines only jobs without an explicit stages: block, Azure Pipelines automatically wraps all jobs in a single synthetic, invisible default stage.
Jobs ( job: and deployment: ) — Agent Scheduling Units
A Job is the fundamental scheduling and execution unit dispatched to an individual pipeline agent. All steps within a single job run on the exact same agent virtual machine or container. Azure Pipelines supports two primary job types:
Standard Jobs ( job: <name> ) :
Used for compilation, automated testing, container image packaging, and script execution.
Executes within a fresh workspace on the assigned agent.
Supports execution strategies: matrix (running the same job across multiple OS/runtime configurations) and parallel (slicing workloads across N agents).
Deployment Jobs ( deployment: <name> ) :
Specifically designed for delivering software to an Environment (e.g., Azure Kubernetes Service, App Service, Virtual Machine pools).
Automatically records deployment history, work items, and commits against the target environment in the Azure DevOps portal.
Replaces the generic steps: block with structured deployment lifecycle hooks :
preDeploy : Steps executed before deployment begins (e.g., draining connections, provisioning prerequisites).
deploy : Steps that perform the actual deployment action.
routeTraffic : Steps that shift traffic to the updated version (e.g., swapping App Service slots, updating ingress rules).
postRouteTraffic : Steps executed after traffic routing to verify health (e.g., synthetic monitoring).
on: failure / on: success : Automated rollback or cleanup steps.
- Supports deployment strategies: runOnce , rolling , and canary . # Example Deployment Job Anatomy
- deployment: DeployProductionWeb
- displayName: 'Deploy to Production AKS'
pool:
- vmImage: 'ubuntu-latest'
- environment: 'production.microservices'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: KubernetesManifest@1
- displayName: 'Deploy Kubernetes Manifests'
inputs:
- action: 'deploy'
- manifests: '$(Pipeline.Workspace)/manifests/*.yaml'
- Steps ( steps: ) — Sequential Execution Units
A Step is the lowest-level linear action executed within a job. Steps execute sequentially on the agent. If any step fails, subsequent steps are skipped by default unless an explicit condition override is configured.
Common step primitives include:
task: : Executes a pre-packaged task from the Azure DevOps Marketplace (e.g., task: DotNetCoreCLI@2 , task: AzureCLI@2 , task: Docker@2 ).
script: : Runs a cross-platform shell script (Bash on Linux/macOS, Command Prompt on Windows).
bash: : Explicitly invokes a Bash shell environment ( /bin/bash ).
powershell: : Invokes Windows PowerShell ( powershell.exe ).
pwsh: : Invokes cross-platform PowerShell Core ( pwsh ).
checkout: : Configures repository source code retrieval ( checkout: self , checkout: none , or referencing external repository resources).
template: : References a reusable step template file.
2. Execution Boundaries and Workspace Lifecycles
A critical concept tested on the AZ-400 exam is the boundary of state and persistence across stages and jobs.
Dimension Stage Boundary Job Boundary Step Boundary
Agent Allocation Can change agent pools entirely Dispatched to a separate, independent agent Runs on the same agent instance
Disk Persistence None (different VMs/containers) None (workspace is wiped or isolated) Shared local disk workspace
Environment Variables Not shared automatically Not shared automatically Retained across steps in the job
Artifacts Passing Requires Publish/Download Artifacts Requires Publish/Download Artifacts Direct local file path access
Failure Propagation Downstream stages skipped unless conditioned Sibling/downstream jobs skipped unless conditioned Halts subsequent steps in the job
Workspace Isolation Mechanics
When a job begins execution on an agent:
The agent allocates a dedicated working directory: $(Agent.BuildDirectory) (also aliased as $(Pipeline.Workspace) ).
The repository is cloned into $(Pipeline.Workspace)/s (unless checkout: none is specified).
Binaries and test outputs written to disk during Job 1 do not exist on the agent assigned to Job 2, even if both jobs belong to the same stage. To share files between jobs or stages, you must publish them as pipeline artifacts using PublishPipelineArtifact@1 (or publish: shorthand) and retrieve them using DownloadPipelineArtifact@2 (or download: shorthand). # Job 1: Publishing Build Artifacts
- job: BuildJob
steps:
- script: npm run build
- publish: $(System.DefaultWorkingDirectory)/dist
- artifact: WebAppDrop
- # Job 2: Downloading Artifacts
- job: TestJob
- dependsOn: BuildJob
steps:
- download: current
- artifact: WebAppDrop
- script: ls -la $(Pipeline.Workspace)/WebAppDrop