AZ-400 Practice Question: Design and implement build and release pipelines
You are designing a multi-stage YAML pipeline for a .NET Core application. The pipeline must build, test, and deploy to a staging environment. You want to ensure that the deployment stage only runs if the build and test stages succeed, and that the staging deployment uses the exact same bits that were built. Which strategy should you use?
⚠ Common exam trap
It's easy for candidates to confuse release pipelines with multi-stage YAML pipelines, thinking manual approval is required for deployment control, but the question specifically requires using the exact same bits and conditional stage execution, which is directly achieved with 'dependsOn' and artifact publishing/downloading.
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
✓
Create separate stages for build, test, and deploy. Use the 'dependsOn' keyword and publish artifact in build stage, download in deploy stage.
Using separate stages with 'dependsOn' ensures the deployment stage only runs after successful build and test stages. Publishing the build artifact in the build stage and downloading it in the deploy stage guarantees that the exact same compiled bits are used for deployment, maintaining consistency across environments.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set up a release pipeline that uses the same build artifact and requires manual approval.
Why it's wrong here
A release pipeline with manual approval only gates human sign-off; it does not automatically enforce that the build artifact was produced from successful test results. It still depends on the build having completed and passed any checks, but no dependency or condition ensures tests ran before approval, so it fails the requirement for automatic progression.
- ✓
Create separate stages for build, test, and deploy. Use the 'dependsOn' keyword and publish artifact in build stage, download in deploy stage.
Why this is correct
Separating build, test, and deploy into distinct stages with dependsOn ensures strict sequential execution: build completes, tests pass, then deploy runs. Publishing the artifact in the build stage and downloading it in the deploy stage preserves the exact compiled output, making the pipeline reliable and providing automatic gatekeeping based on test success.
- ✗
Use a build trigger on the staging branch to deploy after each commit, ignoring test results.
Why it's wrong here
A build trigger on the staging branch only initiates the pipeline on commits; it does not block deployment when tests fail. Ignoring test results removes the quality gate entirely, so a broken commit could deploy directly to staging, violating the requirement that deployment occur only after successful tests.
- ✗
Define the pipeline with a single stage and use a condition to skip test on failure.
Why it's wrong here
A single stage with a condition to skip test on failure is logically flawed because the condition would only evaluate after the test task runs, and it does not reorder or isolate stages. More importantly, using a single stage means build, test, and deploy share the same execution context, so a test failure does not inherently prevent the deploy task from running unless explicit conditional logic is added—and even then, it does not enforce a clean build-before-deploy boundary.
Go deeper
Related to this question
Learn chapter
Source Control Strategy Design
Key term
Environment
An environment is a dedicated set of computing resources, configurations, and services used to develop, test, or host software applications in a controlled and repeatable way.
Key term
Stage
A stage is a discrete phase in a software development or deployment pipeline where code is built, tested, integrated, or released in a controlled environment.
About these practice questions
This AZ-400 question is part of Courseiva's 823-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 →
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.