You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/governance/policy/concepts/definition-structure.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ see [Tag support for Azure resources](../../../azure-resource-manager/management
137
137
The following Resource Provider modes are fully supported:
138
138
139
139
-`Microsoft.Kubernetes.Data` for managing Kubernetes clusters and components such as pods, containers, and ingresses. Supported for Azure Kubernetes Service clusters and [Azure Arc-enabled Kubernetes clusters](../../../aks/intro-kubernetes.md). Definitions
140
-
using this Resource Provider mode use effects _audit_, _deny_, and _disabled_.
140
+
using this Resource Provider mode use effects _audit_, _deny_, and _disabled_.
141
141
-`Microsoft.KeyVault.Data` for managing vaults and certificates in
142
142
[Azure Key Vault](../../../key-vault/general/overview.md). For more information on these policy
143
143
definitions, see
@@ -1174,7 +1174,7 @@ Limits to the size of objects that are processed by policy functions during poli
1174
1174
}
1175
1175
```
1176
1176
1177
-
The length of the string created by the `concat()` function depends of the value of properties in the evaluated resource.
1177
+
The length of the string created by the `concat()` function depends on the value of properties in the evaluated resource.
Copy file name to clipboardExpand all lines: articles/governance/policy/concepts/policy-as-code.md
+26-32Lines changed: 26 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,28 +18,30 @@ in the cloud are:
18
18
end users.
19
19
20
20
Azure Policy as Code is the combination of these ideas. Essentially, keep your policy definitions in
21
-
source control and whenever a change is made, test, and validate that change. However, that
21
+
source control and whenever a change is made, test and validate that change. However, that
22
22
shouldn't be the extent of policies involvement with Infrastructure as Code or DevOps.
23
23
24
24
The validation step should also be a component of other continuous integration or continuous
25
-
deployment workflows. Examples include deploying an application environment or virtual
26
-
infrastructure. By making Azure Policy validation an early component of the build and deployment
27
-
process the application and operations teams discover if their changes are non-compliant, long
25
+
deployment (CI/CD) workflows, like deploying an application environment or virtual infrastructure. By making Azure Policy validation an early component of the build and deployment process, the application and operations teams discover if their changes are behaving as expected long
28
26
before it's too late and they're attempting to deploy in production.
29
27
30
28
## Definitions and foundational information
31
29
32
-
Before getting into the details of Azure Policy as Code workflow, review the following definitions
33
-
and examples:
30
+
Before getting into the details of Azure Policy as Code workflow, it's important to understand how to author policy definitions and initiative definitions:
@@ -55,6 +57,10 @@ The recommended general workflow of Azure Policy as Code looks like this diagram
55
57
The diagram showing the Azure Policy as Code workflow boxes. Create covers creation of the policy and initiative definitions. Test covers assignment with enforcement mode disabled. A gateway check for the compliance status is followed by granting the assignments M S I permissions and remediating resources. Deploy covers updating the assignment with enforcement mode enabled.
56
58
:::image-end:::
57
59
60
+
### Source control
61
+
62
+
Existing policy and initiative definitions can be exported through PowerShell, CLI, or [Azure Resource Graph (ARG)](../../resource-graph/overview.md) queries. The source control management environment of choice to store these definitions can be one of many options, including a [GitHub](https://www.github.com) or [Azure DevOps](/azure/devops/user-guide/what-is-azure-devops).
63
+
58
64
### Create and update policy definitions
59
65
60
66
The policy definitions are created using JSON, and stored in source control. Each policy has its
@@ -81,17 +87,12 @@ in source control.
81
87
|
82
88
```
83
89
84
-
When a new policy is added or an existing one updated, the workflow should automatically update the
90
+
When a new policy is added or an existing one is updated, the workflow should automatically update the
85
91
policy definition in Azure. Testing of the new or updated policy definition comes in a later step.
86
92
87
-
Also, review [Export Azure Policy resources](../how-to/export-resources.md) to get your existing
88
-
definitions and assignments into the source code management environment
89
-
[GitHub](https://www.github.com).
90
-
91
93
### Create and update initiative definitions
92
94
93
-
Likewise, initiatives have their own JSON file and related files that should be stored in the same
94
-
folder. The initiative definition requires the policy definition to already exist, so can't be
95
+
Initiative definitions are also created using JSON files that should be stored in the same folder as policy definitions. The initiative definition requires the policy definition to already exist, so it can't be
95
96
created or updated until the source for the policy has been updated in source control and then
96
97
updated in Azure. The following structure is a recommended way of keeping your initiative
97
98
definitions in source control:
@@ -116,8 +117,8 @@ definitions in source control:
116
117
|
117
118
```
118
119
119
-
Like policy definitions, when adding or updating an existing initiative, the workflow should
120
-
automatically update the initiative definition in Azure. Testing of the new or updated initiative
120
+
Like with policy definitions, the workflow should
121
+
automatically update the initiative definition in Azure when an existing initiative is added or updated. Testing of the new or updated initiative
121
122
definition comes in a later step.
122
123
123
124
> [!NOTE]
@@ -146,22 +147,17 @@ specifically for validating policies.
146
147
> the resource.
147
148
148
149
After the assignment is deployed, use the Azure Policy SDK, the
[Azure Pipelines Security and Compliance Assessment task](/azure/devops/pipelines/tasks/deploy/azure-policy)
152
-
to [get compliance data](../how-to/get-compliance-data.md) for the new assignment. The environment
153
-
used to test the policies and assignments should have both compliant and non-compliant resources.
154
-
Like a good unit test for code, you want to test that resources are as expected and that you also
155
-
have no false-positives or false-negatives. If you test and validate only for what you expect, there
150
+
[Azure Pipelines Security and Compliance Assessment task](/azure/devops/pipelines/tasks/deploy/azure-policy), or [Azure Resource Graph (ARG)](../../resource-graph/overview.md) queries (see [samples](../samples/resource-graph-samples.md)) to [get compliance data](../how-to/get-compliance-data.md) for the new assignment. The environment
151
+
used to test the policies and assignments should have resources with varying compliance states.
152
+
Like a good unit test for code, you want to test that resources are evaluated as expected with no false-positives or false-negatives. If you test and validate only for what you expect, there
156
153
may be unexpected and unidentified impact from the policy. For more information, see
157
154
[Evaluate the impact of a new Azure Policy definition](./evaluate-impact.md).
158
155
159
156
### Enable remediation tasks
160
157
161
158
If validation of the assignment meets expectations, the next step is to validate remediation.
162
159
Policies that use either [deployIfNotExists](./effects.md#deployifnotexists) or
163
-
[modify](./effects.md#modify) may be turned into a remediation task and correct resources from a
164
-
non-compliant state.
160
+
[modify](./effects.md#modify) can have an associated remediation task triggered to correct resources from a non-compliant state and bring them into compliance.
165
161
166
162
The first step to remediating resources is to grant the policy assignment the role assignment
167
163
defined in the policy definition. This role assignment gives the policy assignment managed identity
@@ -206,9 +202,7 @@ workflows, and fail deployments that create non-compliant resources.
206
202
207
203
This article covers the general workflow for Azure Policy as Code and also where policy evaluation
208
204
should be part of other deployment workflows. This workflow can be used in any environment that
209
-
supports scripted steps and automation based on triggers. For a tutorial on using this workflow on
210
-
GitHub, see
211
-
[Tutorial: Implement Azure Policy as Code with GitHub](../tutorials/policy-as-code-github.md).
205
+
supports scripted steps and automation based on triggers.
0 commit comments