AZ-400 Question 75
Select 2Your team uses Azure DevOps Repos and maintains a 'main' branch that must remain stable. You have been asked to ensure that any pull request targeting the 'main' branch is validated by a successful build, reviewed by at least two team members, and that all pull request comments are resolved before merging. Which two actions should you take in Azure DevOps to meet these requirements?
- A
Configure branch policies in Azure DevOps for the 'main' branch, requiring a minimum number of reviewers and enabling comment resolution.
- B
Enable build validation in the 'main' branch policy to trigger the build pipeline on pull requests before they can be merged.
- C
Use Gated Check-in on the 'main' branch to block local commits until all unit tests pass locally.
- D
Create a build pipeline that automatically merges pull requests when the test coverage reaches a predefined threshold.
Show answer and explanation
Correct answers: A, B
Explanation
To enforce code reviews, build validation, and comment resolution in Azure DevOps, you need to configure branch policies on the target branch (in this case, 'main'). By setting the minimum number of reviewers and requiring comment resolution, you ensure code quality and collaboration. Additionally, enabling build validation triggers a pipeline run for each pull request, blocking merges if the build is not successful. Refer to official Microsoft Azure DevOps documentation on configuring branch policies for more details.
- A. Correct.
Correct. Branch policies in Azure DevOps allow you to require a minimum number of reviewers and ensure that all comments in a pull request are resolved before merging.
- B. Correct.
Correct. Build validation policies run a specified build pipeline on pull requests, preventing merging if the build fails.
- C. Incorrect.
Incorrect. Gated Check-in is an older feature primarily in TFS and is less commonly used in modern Azure DevOps scenarios. It also does not fully address review requirements or pull request comment resolution.
- D. Incorrect.
Incorrect. While a pipeline can measure test coverage, automatically merging based on coverage alone does not enforce required reviewers or comment resolution.