Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
Branch policies are a powerful feature to ensure high quality code in your repo by establishing requirements for all pull requests. External services can use the PR Status API to post detailed status to your PRs. The branch policy for external services brings the ability for those 3rd party services to participate in the PR workflow and establish policy requirements. This article guides you through the process of configuring a branch policy for a service that is posting PR status. For more information about PR status, see Customize and extend pull request workflows with pull request status.
Category | Requirements |
---|---|
Project access | Member of a project. |
Permissions | - View code in private projects: At least Basic access. - Clone or contribute to code in private projects: Member of the Contributors security group or corresponding permissions in the project. - Set branch or repository permissions: Manage permissions permissions for the branch or repository. - Change default branch: Edit policies permissions for the repository. - Import a repository: Member of the Project Administrators security group or Git project-level Create repository permission set to Allow. For more information, see Set Git repository permissions. |
Services | Repos enabled. |
Tools | Optional. Use az repos commands: Azure DevOps CLI. |
Note
In public projects, users with Stakeholder access have full access to Azure Repos, including viewing, cloning, and contributing to code.
Category | Requirements |
---|---|
Project access | Member of a project. |
Permissions | - View code: At least Basic access. - Clone or contribute to code: Member of the Contributors security group or corresponding permissions in the project. |
Services | Repos enabled. |
Navigate to Code>Branches and find the branch that you want to configure the policy on (typically main
or develop
). From the context menu, select the Branch policies option.
Scroll down to find Status checks. Select the + button.
Select the service you want to create a policy for from the list. If the status has been posted previously you can pick it from the list; if it is a new policy you can type in the name of the policy.
Create a new pull request into the branch where the policy is defined. For more information, see Create a pull request.
After creating the PR, the new policy will appear in the Policies section of the PR details view. Initially, the policy will appear as not set until the external service has posted status.
When the service has posted status, the policy will update accordingly. Completion will be blocked until the policy approves the PR.
When the policy criteria are met, and the service posts a succeeded
status, the PR will be approved and completion will be unblocked.
In this article, you learned how to configure a branch policy for an external service.
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Collaborate with pull requests in Azure Repos - Training
Collaborate with pull requests in Azure Repos
Certification
Microsoft Certified: DevOps Engineer Expert - Certifications
This certification measures your ability to accomplish the following technical tasks: Design and implement processes and communications, design and implement a source control strategy, design and implement build and release pipelines, develop a security and compliance plan, and implement an instrumentation strategy.
Documentation
Pull request workflow extensibility - Azure Repos
Pull request workflow extensibility using status and policy
Git branch policies and settings - Azure Repos
Branch policies and settings provide teams with the means to protect their important branches.
Learn how to use Git tags