Courseiva
Design and implement a source control strategymediumMultiple ChoiceObjective-mapped

Enforcing a Work Item Reference on Every Code Change with a Branch Policy

You work for a multinational company that uses Azure Repos. The compliance team requires that all code changes include a work item reference in the commit message. What is the most effective way to enforce this?

Quick Answer

A branch policy requiring a linked work item on every pull request is the server-side enforcement mechanism here — it blocks a PR from completing unless it's tied to a work item, integrates directly with Azure Boards to validate the link, and can't be bypassed by an individual developer skipping a manual step.

⚠ Common exam trap

It's easy for candidates to confuse client-side hooks (Option B) with server-side enforcement, not realizing that client-side hooks are optional and can be easily bypassed, whereas branch policies in Azure Repos provide mandatory, centralized enforcement that cannot be overridden by individual developers.

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

Set a branch policy that requires a linked work item for pull requests

A branch policy in Azure Repos that requires linked work items for pull requests enforces the compliance requirement at the server side, ensuring that every pull request merge includes a work item reference. This policy is enforced before the merge completes, making it a reliable and auditable method that cannot be bypassed by individual developers. It directly integrates with Azure Boards to validate the link, providing a centralized enforcement mechanism.

Answer analysis

Option-by-option breakdown

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

  • Create a script in the build pipeline that checks the commit message

    Why it's wrong here

    The script can be bypassed if the build is skipped.

  • Configure a client-side commit hook that validates the commit message

    Why it's wrong here

    Client-side hooks can be disabled by developers.

  • Set a branch policy that requires a linked work item for pull requests

    Why this is correct

    Branch policies enforce the requirement server-side before merge.

  • Use a custom build task to automatically add the work item ID to the commit message

    Why it's wrong here

    Automatically adding IDs doesn't enforce that developers include them.

Go deeper

Related to this question

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

Same concept, more angles

2 more ways this is tested on AZ-400

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You have a pipeline that uses Azure Repos Git. You need to enforce that all commits to the main branch are associated with a work item. Which branch policy should you enable?

medium
  • A.Require linked work items
  • B.Limit merge types
  • C.Require a minimum number of reviewers
  • D.Check for comment resolution

Why A: Require linked work items. This branch policy enforces that pull requests or commits to the main branch have at least one associated work item, ensuring traceability. Option B, Limit merge types, restricts which merge strategies can be used (e.g., squash, rebase), but does not enforce work item linking. Option C, Require a minimum number of reviewers, ensures code review but not work item association. Option D, Check for comment resolution, requires that all comments on pull requests are resolved before merging, which is unrelated to work items.

Variation 2. A company uses Microsoft Entra ID for identity. They want to enforce that all code changes in Azure Repos require a linked work item and a successful policy evaluation. Which branch policy should they configure?

hard
  • A.Set the merge strategy to squash merge.
  • B.Enable 'Automatically include reviewers'.
  • C.Require work item linking in the branch policy.
  • D.Enforce a minimum number of comments.

Why C: Requiring work item linking in the branch policy ensures that every pull request (PR) in Azure Repos must be associated with a work item (e.g., user story, bug) before it can be completed. Combined with a successful policy evaluation (e.g., build validation, required reviewers), this enforces traceability and compliance for all code changes.

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.