πŸ”’ Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AZ-400 Domain 3
Domain 3 β€” Module 4 of 13 31%
10 of 25 overall

AZ-400 Study Guide

Domain 1: Design and Implement Processes and Communications

  • Work Item Tracking: Boards, GitHub & Flow
  • DevOps Metrics: Dashboards That Drive Decisions
  • Collaboration: Wikis, Teams & Release Notes

Domain 2: Design and Implement a Source Control Strategy

  • Branching Strategies: Trunk-Based, Feature & Release
  • Pull Requests: Policies, Protections & Merge Rules
  • Repository Management: LFS, Permissions & Recovery

Domain 3: Design and Implement Build and Release Pipelines

  • Package Management: Feeds, Versioning & Upstream
  • Testing Strategy: Quality Gates & Release Gates
  • Test Implementation: Code Coverage & Pipeline Tests
  • Azure Pipelines: YAML from Scratch Free
  • GitHub Actions: Workflows from Scratch Free
  • Pipeline Agents: Self-Hosted, Hybrid & VM Templates
  • Multi-Stage Pipelines: Templates, Variables & Approvals
  • Deployment Strategies: Blue-Green, Canary & Ring Free
  • Safe Rollouts: Slots, Dependencies & Hotfix Paths
  • Deployment Implementations: Containers, Scripts & Databases
  • Infrastructure as Code: ARM vs Bicep vs Terraform
  • IaC in Practice: Desired State & Deployment Environments
  • Pipeline Maintenance: Health, Migration & Retention

Domain 4: Develop a Security and Compliance Plan

  • Pipeline Identity: Service Principals, Managed IDs & OIDC Free
  • Authorization & Access: GitHub Roles & Azure DevOps Security
  • Secrets & Secure Pipelines: Key Vault & Workload Federation
  • Security Scanning: GHAS, Defender & Dependabot

Domain 5: Implement an Instrumentation Strategy

  • Monitoring for DevOps: Azure Monitor & App Insights
  • Metrics & KQL: Analysing Telemetry & Traces

AZ-400 Study Guide

Domain 1: Design and Implement Processes and Communications

  • Work Item Tracking: Boards, GitHub & Flow
  • DevOps Metrics: Dashboards That Drive Decisions
  • Collaboration: Wikis, Teams & Release Notes

Domain 2: Design and Implement a Source Control Strategy

  • Branching Strategies: Trunk-Based, Feature & Release
  • Pull Requests: Policies, Protections & Merge Rules
  • Repository Management: LFS, Permissions & Recovery

Domain 3: Design and Implement Build and Release Pipelines

  • Package Management: Feeds, Versioning & Upstream
  • Testing Strategy: Quality Gates & Release Gates
  • Test Implementation: Code Coverage & Pipeline Tests
  • Azure Pipelines: YAML from Scratch Free
  • GitHub Actions: Workflows from Scratch Free
  • Pipeline Agents: Self-Hosted, Hybrid & VM Templates
  • Multi-Stage Pipelines: Templates, Variables & Approvals
  • Deployment Strategies: Blue-Green, Canary & Ring Free
  • Safe Rollouts: Slots, Dependencies & Hotfix Paths
  • Deployment Implementations: Containers, Scripts & Databases
  • Infrastructure as Code: ARM vs Bicep vs Terraform
  • IaC in Practice: Desired State & Deployment Environments
  • Pipeline Maintenance: Health, Migration & Retention

Domain 4: Develop a Security and Compliance Plan

  • Pipeline Identity: Service Principals, Managed IDs & OIDC Free
  • Authorization & Access: GitHub Roles & Azure DevOps Security
  • Secrets & Secure Pipelines: Key Vault & Workload Federation
  • Security Scanning: GHAS, Defender & Dependabot

Domain 5: Implement an Instrumentation Strategy

  • Monitoring for DevOps: Azure Monitor & App Insights
  • Metrics & KQL: Analysing Telemetry & Traces
Domain 3: Design and Implement Build and Release Pipelines Free ⏱ ~15 min read

Azure Pipelines: YAML from Scratch

