AZ-400 Practice Question: Design and implement build and release pipelines
You are using Azure Pipelines to deploy a function app. You need to automatically roll back the deployment if the post-deployment smoke tests fail. What should you do?
⚠ Common exam trap
Watch out — candidates often confuse automatic rollback with retry logic or manual gates, failing to recognize that Azure Pipelines' conditional stage execution (`failed()`) is the native mechanism to trigger a rollback stage automatically when smoke tests fail.
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
✓
Add a stage that runs only when the previous stage fails, executing a rollback script.
Azure Pipelines supports conditional stage execution using expressions like `eq(variables['Build.Reason'], 'IndividualCI')` or `failed()`. By adding a stage that runs only when the previous deployment stage fails (e.g., `condition: failed()`), you can execute a rollback script that reverts the function app to its previous stable version. This ensures automatic rollback upon smoke test failure without manual intervention.
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 stage that runs only when the previous stage fails, executing a rollback script.
Why this is correct
In Azure Pipelines, you can define a conditional stage using the `condition: failed()` expression on the deployment stage. This stage runs only when the preceding stage fails, allowing you to execute a rollback script that reverts the function app to its previous healthy version. This approach automates the rollback process, ensuring immediate recovery without manual intervention.
- ✗
Configure the pipeline to retry the deployment on failure.
Why it's wrong here
Retrying the deployment on failure does not roll back to a previous version; instead, it re-attempts the same deployment, which may fail again due to the same underlying issue. A rollback specifically requires restoring the last known good state, such as swapping back to a previous deployment slot. Retrying does not guarantee recovery and could cause repeated failures.
- ✗
Use a pre-deployment approval gate to validate the build before deployment.
Why it's wrong here
Pre-deployment approval gates are used to validate the build or environment before a deployment starts, not to react to a failed deployment. They cannot trigger a rollback after the deployment has already failed because they only block or approve the initiation of a deployment. A post-failure rollback requires a conditional stage or job that runs on failure.
- ✗
Set up a manual validation gate that requires operations to initiate a rollback.
Why it's wrong here
A manual validation gate requiring operations to initiate a rollback is not automatic; it depends on human intervention to detect the failure and manually trigger the rollback process. The requirement is for an automatic rollback that runs when the previous stage fails, whereas a manual validation gate introduces latency and can be missed. Automatic rollback ensures immediate, consistent recovery.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
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.
Key term
Deployment stage
The deployment stage is the phase in software development where code is released and made available to users in a target environment, such as development, testing, staging, or production.
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.