Is it possible to set branch policies across all repo's? In other words, When creating a branch, a default branch policy is already set for master.
Asked
Active
Viewed 6,669 times
16
-
1Just searching for this myself, cannot believe this is not possible.... – Phil Jun 21 '19 at 08:55
3 Answers
9
It's been changed now. So for others who look for it, you can find it there:
- *Project Settings
- 'Repositories'
- All repositories -> 'Policies' tab
- On the bottom there should be 'Branch policies' section with '+' button

codeedward
- 116
- 1
- 5
-
How is this voted as the correct answer? It doesn't address the question at all. – JSON Jul 12 '23 at 15:06
7
Indeed as @Thomas Harris mentioned in the comment above, you can set it for all repos in a single project via
- **Project Settings*
- Cross-repo policies under "Repos" heading
- Click Add branch protection button
And then you can select whether this applies to the default branch or a specific branch name pattern.

julie-ng
- 500
- 6
- 11
6
Right now you can't. You could listen to events in Azure DevOps for project creation for example and then set the policy yourself. For some information how to start see here: https://learn.microsoft.com/en-us/azure/devops/repos/git/create-pr-status-server-with-azure-functions?view=vsts

Rob Bos
- 1,320
- 1
- 10
- 25
-
@jessehouwing has documented a way to achieve this through the API: https://jessehouwing.net/azure-repos-git-configuring-standard-policies-on-repositories/ – mhu Feb 04 '20 at 10:22
-
1It is now possible to set global branch policies in the settings area for the project. Although I cannot find good documentation for this process. – Thomas Harris May 27 '20 at 06:33
-
1Hi Thomas, you can find it under "cross-repo policies" and yes, it is poorly documented. Thanks for pointing that out. I will pass that along as feedback – julie-ng May 29 '20 at 06:32