AZ-400 exam dumps

AZ-400 practice question 192 of 306

Designing and Implementing Microsoft DevOps Solutions. Professional level, Microsoft. Free question with the correct answer and a full explanation.

AZ-400 Question 192

Single answer

You are responsible for defining an Infrastructure as Code (IaC) strategy for a growing organization, where all Azure infrastructure should be defined and managed via code. The team wants to ensure that every change to the infrastructure code is tracked in source control and automatically tested before deployment. Which approach best meets these requirements?

  1. A

    Maintain the IaC files on a shared network drive, run manual tests after each major update, and copy the files to Azure when ready.

  2. B

    Store the IaC files in a Git repository, configure a continuous integration pipeline to validate and test the templates on each commit or pull request, and then automatically deploy them if the tests pass.

  3. C

    Keep a local folder with IaC scripts, use a weekly scheduled script to run tests, and manually deploy the infrastructure after conducting code reviews.

  4. D

    Use a Git repository for code review but trigger deployments only once every quarter without conducting automated tests.

Show answer and explanation

Correct answer: B

Explanation

Following best practices for IaC involves storing infrastructure definitions in Git for version control, configuring validation and testing steps (e.g., via Azure Pipelines or GitHub Actions) on each pull request or commit, and then deploying only after these tests pass. This approach aligns with DevOps principles outlined by Microsoft, ensuring speed, reliability, and traceability. See Microsoft documentation on Continuous Integration and Infrastructure as Code for recommended practices: https://learn.microsoft.com/azure/devops/learn/what-is-ci and https://learn.microsoft.com/azure/devops/learn/what-is-infrastructure-as-code.

  • A. Incorrect.

    Option 1 is incorrect. Storing IaC files on a shared drive without version control prevents comprehensive tracking of changes, and manual testing/testing only after major updates is error-prone and does not provide immediate feedback.

  • B. Correct.

    Option 2 is correct. Storing IaC files in Git and using a continuous integration (CI) pipeline to run automated tests (such as linting, syntax checks, or deployment validations) provides immediate feedback and assures code reliability. Automatic deployment after passing tests ensures that consistent infrastructure is quickly delivered.

  • C. Incorrect.

    Option 3 is incorrect. Keeping IaC scripts localized and running tests only weekly introduces significant delay and lacks robust version control for incremental changes. Manual deployment after code reviews does not ensure continuous and automated validation.

  • D. Incorrect.

    Option 4 is incorrect. While using Git for code review is a good start, limiting deployments to a quarterly cycle without automated testing means potential issues could go undetected for months, reducing the benefits of a continuous feedback loop.

Timed practice exam

Take a AZ-400 practice test under exam conditions

70 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam