Azure DevOps AZ-400 Labs

Hands-on PBQ labs for the AZ-400 exam: build Azure Pipelines with YAML, manage infrastructure with Bicep and deployment stacks, and implement release gates with Azure Monitor alerts and approval workflows.

These labs cover all DevOps & container certifications including:

KCNADCAKCSATerraform AssociateCKAD
CKACKSAWS DevOps ProfessionalAzure DevOps AZ-400Google Prof. Cloud DevOps

Azure DevOps AZ-400 Labs - Module 9

Professional Azure DevOps labs with CI/CD pipelines, IaC with Bicep, and release quality gates - aligned to the AZ-400 exam.

Lab 25: Azure Pipelines YAML CI/CD
Azure / GUI + Terminal
Scenario: Multi-Stage Pipeline
Your team needs a multi-stage YAML pipeline for the webapp-api. Configure a build stage with .NET SDK, a test stage with code coverage, and a deploy stage targeting Azure App Service. Add environment approvals before production.
AZ-400 Lab

Learning Objectives:

  • Azure Pipelines: multi-stage YAML, triggers, pools
  • Build/Test: .NET restore, build, test with coverage
  • Environments: approvals and checks
  • Deploy: Azure App Service deployment

Step-by-Step Instructions

  1. Step 1: Configure trigger + pool
    In the Pipeline Console, set:
    Trigger = main Pool = ubuntu-latest
    Then click Set Trigger.
  2. Step 2: Configure Build stage
    Set:
    SDK = dotnet-6 Project = webapp-api
    Then click Create Build Stage.
  3. Step 3: Configure Test stage
    Set:
    Coverage = enabled Threshold = 80%
    Then click Create Test Stage.
  4. Step 4: Configure Deploy stage
    Set:
    Target = App Service Environment = production Approval = required
    Then click Create Deploy Stage.
  5. Step 5: Generate pipeline YAML
    Click Generate YAML.
  6. Step 6: Trigger pipeline run
    In the Terminal:
    az pipelines run --name webapp-api-pipeline
    Expected: build + test succeed, deploy waits for approval.

Azure DevOps Lab Environment

Pipeline Console
Terminal
Azure Pipelines BuilderOrg: certlabs-demo
Trigger + Pool
Build + Test + Deploy
Pipeline Status
Build--
Test--
Deploy--
YAMLNo
Configuration
Trigger--
SDK--
Coverage--
Approval--
Activity Log
[system]Pipeline console ready.
az@devops:~$
Progress: 0/6
Score: 0/100
After Completing All Steps:

1. Validate to see pipeline checklist.
2. View Architecture for stage flow.
3. Reset to re-practice.
0%

Lab Completed!

Lab 26: Bicep IaC + Deployment Stacks
Azure / GUI + Terminal
Scenario: Safe Infrastructure Updates
The platform team must deploy new Azure resources using Bicep templates with deployment stacks to prevent orphaned resources. Create a deployment stack, run what-if to preview changes, then deploy with deny-settings to protect critical resources.
AZ-400 Lab

Learning Objectives:

  • Bicep: modules, parameters, outputs
  • Deployment Stacks: managed lifecycle, deny settings
  • What-If: preview changes before deploy
  • Protection: deny-settings to prevent deletion

Step-by-Step Instructions

  1. Step 1: Select Bicep template
    In the Deployment Console, set:
    Template = app-infra.bicep Resource Group = rg-webapp-prod
    Then click Load Template.
  2. Step 2: Create deployment stack
    Set:
    Stack = webapp-stack Deny Settings = denyDelete
    Then click Create Stack.
  3. Step 3: Run What-If
    Click What-If to preview resource changes.
    Tip: Always preview before deploying to production.
  4. Step 4: Deploy stack
    Click Deploy to apply the stack.
  5. Step 5: Verify deny-settings
    In Terminal:
    az stack group show --name webapp-stack --resource-group rg-webapp-prod
  6. Step 6: Test deletion protection
    az resource delete --ids /subscriptions/sub-123/resourceGroups/rg-webapp-prod/providers/Microsoft.Web/sites/webapp-api
    Expected: deletion denied by stack policy.

Azure DevOps Lab Environment

Deployment Console
Terminal
Bicep Deployment Stack ManagerSub: certlabs-sub
Stack Configuration
Stack Status
Stack--
Template--
Deny--
DeployedNo
Resources
What-IfNo
App Service--
App Plan--
ProtectedNo
Activity Log
[system]Deployment console ready.
az@devops:~$
Progress: 0/6
Score: 0/100
After Completing All Steps:

1. Validate to see IaC safety checklist.
2. View Architecture for deployment stack flow.
3. Reset to re-practice.
0%

Lab Completed!

Lab 27: Release Gates + Azure Monitor Alerts
Azure / GUI + Terminal
Scenario: Quality Gates for Production Release
Before releasing to production, configure Azure Monitor metric alerts on error rate, create a release gate that checks alert status, and verify the gate blocks deployment when alerts are firing. Once resolved, the gate should pass automatically.
AZ-400 Lab

Learning Objectives:

  • Azure Monitor: metric alerts, action groups
  • Release Gates: automated quality checks
  • Gate logic: block deploy when alerts fire
  • Resolution: auto-pass after alert resolves

Step-by-Step Instructions

  1. Step 1: Create metric alert
    In the Gates Console, set:
    Resource = webapp-api Metric = Http5xx Threshold = 10
    Then click Create Alert.
  2. Step 2: Create action group
    Set:
    Action = ops-team-notify
    Then click Create Action Group.
  3. Step 3: Create release gate
    Set:
    Gate = AzureMonitorAlerts Severity = Sev0-Sev1
    Then click Create Gate.
  4. Step 4: Simulate alert firing
    In Terminal:
    az monitor metrics alert trigger --name webapp-error-alert --resource-group rg-webapp-prod
    Expected: gate blocks deployment.
  5. Step 5: Resolve alert
    az monitor metrics alert resolve --name webapp-error-alert --resource-group rg-webapp-prod
  6. Step 6: Verify gate passes
    az pipelines release gates check --gate-name AzureMonitorAlerts
    Expected: gate status = Passed.

Azure DevOps Lab Environment

Gates Console
Terminal
Release Gates + Azure MonitorEnv: production
Metric Alert
Release Gate
Alert Status
Alert--
State--
Action Group--
FiredNo
Gate Status
Gate--
Severity--
Result--
DeployBlocked
Activity Log
[system]Gates console ready.
az@devops:~$
Progress: 0/6
Score: 0/100
After Completing All Steps:

1. Validate to see gate + alert checklist.
2. View Architecture for gate flow.
3. Reset to re-practice.
0%

Lab Completed!