AZ-400 Set approval after stage completion. Practice Question
You have a multi-stage YAML pipeline with stages: Build, Test, and Deploy. The Deploy stage requires approval from a specific user group. You want to ensure that the approval request is sent only after the Test stage completes successfully. Which configuration should you use?
⚠ Common exam trap
Many candidates confuse manual validation tasks (Option A) with environment-based approvals, not realizing that environment approvals are the native, recommended way to enforce stage-level approval gates in YAML pipelines.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Define an environment with required approvers and reference it in the Deploy stage.
Azure Pipelines environments allow you to define required approvers (user groups) that must approve a deployment before it proceeds. By referencing the environment in the Deploy stage, the approval request is automatically triggered only after the preceding Test stage completes successfully, since stages execute sequentially by default.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add a manual validation task in the Deploy stage.
Why it's wrong here
A manual validation task only pauses the pipeline for a manual check and does not integrate with Azure Pipelines' environment approval system; it cannot enforce a persistent list of required approvers or provide the same governance tracking and auditability as environment-level approvals.
- ✓
Define an environment with required approvers and reference it in the Deploy stage.
Why this is correct
Defining an environment with required approvers and referencing that environment in the Deploy stage adds a pre-deployment approval gate that must be completed before the stage runs, giving you a first-class, audit-ready mechanism for human sign-off on production deployments.
- ✗
Use the 'condition' keyword: condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
Why it's wrong here
The 'condition' keyword evaluates pipeline variables like Build.SourceBranch to decide whether a stage runs, but it is a branching/trigger control, not an approval mechanism; it cannot require a human approver or track who approved the deployment.
- ✗
Configure branch policies on the main branch.
Why it's wrong here
Branch policies on the main branch apply to pull request code validation and merge gating, not to pipeline deployment stages; they do not create deployment approvals or control who can approve a release that has already started.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-400 exam frequently reuses these exact scenarios with slightly different constraints.
✓Define an environment with required approvers and reference it in the Deploy stage.Correct answer▾
Why this is correct
Defining an environment with required approvers and referencing that environment in the Deploy stage adds a pre-deployment approval gate that must be completed before the stage runs, giving you a first-class, audit-ready mechanism for human sign-off on production deployments.
✗Add a manual validation task in the Deploy stage.Wrong answer — click to see why▾
Why this is wrong here
Manual validation tasks require a custom script and do not integrate with Azure AD groups for approvals.
✗Use the 'condition' keyword: condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')Wrong answer — click to see why▾
Why this is wrong here
This condition controls stage execution based on branch, not approvals.
✗Configure branch policies on the main branch.Wrong answer — click to see why▾
Why this is wrong here
Branch policies are for pull requests, not pipeline stages.
Analysis generated from the official AZ-400blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Pipeline
A pipeline is an automated series of steps that takes code from development to production, ensuring quality and speed.
Key term
Azure Pipelines
Azure Pipelines is a cloud-based CI/CD service from Microsoft that automatically builds, tests, and deploys code to any platform or cloud.
About these practice questions
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.