Master Azure Pipelines YAML syntax β€” stages, jobs, steps, triggers, and pipeline structure. Build CI pipelines that compile, test, and validate your code automatically on every push.

What is Azure Pipelines YAML?

β˜• Simple explanation

Think of a recipe card in a restaurant kitchen.

A recipe says: β€œFirst, prep the vegetables (stage 1). Then, cook the sauce (stage 2). Finally, plate the dish (stage 3).” Each stage has specific steps β€” chop onions, heat oil, add garlic. The recipe lives in the recipe book, and every chef follows the same instructions to produce a consistent dish.

Azure Pipelines YAML is the recipe for building and deploying software. It lives in your Git repository (the recipe book), and every pipeline run follows the same instructions. Stages are the major phases (build, test, deploy). Jobs are the workstreams within a stage. Steps are the individual commands β€” β€œinstall dependencies,” β€œrun tests,” β€œpublish artefacts.”

Azure Pipelines executes CI/CD workflows defined in a YAML file (typically azure-pipelines.yml) stored in your repository. This β€œpipeline as code” approach means your build and deployment logic is versioned, reviewed, and auditable alongside your application code.

The YAML hierarchy follows a strict structure: Pipeline contains Stages, Stages contain Jobs, Jobs contain Steps. For simple pipelines, you can skip stages and jobs β€” Azure Pipelines infers them β€” but the exam expects you to understand the full hierarchy.

Azure Pipelines supports both YAML pipelines (recommended) and Classic pipelines (UI-based, legacy). New features are YAML-first, and Microsoft recommends migrating Classic to YAML. The exam heavily favours YAML.

The YAML hierarchy

Every Azure Pipeline follows this structure:

Pipeline
  └── Stages
       └── Jobs
            └── Steps (scripts or tasks)
LevelWhat It RepresentsRuns OnParallelism
PipelineThe entire CI/CD workflowN/A β€” container for stagesN/A
StageA major phase (Build, Test, Deploy)A logical group of jobsStages run sequentially by default, parallel with dependsOn: []
JobA unit of work assigned to one agentOne agent (Microsoft-hosted or self-hosted)Jobs within a stage run in parallel by default
StepA single command or taskOn the job’s agentSteps always run sequentially within a job

Minimal pipeline β€” single stage, single job

When you have a simple CI build, you can skip the stages and jobs keywords:

trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

steps:
  - script: echo Hello, World!
    displayName: 'Run a simple script'
  - script: dotnet build
    displayName: 'Build the project'

Azure Pipelines automatically wraps this in a single stage (β€œ__default”) and a single job (β€œJob”). This is fine for simple builds, but production pipelines almost always use explicit stages and jobs.

Full multi-stage pipeline

