AZ-400 Question 162
Single answerYou are deploying both an Azure SQL Database and an Azure App Service that depends on it. You want to ensure the database is fully deployed before the App Service deployment starts. Which approach provides a reliable and easily maintainable solution for enforcing this deployment order in your Azure DevOps pipeline?
- A
Use multiple jobs within the same stage and rely on the default parallel execution to finish the database deployment before the App Service deployment begins.
- B
Create two pipeline stages and configure the App Service stage to depend on the database stage, ensuring the database is fully deployed before the App Service stage starts.
- C
Implement a custom script to query the database� status and manually pause the pipeline when the database is not yet fully provisioned.
- D
Deploy both resources in a single Azure Resource Manager (ARM) template without any explicit dependency properties and trust ARM to handle the order.
Show answer and explanation
Correct answer: B
Explanation
When multiple resources have dependency relationships, defining stage or job dependencies in your pipeline is a best practice for ensuring the correct deployment order. In Azure DevOps multi-stage pipelines, specifying that the App Service stage depends on the database stage guarantees that the database is fully provisioned before the subsequent stage starts, reducing the risk of partial or failed deployments. Refer to Microsoft� documentation on multi-stage pipelines and job dependencies for further guidance.
- A. Incorrect.
Incorrect. By default, multiple jobs in the same stage can run in parallel unless explicitly configured otherwise. Relying on parallel execution to �finish first� is unreliable, as the order is not guaranteed.
- B. Correct.
Correct. Configuring separate stages for the database and App Service and using a dependsOn rule (or stage dependency) in the pipeline ensures that the App Service stage only starts after the database stage successfully completes.
- C. Incorrect.
Incorrect. While custom scripts can work, they increase complexity and maintenance overhead. They are also more prone to timing errors than built-in pipeline features that handle stage dependencies.
- D. Incorrect.
Incorrect. ARM templates alone won�t enforce the App Service deployment order if you omit the dependency property. You must explicitly define the dependsOn property or manage ordering in the pipeline stages.