Microsoft Certified: DevOps Engineer ExpertConfigure processes and communicationsEasy
A DevOps team is implementing a pull request strategy in Azure DevOps. They want to ensure that all code merged into the `main` branch has been reviewed by at least two senior developers and that the build pipeline associated with the pull request has successfully completed. Which feature in Azure DevOps should they configure to enforce these requirements?
- ARepository settings
- BBranch policies
- CPipeline triggers
- DSecurity groups
Show answer & explanationAnswer & explanation
Correct answer: B. Branch policies
Branch policies in Azure DevOps are specifically designed to enforce quality and consistency standards for branches, such as requiring a minimum number of reviewers and successful build validations before a pull request can be completed and merged.
Why the other options are wrong
- A. Repository settings control broader aspects like repository name, default branch, and permissions but do not enforce specific pull request merge criteria.
- C. Pipeline triggers define when a pipeline runs (e.g., on commit or PR creation) but do not enforce merge conditions for a pull request.
- D. Security groups manage user permissions and access control but are not used to define or enforce pull request merge policies.
Azure DevOps Branch Policies
Branch policies in Azure DevOps are rules enforced on branches to maintain code quality and ensure adherence to team standards. They can require code reviews, successful builds, linked work items, and more before a pull request can be completed.
- Enforce quality and consistency.
- Configured per branch.
- Prevent direct commits to protected branches.
- Support various merge requirements.
Memory trick: Policies protect the main branch like a shield.