AZ-400 Question 68
Single answerYou manage a project in Azure Repos and want to enforce a workflow so that all changes to the 'main' branch require at least one successful build, two approving reviews, and a link to the relevant work item before merging. Which configuration should you implement to meet these requirements?
- A
Configure the �main� branch with policies requiring a passing build, two approvals, and linked work items before allowing merges
- B
Require each developer to manually confirm their build status and code review in pull request comments prior to completing the merge
- C
Enable a policy under �Repository Settings� to restrict direct pushes, but allow merges without any build validation
- D
Use a merge template specifying that developers must state which work items they are closing before merging
Show answer and explanation
Correct answer: A
Explanation
Branch policies in Azure DevOps (or branch protections in GitHub) provide an automated way to ensure pull requests meet specific criteria before merging, such as a passing build, required reviewer approvals, and linking work items. According to Microsoft Docs, configuring these policies on the protected branch ensures a consistent process without relying on manual checks or voluntary compliance.
- A. Correct.
Correct: Defining branch policies in Azure Repos requiring a successful build, a minimum number of reviewers, and enforced work-item linking is the recommended way to protect the main branch and enforce compliance across your team.
- B. Incorrect.
Incorrect: Manually confirming builds and code reviews through comments is error-prone and not enforced by the system. This does not ensure a reliable workflow that all team members follow consistently.
- C. Incorrect.
Incorrect: Restricting direct pushes helps, but lacks mandatory build validation or multiple reviews. This option also does not enforce linking work items to commits.
- D. Incorrect.
Incorrect: A merge template can guide best practices, but it� not enforced by the system. Developers could ignore these guidelines, making this insufficient for strict compliance.