AZ-400 Question 72
Single answerYour development team is working on a large enterprise application hosted in Azure Repos. They want to prevent direct commits to the 'main' branch and ensure a minimum of two reviewers must approve pull requests before any merge. Additionally, they need to enforce that the application passes all required build validations before merging. Which action best satisfies these requirements?
- A
Enable branch policies on the 'main' branch, requiring a minimum number of reviewers, blocking direct pushes, and configuring status checks to pass before merge.
- B
Configure gated check-ins on the local developer branches and rely on manual cherry-picking into the 'main' branch.
- C
Set up a global repository permission policy that blocks all merges, then manually allow merges only after a reviewer sends an email approval.
- D
Allow developers to push changes directly to the 'main' branch but mandate that changes undergo build validation on a nightly schedule.
Show answer and explanation
Correct answer: A
Explanation
Branch policies in Azure DevOps provide a robust feature set to implement multi-reviewer workflows, block direct pushes, and enforce continuous integration checks before merging. By configuring branch protections on the 'main' branch, teams can ensure all requirements (such as code reviews, build validations, and merge restrictions) are met. For more information, refer to the official Microsoft Documentation: https://learn.microsoft.com/azure/devops/repos/git/branch-policies.
- A. Correct.
Correct. Configuring branch policies on the 'main' branch lets you require a minimum number of reviewers, block direct pushes, and enforce passing build validations before merges. This enforces all the team's requirements and leverages Azure DevOps� built-in branch protection features.
- B. Incorrect.
Incorrect. Gated check-ins can help reduce build breaks, but relying on local branches and manual cherry-picking does not automate enforcement of multiple approvals or block direct pushes to the 'main' branch. It also creates additional overhead for developers.
- C. Incorrect.
Incorrect. A global repository permission policy that blocks all merges prevents any merges from occurring until manually overridden. This does not leverage the automated enforcement of approvals or build checks, relying instead on ad-hoc email approvals, which is error-prone and not recommended.
- D. Incorrect.
Incorrect. Allowing direct pushes to 'main' while relying on nightly builds contradicts the requirement to block direct pushes and ensure validations before merge. This could lead to issues and broken changes being pushed into production at any time.