Courseiva
Configure processes and communicationseasyMultiple ChoiceObjective-mapped

AZ-400 Configure processes and communications Practice Question

Your team uses GitHub Flow for feature development. A developer commits directly to the main branch without creating a pull request. Which practice should you enforce to ensure code quality and prevent direct commits?

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 branch protection rules on the main branch to require pull request reviews before merging.

Branch protection rules prevent direct commits to the main branch and require pull requests with reviews. Option A is incorrect because manual sign-off is not enforceable. Option C is incorrect because a .gitignore file does not block commits or enforce branch policies. Option D is incorrect because a CODEOWNERS file alone does not block direct commits.

Answer analysis

Option-by-option breakdown

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

  • Require a manual sign-off from a team lead after each commit.

    Why it's wrong here

    Requiring a manual sign-off from a team lead after each commit is not enforceable as a native platform control in GitHub or Azure DevOps; branch policies simply cannot mandate human approval for individual commits outside the pull request (PR) workflow. Even if enforced manually, it would not prevent direct pushes to main or ensure code review, making it an impractical and unscalable substitute for automated branch protection.

  • Configure branch protection rules on the main branch to require pull request reviews before merging.

    Why this is correct

    Configuring branch protection rules on the main branch to require pull request reviews before merging is correct because GitHub branch policies natively block direct pushes and enforce PR-based collaboration. By requiring at least one approved review, you integrate quality checks into the merge workflow, ensuring feature changes go through review before reaching the main branch—a core mechanism in GitHub Flow.

  • Set up a .gitignore file to prevent certain file types from being committed.

    Why it's wrong here

    A .gitignore file only controls which files and directories are untracked by Git; it does not impose any branch policies, review requirements, or merge restrictions. It can prevent accidental commits of build artifacts or secrets, but it cannot enforce code review or protect the main branch from unreviewed changes.

  • Add a CODEOWNERS file that automatically assigns reviewers to any changes.

    Why it's wrong here

    A CODEOWNERS file automatically assigns reviewers to pull requests that touch specified files or directories, improving review routing and accountability. However, CODEOWNERS does not block commits or direct pushes by itself; without a branch protection rule that requires their approval, codeowners can be bypassed and does not mandate review before merging.

About these practice questions

Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.