Microsoft DevOps Engineer Expert (AZ-400) · Section 2 · 13% of the exam
Design a branch strategy, including trunk-based, feature branch, and release branch
One of the objectives of the Exam AZ-400: Designing and Implementing Microsoft DevOps Solutions exam, in the section “Design and implement a source control strategy”. Here is what it covers, the points to remember and a question to try.
What it covers
A branch strategy decides how code flows from a developer's laptop to production. This lesson compares trunk-based development, feature branches and release branches, then shows how branch policies in Azure Repos and branch protection rules or rulesets in GitHub enforce pull requests, reviews, checks and allowed merge types.
Points to remember
- Trunk-based: short-lived branches, feature flags, deploy from main; feature branch: one branch per change merged by PR; release branch: release/* for supported versions.
- Release branches are not merged back by PR; fix in main and cherry-pick into release (Release Flow), or fix in release and cherry-pick to main.
- A required Azure Repos branch policy blocks direct pushes and branch deletion; changes go through PRs.
- Minimum-reviewers options: creator vote, most recent pusher, reset votes on new pushes, completion despite wait or reject votes.
- Build validation expiration choices: Immediately, After n hours, Never; path filters must start with / or a wildcard.
Try a question
An organisation has a baseline of required checks for every main branch plus extra requirements for a few repositories. The team finds that, with branch protection rules, only one rule applies to a branch, so the baseline and the repository-specific rule cannot both take effect. What should they use to layer the requirements?
- AGitHub rulesets: several rulesets can target one branch and their rules are aggregated, with the most restrictive winning
- BA second branch protection rule on the same branch pattern in each repository, which GitHub combines with the first rule
- CCODEOWNERS files in every repository, because each repository can then define which teams own which paths and must approve
- DA GitHub Actions workflow that comments on pull requests that miss the baseline and asks the author to add the missing checks
Show the answer
A. Only one branch protection rule can apply to a branch, which makes overlap hard to reason about. Rulesets have no priority: all rulesets targeting a branch are aggregated, and where the same rule differs, the most restrictive version applies. Organisation-level rulesets can carry the baseline.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Branch strategies, pull request workflows and merge restrictions teaches this objective (about 45 minutes), and 15 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Design and implement a pull request workflow by using branch policies and branch protection rules
- Implement branch merging restrictions by using branch policies and branch protection rules
- Design and implement a strategy for managing large files, including Git Large File Storage (LFS) and git-fat
- Design a strategy for scaling and optimizing a Git repository, including Scalar and cross-repository sharing
- Configure permissions in the source control repository
- Configure tags to organize the source control repository
- Recover specific data by using Git commands
- Remove specific data from source control