trigger:
  branches:
    include:
      - main
      - release/*

stages:
  - stage: Build
    displayName: 'Build and Test'
    jobs:
      - job: BuildJob
        pool:
          vmImage: 'ubuntu-latest'
        steps:
          - task: DotNetCoreCLI@2
            inputs:
              command: 'build'
          - task: DotNetCoreCLI@2
            inputs:
              command: 'test'
              arguments: '--collect:"XPlat Code Coverage"'
          - task: PublishBuildArtifacts@1
            inputs:
              PathtoPublish: '$(Build.ArtifactStagingDirectory)'
              ArtifactName: 'drop'

  - stage: DeployStaging
    displayName: 'Deploy to Staging'
    dependsOn: Build
    jobs:
      - deployment: DeployToStaging
        environment: 'staging'
        strategy:
          runOnce:
            deploy:
              steps:
                - script: echo Deploying to staging...

Key observations:

  • dependsOn: Build makes the Deploy stage wait for Build to succeed
  • The deployment job type enables environment tracking and approval gates
  • The environment keyword links the job to an Azure DevOps environment for governance

Trigger types

Triggers define when a pipeline runs. The exam tests all five types:

CI trigger (continuous integration)

Runs when code is pushed to specified branches:

trigger:
  branches:
    include:
      - main
      - release/*
    exclude:
      - feature/experimental
  paths:
    include:
      - src/**
    exclude:
      - docs/**

Path filters are powerful β€” a pipeline that only builds when src/ changes avoids unnecessary runs when you only edit documentation.

PR trigger (pull request validation)

Runs when a pull request targets specified branches:

pr:
  branches:
    include:
      - main
  paths:
    include:
      - src/**

Important distinction: CI triggers fire on push. PR triggers fire when a PR is opened, updated, or re-opened.

Scheduled trigger

Runs on a cron schedule:

schedules:
  - cron: '0 2 * * 1-5'
    displayName: 'Weeknight build at 2 AM'
    branches:
      include:
        - main
    always: true

The always: true flag means the pipeline runs even if no code has changed since the last run.

Pipeline trigger (pipeline completion)

Runs when another pipeline completes:

resources:
  pipelines:
    - pipeline: buildPipeline
      source: 'MyApp-CI'
      trigger:
        branches:
          include:
            - main

This is how you chain a CI pipeline to a CD pipeline β€” the deployment pipeline triggers when the build pipeline succeeds.

Manual trigger

Any pipeline can be run manually from the Azure DevOps UI or REST API. You can also disable automatic triggers entirely:

trigger: none
pr: none

This creates a pipeline that only runs when manually queued or triggered by another pipeline.

πŸ’‘ Exam tip: trigger none vs trigger omitted

This is a common exam trap:

  • trigger: none explicitly disables CI triggers β€” the pipeline never runs on push
  • Omitting the trigger keyword entirely uses the default β€” which triggers on ALL branches

If you forget to add trigger: to your YAML, the pipeline runs on every push to every branch. Always be explicit.

Same applies to pr: β€” omitting it enables PR triggers on all branches (in Azure Repos). For GitHub repos, PR triggers are controlled by branch policies, not the YAML pr: keyword.

Connecting GitHub repos to Azure Pipelines

Azure Pipelines can build code from GitHub repositories. The connection requires:

  1. Service connection β€” a GitHub service connection in Azure DevOps (OAuth or PAT-based)
  2. Azure Pipelines GitHub App β€” installed on the GitHub organisation for deeper integration (check run annotations, PR comments)
  3. YAML file in the repo β€” azure-pipelines.yml at the root of the GitHub repository

Once connected, Azure Pipelines receives webhook events from GitHub (push, PR) and triggers pipeline runs. Build status is reported back to GitHub as check runs.

Why choose Azure Pipelines for a GitHub repo? When the team needs Azure Pipelines-specific features β€” YAML environments with approval gates, multi-stage release pipelines, Azure Boards integration for work item linking, or when the organisation already has Azure DevOps for project management.

Steps: scripts vs tasks

Steps are the atomic units of work in a pipeline:

Script steps

- script: npm install && npm test
  displayName: 'Install and test'
  • Runs a command on the agent’s shell (bash on Linux/macOS, cmd on Windows)
  • Use bash: for cross-platform bash scripts
  • Use powershell: or pwsh: for PowerShell

Task steps

- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: '**/*.csproj'
  • Tasks are pre-built, versioned, reusable automation units
  • The @2 suffix pins the major version β€” you get minor/patch updates but not breaking changes
  • Available from the built-in task library or the Azure DevOps Marketplace

When to use which: Use tasks when one exists for your scenario (they handle edge cases, logging, and error handling). Use scripts for simple or custom commands where no task exists.

YAML vs Classic pipelines

YAML pipelines are the future β€” version-controlled, template-ready, and receiving all new features
FeatureYAML PipelinesClassic Pipelines
DefinitionCode in a YAML file stored in the repositoryUI-based β€” configured through the Azure DevOps web interface
Version controlFully versioned with Git β€” every change is tracked, reviewable, and auditableNot version-controlled β€” changes are tracked in revision history but not in Git
Branch-specificDifferent branches can have different pipeline definitionsOne pipeline definition applies to all branches
TemplatesFull template support β€” reusable stages, jobs, steps across pipelinesTask groups provide limited reuse
Multi-stageNative β€” stages, environments, deployment jobs, approvalsBuild and release are separate systems (build definitions + release definitions)
PR reviewPipeline changes go through PR review like any code changeNo PR review β€” changes take effect immediately
New featuresAll new pipeline features are YAML-firstMaintenance mode β€” no major new features
MigrationRecommended for all new pipelinesMigrate existing Classic pipelines to YAML when feasible
πŸ’‘ Scenario: Nadia's migration from Classic to YAML at Meridian Insurance

