AZ-400 Practice Question: Design and implement a source control strategy
You are setting up a new GitHub repository for a project that requires strict access control. Only specific team members should be able to push to the main branch, but all team members should be able to create branches and open pull requests. What is the best way to achieve this?
⚠ Common exam trap
A common mix-up: candidates confuse restricting push access with removing write permissions entirely, not realizing that branch protection rules allow granular control over specific branches while preserving write-level collaboration on other branches.
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
✓
Use a branch protection rule to restrict pushes to the main branch to specific users or teams.
Branch protection rules in GitHub allow you to enforce restrictions on specific branches, such as requiring pull request reviews or restricting who can push directly. By configuring a rule for the main branch that limits push access to only designated users or teams, you ensure that all team members can create branches and open PRs, but only authorized members can merge into main. This directly meets the requirement without over-provisioning permissions or blocking collaboration.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add all team members as administrators of the repository.
Why it's wrong here
Adding all team members as administrators grants full repository control, including the ability to disable or bypass branch protection rules, so they could push directly to main or override required reviews. This undermines the security you're trying to enforce on the main branch.
- ✗
Remove write permissions for non-core team members and give them read-only access.
Why it's wrong here
Removing write permissions and assigning read-only access prevents team members from creating branches or opening pull requests, which means they cannot contribute changes at all. The goal is to allow contributions through PRs while protecting main, not to block all write operations.
- ✓
Use a branch protection rule to restrict pushes to the main branch to specific users or teams.
Why this is correct
A branch protection rule on the main branch can restrict direct pushes to specific users or teams, while still allowing branch creation and pull requests. This ensures that only authorized personnel can push to main, and all other changes must go through PR reviews, which directly addresses your requirement.
- ✗
Set the repository to private and invite only core team members.
Why it's wrong here
Setting the repository to private and inviting only core team members controls visibility and access, but it does not restrict what those members can do on the main branch. Core members typically have write or admin permissions, so they can still push directly to main unless a separate branch protection rule is configured.
Go deeper
Related to this question
Learn chapter
Source Control Strategy Design
Key term
Repository
A repository is a central storage location where software packages, code, or configuration files are kept, managed, and distributed for use by IT systems.
Key term
Pull request
A pull request is a way for a developer to propose changes to a codebase and ask other team members to review and merge them into the main project.
About these practice questions
This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.