Skip to content

Commit 5a8b8da

Browse files
authored
Merge pull request #189134 from pilor/policyBestPractices
Clarify policy best practices
2 parents 780d5af + a8e8527 commit 5a8b8da

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

articles/governance/policy/concepts/assignment-structure.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ after creation of the initial assignment.
133133
## Policy definition ID
134134

135135
This field must be the full path name of either a policy definition or an initiative definition.
136-
`policyDefinitionId` is a string and not an array. It's recommended that if multiple policies are
137-
often assigned together, to use an [initiative](./initiative-definition-structure.md) instead.
136+
`policyDefinitionId` is a string and not an array. The latest content of the assigned policy
137+
definition or initiative will be retrieved each time the policy assignment is evaluated. It's
138+
recommended that if multiple policies are often assigned together, to use an
139+
[initiative](./initiative-definition-structure.md) instead.
138140

139141
## Non-compliance messages
140142

@@ -222,3 +224,4 @@ For policy assignments with effect set to **deployIfNotExisit** or **modify**, i
222224
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
223225
- Review what a management group is with
224226
[Organize your resources with Azure management groups](../../management-groups/overview.md).
227+

articles/governance/policy/concepts/policy-as-code.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ Like policy definitions, when adding or updating an existing initiative, the wor
120120
automatically update the initiative definition in Azure. Testing of the new or updated initiative
121121
definition comes in a later step.
122122

123+
> [!NOTE]
124+
> It's recommended to use a centralized deployment mechanism like GitHub workflows or Azure
125+
> Pipelines to deploy policies. This helps to ensure only reviewed policy resources are deployed
126+
> to your environment and that a central deployment mechanism is used. _Write_ permissions
127+
> to policy resources can be restricted to the identity used in the deployment.
128+
123129
### Test and validate the updated definition
124130

125131
Once automation has taken your newly created or updated policy or initiative definitions and made
@@ -213,3 +219,4 @@ GitHub, see
213219
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
214220
- Review what a management group is with
215221
[Organize your resources with Azure management groups](../../management-groups/overview.md).
222+

articles/governance/policy/how-to/remediate-resources.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ following code:
6363
az role definition list --name 'Contributor'
6464
```
6565

66+
> [!IMPORTANT]
67+
> Permissions should be restricted to the smallest possible set when defining **roleDefinitionIds**
68+
> within a policy definition or assigning permissions to a managed identity manually. See
69+
> [managed identity best practice recommendations](../../../active-directory/managed-identities-azure-resources/managed-identity-best-practice-recommendations.md)
70+
> for more best practices.
71+
6672
## Manually configure the managed identity
6773

6874
When creating an assignment using the portal, Azure Policy can both generate a managed identity and
@@ -228,7 +234,7 @@ To create a **remediation task**, follow these steps:
228234
229235
1. On the **New remediation task** page, optional remediation settings are shown:
230236

231-
- **Failure Threshold percentage** - Used to specify whether the remediation task should fail if the percentage of failures exceeds the given threshold. Provided as a number between 0 to 100. By default, the failure threshold is 100%.
237+
- **Failure Threshold percentage** - Used to specify whether the remediation task should fail if the percentage of failures exceeds the given threshold. Provided as a number between 0 to 100. By default, the failure threshold is 100%.
232238
- **Resource Count** - Determines how many non-compliant resources to remediate in a given remediation task. The default value is 500 (the previous limit). The maximum number of is 50,000 resources.
233239
- **Parallel Deployments** - Determines how many resources to remediate at the same time. The allowed values are 1 to 30 resources at a time. The default value is 10.
234240

articles/governance/policy/overview.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ Azure Policy has several permissions, known as operations, in two Resource Provi
116116
Many Built-in roles grant permission to Azure Policy resources. The **Resource Policy Contributor**
117117
role includes most Azure Policy operations. **Owner** has full rights. Both **Contributor** and
118118
**Reader** have access to all _read_ Azure Policy operations. **Contributor** may trigger resource
119-
remediation, but can't _create_ definitions or assignments. **User Access Administrator** is
119+
remediation, but can't _create_ or _update_ definitions and assignments. **User Access Administrator** is
120120
necessary to grant the managed identity on **deployIfNotExists** or **modify** assignments necessary
121121
permissions. All policy objects will be readable to all roles over the scope.
122122

123123
If none of the Built-in roles have the permissions required, create a
124124
[custom role](../../role-based-access-control/custom-roles.md).
125125

126+
Azure Policy operations can have a significant impact on your Azure environment. Only the minimum set of
127+
permissions necessary to perform a task should be assigned and these permissions should not be granted
128+
to users who do not need them.
129+
126130
> [!NOTE]
127131
> The managed identity of a **deployIfNotExists** or **modify** policy assignment needs enough
128132
> permissions to create or update targetted resources. For more information, see
@@ -157,12 +161,16 @@ Here are a few pointers and tips to keep in mind:
157161
_initiativeDefC_. If you create another policy definition later for _policyDefB_ with goals
158162
similar to _policyDefA_, you can add it under _initiativeDefC_ and track them together.
159163

160-
- Once you've created an initiative assignment, policy definitions added to the initiative also
164+
- Once you've created an initiative assignment, policy definitions added to the initiative also
161165
become part of that initiative's assignments.
162-
163-
- When an initiative assignment is evaluated, all policies within the initiative are also evaluated.
166+
167+
- When an initiative assignment is evaluated, all policies within the initiative are also evaluated.
164168
If you need to evaluate a policy individually, it's better to not include it in an initiative.
165169

170+
- Manage Azure Policy resources as code with manual reviews on changes to policy definitions,
171+
initiatives, and assignments. To learn more about suggested patterns and tooling, see
172+
[Design Azure Policy as Code Workflows](./concepts/policy-as-code.md).
173+
166174
## Azure Policy objects
167175

168176
### Policy definition
@@ -264,7 +272,7 @@ To learn more about the structures of initiative definitions, review
264272

265273
### Assignments
266274

267-
An assignment is a policy definition or initiative that has been assigned to take place within a
275+
An assignment is a policy definition or initiative that has been assigned to a
268276
specific scope. This scope could range from a [management group](../management-groups/overview.md)
269277
to an individual resource. The term _scope_ refers to all the resources, resource groups,
270278
subscriptions, or management groups that the definition is assigned to. Assignments are inherited by
@@ -284,6 +292,10 @@ subscription from the management group-level assignment. Then, assign the more p
284292
on the child management group or subscription level. If any assignment results in a resource getting
285293
denied, then the only way to allow the resource is to modify the denying assignment.
286294

295+
Policy assignments always use the latest state of their assigned definition or initiative when
296+
evaluating resources. If a policy definition that is already assigned is changed all existing
297+
assignments of that definition will use the updated logic when evaluating.
298+
287299
For more information on setting assignments through the portal, see [Create a policy assignment to
288300
identify non-compliant resources in your Azure environment](./assign-policy-portal.md). Steps for
289301
[PowerShell](./assign-policy-powershell.md) and [Azure CLI](./assign-policy-azurecli.md) are also

0 commit comments

Comments
 (0)