🏒 Nadia Petrov at Meridian Insurance inherited 47 Classic build definitions and 23 Classic release definitions. Dmitri (VP Engineering) wants everything in YAML for auditability β€” Elena (compliance) insists that pipeline changes go through the same approval process as code changes.

Nadia’s migration plan:

  1. Export each Classic pipeline using the β€œView YAML” feature (Azure DevOps can generate YAML from Classic definitions)
  2. Refactor β€” don’t just export blindly. Combine build + release into a single multi-stage YAML pipeline
  3. Templates β€” extract common patterns (restore, build, test, publish) into shared YAML templates
  4. Branch policies β€” PR review required on azure-pipelines.yml changes, so Elena gets her audit trail
  5. Migrate incrementally β€” one pipeline per sprint, starting with the lowest-risk projects

Rashid (platform lead) handles the agent pool configuration. The YAML pipelines reference the same agent pools as Classic β€” no infrastructure changes needed.

Question

What is the Azure Pipelines YAML hierarchy?

Click or press Enter to reveal answer

Answer

Pipeline contains Stages. Stages contain Jobs. Jobs contain Steps. Stages run sequentially by default (parallel with dependsOn: []). Jobs within a stage run in parallel by default. Steps within a job always run sequentially. For simple pipelines, stages and jobs can be omitted β€” Azure Pipelines infers them.

Click to flip back

Question

What are the five trigger types in Azure Pipelines?

Click or press Enter to reveal answer

Answer

1) CI trigger β€” runs on push to specified branches. 2) PR trigger β€” runs when a pull request targets specified branches. 3) Scheduled trigger β€” cron-based scheduling. 4) Pipeline trigger β€” runs when another pipeline completes. 5) Manual trigger β€” run from UI or REST API. Each supports branch and path filters.

Click to flip back

Question

What happens when you omit the 'trigger:' keyword in Azure Pipelines YAML?

Click or press Enter to reveal answer

Answer

The pipeline uses the DEFAULT trigger, which fires on every push to EVERY branch. This is a common gotcha β€” if you want to disable CI triggers, you must explicitly write 'trigger: none'. Same for 'pr:' β€” omitting it enables PR triggers on all branches (in Azure Repos).

Click to flip back

Question

How do you chain a CI pipeline to a CD pipeline in Azure Pipelines?

Click or press Enter to reveal answer

Answer

Use a pipeline trigger (pipeline completion trigger). In the CD pipeline YAML, define a resources.pipelines section referencing the CI pipeline by name. Add a trigger block to specify which branches should activate the CD pipeline when the CI pipeline completes successfully.

Click to flip back

Question

What is the difference between a 'script' step and a 'task' step in Azure Pipelines?

Click or press Enter to reveal answer

Answer

Script steps run shell commands directly (bash, cmd, PowerShell). Task steps use pre-built, versioned automation units from the task library (e.g., DotNetCoreCLI@2). Tasks handle logging, error handling, and edge cases. Use tasks when one exists for your scenario; use scripts for custom or simple commands.

Click to flip back

Knowledge check

Knowledge Check

Nadia writes a new Azure Pipelines YAML file but forgets to include a 'trigger:' section. What happens when she pushes code to a feature branch?

Knowledge Check

Kai wants his Azure Pipeline to run only when files in the 'src/' directory change on the main branch. Documentation changes in 'docs/' should NOT trigger a build. Which trigger configuration achieves this?

Knowledge Check

Meridian Insurance has a CI pipeline (Build) and a separate CD pipeline (Deploy). Nadia wants the Deploy pipeline to run automatically whenever Build succeeds on the main branch. How should she configure this in YAML?

🎬 Video coming soon

Next up: GitHub Actions: Workflows from Scratch β€” master GitHub’s CI/CD platform with events, jobs, matrix strategies, and reusable workflows.

← Previous

Test Implementation: Code Coverage & Pipeline Tests

Next β†’

GitHub Actions: Workflows from Scratch

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.