AZ-400 exam dumps

AZ-400 practice question 74 of 306

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

AZ-400 Question 74

Single answer

You manage a DevOps environment that uses Azure Repos Git. The development team wants to ensure that at least two peer reviews are required for every change to the main branch, that a continuous integration build is triggered for every pull request, and that no one can commit directly to the main branch. Which configuration should you implement to meet these requirements?

  1. A

    Enable branch policies on the main branch requiring a minimum of two reviewers and build validation, and disallow direct pushes to the main branch.

  2. B

    Create a server-side Git hook that rejects any push without two peer reviews and a successful local build.

  3. C

    Rely on the default main branch settings in Azure Repos, as they automatically require two reviewers and block direct commits.

  4. D

    Configure pull requests with a bypass option, allowing direct commits when developers self-approve their changes.

Show answer and explanation

Correct answer: A

Explanation

To enforce code reviews and CI build checks in Azure Repos, you configure branch policies for the main branch. Setting the 'Require a minimum number of reviewers' policy to two ensures peer reviews, while enabling build validation triggers CI pipelines on pull requests. Additionally, disallowing direct pushes to the main branch ensures changes go through the pull request process. See Microsoft� documentation on branch policies in Azure DevOps (https://learn.microsoft.com/azure/devops/repos/git/branch-policies) for detailed guidance.

  • A. Correct.

    Option 1 is correct. Azure Repos supports configuring branch policies that require a minimum number of reviewers and enforce build validation. You can also lock the branch to prevent direct pushes. This combination meets all stated requirements.

  • B. Incorrect.

    Option 2 is incorrect. While Git hooks can enforce some local checks, they cannot reliably prevent unreviewed commits or guarantee a centralized build validation before merging into the main branch in Azure Repos. Git hooks would also need to be maintained on each developer� machine, which is impractical.

  • C. Incorrect.

    Option 3 is incorrect. Azure Repos does not automatically require two reviewers by default. Default settings typically allow direct commits unless explicit branch policies are configured.

  • D. Incorrect.

    Option 4 is incorrect. Allowing a bypass or self-approval would defeat the requirement that two reviewers must approve each pull request. This option also fails to mandate a continuous integration build before merging.

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