AZ-400 Question 156
Single answerYou manage an Azure App Service hosting a critical ASP.NET Core application. You have a CI/CD pipeline in Azure DevOps that builds, tests, and packages your code. The goal is to deploy new releases with minimal downtime and ensure you can quickly roll back if critical issues arise after deployment. Which deployment strategy best meets these requirements?
- A
Deploy directly to the production slot and rely on application restarts to roll back if needed.
- B
Use the staging slot to deploy and validate changes, then swap with the production slot if tests pass.
- C
Create a single release pipeline stage targeting the production slot with a manual approval gate.
- D
Utilize a self-hosted Linux agent with rolling updates to the production slot without using deployment slots.
Show answer and explanation
Correct answer: B
Explanation
Deploying to a staging slot, validating the release, and then swapping it with the production slot is a proven way to minimize downtime and streamline rollbacks in Azure App Service. Microsoft� documentation recommends using deployment slots to prevent disruptions to end users and to rapidly revert to a previous version if an issue is detected (see Microsoft Docs: https://learn.microsoft.com/azure/app-service/deploy-staging-slots).
- A. Incorrect.
Option 1: Incorrect. Deploying directly to production can cause downtime for the application and complicates rollback. Relying on restarts after a failed deployment significantly increases downtime and risk.
- B. Correct.
Option 2: Correct. Using the staging slot to validate changes before swapping to production is a recommended best practice. This approach significantly reduces downtime, allows for quick rollback by swapping slots back, and offers a safer validation environment.
- C. Incorrect.
Option 3: Incorrect. While having a single pipeline stage with approvals adds a manual checkpoint, it does not inherently minimize downtime nor simplify the rollback process. There is no dedicated staging environment to validate the deployment before it goes live.
- D. Incorrect.
Option 4: Incorrect. While rolling updates can reduce downtime on some platforms, the question specifically references Azure App Service deployment slots, which are designed to enable zero-downtime swaps and straightforward rollbacks. Using a self-hosted agent alone does not address those requirements.