Skip to content

Commit 3718417

Browse files
Freshness.
1 parent 90d08fe commit 3718417

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

docs/cli/policy-configuration-file.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
2-
title: Configure branch policies for Azure DevOps CLI
2+
title: Configure Branch Policies for Azure DevOps CLI
33
titleSuffix: Azure DevOps
4-
description: Configure branch policies using Azure DevOps CLI
4+
description: Learn how to configure branch policies using Azure DevOps CLI to help your team protect their development branches.
55
ms.topic: how-to
66
ms.subservice: azure-devops-reference
77
ms.manager: mijacobs
88
ms.author: chcomley
99
author: chcomley
1010
monikerRange: 'azure-devops'
11-
ms.date: 04/30/2021
11+
ms.date: 06/03/2025
12+
#customer intent: As a team lead, I want to use branch policies to protected different development branches by using Azure DevOps CLI.
1213
---
1314

1415
# Configure Git repository policies using a configuration file
1516

16-
[!INCLUDE [version-eq-azure-devops](../includes/version-eq-azure-devops.md)]
17+
[!INCLUDE [version-eq-azure-devops](../includes/version-eq-azure-devops.md)]
1718

1819
Branch policies help teams protect their important branches of development. Policies enforce your team's code quality and change management standards. For an overview of policy settings you can configure, see [Git repository settings and policies](../repos/git/repository-settings.md).
1920

20-
You can configure branch policies for your repository using the various `az repos policy` commands. However, the policy commands accept a single scope, i.e., single combination of repository, branch and match type. If you want to apply the same policy across various scopes, you can do that using a policy configuration file.
21+
You can configure branch policies for your repository using the various `az repos policy` commands. The policy commands accept a single scope. They work on a single combination of repository, branch, and match type. If you want to apply the same policy across various scopes, use a policy configuration file.
2122

22-
Say you want to create a manual queue build policy across all branch folders that start with "release" and also on the main branch. To achieve this, execute the following steps:
23+
Say you want to create a manual queue build policy. It covers all branch folders that start with "release" and also on the main branch.
2324

24-
## Create a policy configuration file
25-
26-
Create a policy configuration file for build policy, including the multiple application scopes.
25+
First, create a policy configuration file for build policy, including the multiple application scopes.
2726

2827
> [!div class="tabbedCodeSnippets"]
28+
2929
> ```json
3030
> {
3131
> "isBlocking": true,
@@ -41,32 +41,34 @@ Create a policy configuration file for build policy, including the multiple appl
4141
> {
4242
> "matchKind": "Prefix",
4343
> "refName": "refs/heads/release",
44-
> "repositoryId": "e646f204-53c9-4153-9ab9-fd41a11e3564"
44+
> "repositoryId": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb"
4545
> },
4646
> {
4747
> "matchKind": "Exact",
4848
> "refName": "refs/heads/main",
49-
> "repositoryId": "e646f204-53c9-4153-9ab9-fd41a11e1234"
49+
> "repositoryId": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb"
5050
> }
5151
> ],
5252
> "validDuration": 0
5353
> },
5454
> "type": {
5555
> "displayName": "Build",
56-
> "id": "0609b952-1397-4640-95ec-e00a01b2f659"
56+
> "id": "bbbbbbbb-1111-2222-3333-cccccccccccc"
5757
> }
5858
> }
5959
> ```
6060
61-
To learn more about the structure for various policy types, refer to [Policy create](/rest/api/azure/devops/policy/configurations/create#examples).
61+
To learn more about the structure for various policy types, see [Policy create](/rest/api/azure/devops/policy/configurations/create#examples).
6262
63-
## Save the file and run the create policy command
63+
Then, save the file and run the create policy command:
6464
65-
`az repos policy create --policy-configuration C:\policyConfiguration.txt`
65+
```azurecli
66+
az repos policy create --policy-configuration C:\policyConfiguration.txt
67+
```
6668
67-
Note that the path is provided using '\\' backslash.
69+
> [!NOTE]
70+
> The path is provided using '\\' backslash.
6871
69-
## Related articles
72+
## Related articles
7073

7174
- [Git repository settings and policies](../repos/git/repository-settings.md)
72-

0 commit comments

Comments
 (0)