Skip to content

Commit 1aca517

Browse files
Merge pull request #235368 from davidsmatlak/ds-fixmetatdata-0421
Edits metadata and markdown
2 parents 32ccbda + 501e90c commit 1aca517

File tree

3 files changed

+54
-51
lines changed

3 files changed

+54
-51
lines changed
Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
title: Safe deployment of Azure Policy assignments
33
description: Learn how to apply the safe deployment practices (SDP) framework to your Azure Policy assignments.
4-
author: timwarner-msft
5-
ms.date: 11/14/2022
4+
ms.date: 04/21/2023
65
ms.topic: conceptual
7-
ms.author: timwarner
86
---
7+
98
# Safe deployment of Azure Policy assignments
109

1110
As your environment expands, so does the demand for a controlled continuous deployment (CD)
@@ -30,77 +29,78 @@ Policy assignments that use the `deny` or `append` policy effects.
3029
> [!NOTE]
3130
> To learn more about Azure policy effects, see [Understand how effects work](../concepts/effects.md).
3231
33-
:::image type="content" source="safe-deployment-practices-flowchart-1.png" alt-text="Flowchart with steps one through eight showing safe deployment practices deployment of a new Azure Policy definition." border="true":::
32+
:::image type="content" source="../media/policy-safe-deployment-practices/safe-deployment-practices-flowchart-1.png" alt-text="Flowchart with steps one through eight showing safe deployment practices deployment of a new Azure Policy definition." border="true":::
33+
34+
Flowchart step numbers:
3435

35-
1. Begin the release by creating a policy definition at the highest designated Azure management scope.
36-
We recommend storing Azure Policy definitions at the management group scope for maximum flexibility.
36+
1. Begin the release by creating a policy definition at the highest designated Azure management scope. We recommend storing Azure Policy definitions at the management group scope for maximum flexibility.
3737

3838
2. Once you've created your policy definition, assign the policy at the highest-level scope inclusive
3939
of all deployment rings. Apply _resource selectors_ to narrow the applicability to the least
4040
critical ring by using the `"kind": "resource location"` property. Configure the `audit` effect type
41-
by using _assignment overrides_. Sample selector with eastUS location and effect as audit
41+
by using _assignment overrides_. Sample selector with `eastUS` location and effect as `audit`:
4242

43-
```json
43+
```json
4444
"resourceSelectors": [{
45-
"name": "SDPRegions",
46-
"selectors": [{
47-
"kind": "resourceLocation",
48-
"in": [ "eastUS" ]
49-
}]
45+
"name": "SDPRegions",
46+
"selectors": [{
47+
"kind": "resourceLocation",
48+
"in": [ "eastUS" ]
49+
}]
5050
}],
5151
"overrides":[{
52-
"kind": "policyEffect",
53-
"value": "Audit"
52+
"kind": "policyEffect",
53+
"value": "Audit"
5454
}]
55-
```
55+
```
5656

5757
3. Once the assignment is deployed and the initial compliance scan has completed,
5858
validate that the compliance result is as expected.
5959

60-
You should also configure automated tests that run compliance checks. A compliance check should
61-
encompass the following logic:
62-
63-
- Gather compliance results
64-
- If compliance results are as expected, the pipeline should continue
65-
- If compliance results aren't as expected, the pipeline should fail and you should start debugging
66-
67-
For example, you can configure the compliance check by using other tools within
68-
your particular continuous integration/continuous deployment (CI/CD) pipeline.
69-
70-
At each rollout stage, the application health checks should confirm the stability of the service
71-
and impact of the policy. If the results aren't as expected due to application configuration,
72-
refactor the application as appropriate.
73-
74-
4. Repeat by expanding the resource selector property values to include the next rings
60+
You should also configure automated tests that run compliance checks. A compliance check should
61+
encompass the following logic:
62+
63+
- Gather compliance results
64+
- If compliance results are as expected, the pipeline should continue
65+
- If compliance results aren't as expected, the pipeline should fail and you should start debugging
66+
67+
For example, you can configure the compliance check by using other tools within
68+
your particular continuous integration/continuous deployment (CI/CD) pipeline.
69+
70+
At each rollout stage, the application health checks should confirm the stability of the service
71+
and impact of the policy. If the results aren't as expected due to application configuration,
72+
refactor the application as appropriate.
73+
74+
4. Repeat by expanding the resource selector property values to include the next rings'
7575
locations and validating the expected compliance results and application health. Example selector with an added location value:
7676

77-
```json
77+
```json
7878
"resourceSelectors": [{
79-
"name": "SDPRegions",
80-
"selectors": [{
81-
"kind": "resourceLocation",
82-
"in": [ "eastUS", "westUS"]
83-
}]
79+
"name": "SDPRegions",
80+
"selectors": [{
81+
"kind": "resourceLocation",
82+
"in": [ "eastUS", "westUS"]
83+
}]
8484
}]
85-
```
85+
```
8686

8787
5. Once you have successfully assigned the policy to all rings using `audit` mode,
8888
the pipeline should trigger a task that changes the policy effect to `deny` and reset
8989
the resource selectors to the location associated with _Ring 0_. Example selector with one region and effect set to deny:
9090

91-
```json
91+
```json
9292
"resourceSelectors": [{
93-
"name": "SDPRegions",
94-
"selectors": [{
95-
"kind": "resourceLocation",
96-
"in": [ "eastUS" ]
97-
}]
93+
"name": "SDPRegions",
94+
"selectors": [{
95+
"kind": "resourceLocation",
96+
"in": [ "eastUS" ]
97+
}]
9898
}],
9999
"overrides":[{
100-
"kind": "policyEffect",
101-
"value": "Deny"
100+
"kind": "policyEffect",
101+
"value": "Deny"
102102
}]
103-
```
103+
```
104104

105105
6. Once the effect is changed, automated tests should check whether enforcement is taking place as
106106
expected.
@@ -114,7 +114,9 @@ expected.
114114
Steps 1-4 for policies using the `modify` or `deployIfNotExists` effects are the same as steps previously explained.
115115
Review the following flowchart with modified steps 5-9:
116116

117-
:::image type="content" source="safe-deployment-practices-flowchart-2.png" alt-text="Flowchart showing steps 5 through 9 in the Azure Policy safe deployment practices workflow." border="true":::
117+
:::image type="content" source="../media/policy-safe-deployment-practices/safe-deployment-practices-flowchart-2.png" alt-text="Flowchart showing steps 5 through 9 in the Azure Policy safe deployment practices workflow." border="true":::
118+
119+
Flowchart step numbers:
118120

119121
5. Once you've assigned the policy to all rings using `audit` mode, the pipeline should trigger
120122
a task that changes the policy effect to `modify` or `deployIfNotExists` and resets
@@ -131,8 +133,9 @@ as expected using compliance and application health checks.
131133

132134
> [!NOTE]
133135
> For more information on Azure policy remediation tasks, read [Remediate non-compliant resources with Azure Policy](./remediate-resources.md).
136+
134137
## Next steps
135138

136-
- Learn how to [programmatically create policies](./programmatically-create.md)
137-
- Review [Azure Policy as code workflows](../concepts/policy-as-code.md)
138-
- Study Microsoft's guidance concerning [safe deployment practices](/devops/operate/safe-deployment-practices)
139+
- Learn how to [programmatically create policies](./programmatically-create.md).
140+
- Review [Azure Policy as code workflows](../concepts/policy-as-code.md).
141+
- Study Microsoft's guidance concerning [safe deployment practices](/devops/operate/safe-deployment-practices).

0 commit comments

Comments
 (0)