Courseiva
Design and implement a source control strategymediumMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement a source control strategy

Your team uses a monorepo in Azure Repos. Developers frequently commit directly to the main branch, causing build failures. You need to enforce a policy that requires all changes to go through pull requests with at least one reviewer. What should you configure?

⚠ Common exam trap

It's easy for candidates to confuse project-level settings with branch-level policies, or mistakenly think service hooks can enforce commit restrictions, when in fact Azure Repos requires explicit branch policy configuration on the target branch to enforce pull request requirements and reviewer counts.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Configure a branch policy on the main branch to require a minimum number of reviewers.

Azure Repos allows you to configure branch policies on specific branches (like main) to enforce that all changes must come through pull requests and require a minimum number of reviewers. This directly addresses the need to prevent direct commits to main and ensure code review before merging.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Configure a repository policy to require a pull request for all branches.

    Why it's wrong here

    In Azure Repos, branch policies are configured per branch or via wildcard patterns, not globally for all branches. A repository-level setting that mandates pull requests on every branch does not exist; you must explicitly assign policies to specific branches or patterns.

  • Create a service hook to reject commits to main that are not from pull requests.

    Why it's wrong here

    Service hooks are asynchronous event-driven notifications that fire after a push or pull request event occurs, so they cannot proactively block or reject a commit. By the time a service hook runs, the push has already been accepted, making it useless for enforcing pre-merge review requirements.

  • Configure a branch policy on the main branch to require a minimum number of reviewers.

    Why this is correct

    This is correct because Azure Repos branch polices on the main branch can require that all changes come through a pull request and specify a minimum number of reviewer approvals. This enforcement happens before merge, blocking direct pushes and insufficiently reviewed PRs, thus protecting the main branch.

  • Enable the 'Require a minimum number of reviewers' setting in the project settings.

    Why it's wrong here

    The 'Require a minimum number of reviewers' option is a branch policy setting defined on a specific branch, not a project-level configuration. Azure DevOps project settings do not expose it; you must navigate to the repository's branch policy page to enable it for the main branch or a matching pattern.

Go deeper

Related to this question

About these practice questions

One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.