Why an Environment and Approval Check Are Both Required for YAML Approvals
Which TWO conditions must be met to use multi-stage YAML pipelines with approvals?
Quick Answer
Multi-stage YAML approvals need two things in place: an environment resource created and configured with an approval check, and a deployment job that explicitly references that specific environment — the approval check is tied to the environment itself, so without both pieces the pipeline has nothing to gate against.
⚠ Common exam trap
A common mix-up: candidates think approvals are configured directly on the pipeline or stage in YAML, but they must be set on the environment resource and the deployment job must explicitly reference that environment.
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
✓
An environment must be created and approval checks configured on it.
Multi-stage YAML pipelines in Azure DevOps require that an environment be created and approval checks configured on it to enable manual approvals. Additionally, the deployment job within the pipeline must reference a specific environment, as the approval check is associated with that environment resource. Without these two conditions, the pipeline cannot enforce approval gates before deployment.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The pipeline must be triggered by a pull request.
Why it's wrong here
Approvals are configured as environment checks or stage-level gates; pull request triggers are a branch policy concern and are not required for approvals to function. It is tempting because PR triggers commonly accompany gated deployments, and would be the right answer if the question asked how to enforce code review before merging.
- ✓
An environment must be created and approval checks configured on it.
Why this is correct
Approval checks in YAML pipelines attach to environments, not to stages directly. Creating an environment and configuring approval checks on it satisfies the stem's requirement, because the pipeline's deployment job references that environment and pauses there until the designated approvers grant permission, enabling gated multi-stage releases.
- ✗
The pipeline must have at least one stage defined in a separate release pipeline.
Why it's wrong here
Approvals attach to environments or stages within the same YAML pipeline via checks; a separate classic release pipeline is a different mechanism entirely and cannot gate YAML stages. It is tempting because classic release pipelines do support pre-deployment approvals, which is the correct choice when pipelines are authored in the classic editor rather than YAML.
- ✓
The deployment job must reference a specific environment.
Why this is correct
Approvals in multi-stage YAML pipelines attach to environments, not to stages or jobs directly. Referencing a specific environment in the deployment job is what makes the configured approval checks apply, satisfying the stem's requirement that the pipeline target an environment before the protected resource can be released.
- ✗
The pipeline must be created using the classic release editor.
Why it's wrong here
Multi-stage YAML pipelines are defined in YAML; the classic release editor is a separate authoring model and cannot create or host YAML stages. It is tempting because classic release pipelines natively provide pre-deployment approvals, making the classic editor correct when the requirement is approvals without YAML.
Go deeper
Related to this question
Learn chapter
Implementing Security and Compliance in Pipelines
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 DevOps
Azure DevOps is a Microsoft service that provides development tools for planning, building, testing, and deploying software applications using automated pipelines and collaboration features.
About these practice questions
This AZ-400 question is part of Courseiva's 696-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on AZ-400
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. You are setting up a release pipeline that deploys to multiple environments (dev, test, prod) sequentially. Each environment requires approval before deployment. What is the best way to implement this in Azure Pipelines?
easy- ✓ A.Define pipeline stages with environment resources and pre-deployment approvals.
- B.Use environment resources with 'auto' trigger and no approvals.
- C.Use classic release pipelines with approval gates per environment.
- D.Use a custom PowerShell script to pause and prompt for approval.
Why A: Azure Pipelines supports multi-stage YAML pipelines where each stage can reference an environment resource. Pre-deployment approvals are configured on the environment itself, ensuring that before a stage deploys to that environment, the specified approvers must grant approval. This provides a native, auditable, and integrated approval gate without custom scripting or legacy tooling.
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.