AZ-400 Question 70
Select 2You manage a repository in Azure Repos with a 'main' branch as the primary source of truth. You want to ensure that changes can only be merged into 'main' if they pass a build validation and at least one reviewer has approved the pull request. Additionally, you need to prevent developers from bypassing these checks. Which two configuration steps should you take to meet these requirements?
- A
Enable a build validation policy on the 'main' branch and link it to the build pipeline.
- B
Grant project administrators the 'Bypass policies when completing pull requests' permission.
- C
Set a branch policy requiring at least one required reviewer for pull requests into 'main'.
- D
Provide all contributors with the 'Force push' permission on the 'main' branch.
Show answer and explanation
Correct answers: A, C
Explanation
To enforce strict merge restrictions in Azure Repos, you must configure branch policies that include both a build validation requirement (linking to a build pipeline) and a mandatory reviewer requirement. Avoid permissions or settings (e.g., bypass policies, force pushes) that allow merges without following the established checks. Refer to Microsoft's official documentation on configuring branch policies for more details: https://docs.microsoft.com/azure/devops/repos/git/branch-policies.
- A. Correct.
Correct. Enabling a build validation policy ensures that whenever a pull request is created against the 'main' branch, the associated build pipeline runs and must succeed before the merge can proceed.
- B. Incorrect.
Incorrect. Granting the 'Bypass policies' permission would allow certain users (project administrators) to merge changes without fulfilling build or reviewer requirements, contradicting the intent of enforcing mandatory checks.
- C. Correct.
Correct. Requiring at least one reviewer guarantees that developers receive qualitative feedback and approval before changes are merged, addressing part of the merge restriction requirement.
- D. Incorrect.
Incorrect. Granting the 'Force push' permission means contributors can override branch policies. This compromises the enforcement of required reviews and successful builds.