Skip to content

Commit dc8a452

Browse files
Add initial content
1 parent f5c59e3 commit dc8a452

File tree

1 file changed

+44
-149
lines changed

1 file changed

+44
-149
lines changed
Lines changed: 44 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,51 @@
11
---
2-
title: Details of the policy exemption structure
3-
description: Describes the policy exemption definition used by Azure Policy to exempt resources from evaluation of initiatives or definitions.
4-
ms.date: 08/17/2021
2+
title: Azure Policy applicability logic
3+
description: Describes the rules Azure Policy uses to determine whether the policy is applied to its assigned resources.
4+
ms.date: 05/19/2022
55
ms.topic: conceptual
6+
ms.author: timwarner
7+
author: timwarner-msft
68
---
7-
# Azure Policy exemption structure
8-
9-
The Azure Policy exemptions feature is used to _exempt_ a resource hierarchy or an
10-
individual resource from evaluation of initiatives or definitions. Resources that are _exempt_ count
11-
toward overall compliance, but can't be evaluated or have a temporary waiver. For more information,
12-
see [Understand scope in Azure Policy](./scope.md). Azure Policy exemptions only work with
13-
[Resource Manager modes](./definition-structure.md#resource-manager-modes) and don't work with
14-
[Resource Provider modes](./definition-structure.md#resource-provider-modes).
15-
16-
You use JavaScript Object Notation (JSON) to create a policy exemption. The policy exemption contains elements for:
17-
18-
- display name
19-
- description
20-
- metadata
21-
- policy assignment
22-
- policy definitions within an initiative
23-
- exemption category
24-
- expiration
25-
26-
> [!NOTE]
27-
> A policy exemption is created as a child object on the resource hierarchy or the individual
28-
> resource granted the exemption, so the target isn't included in the exemption definition.
29-
30-
For example, the following JSON shows a policy exemption in the **waiver** category of a resource to
31-
an initiative assignment named `resourceShouldBeCompliantInit`. The resource is _exempt_ from only
32-
two of the policy definitions in the initiative, the `customOrgPolicy` custom policy definition
33-
(reference `requiredTags`) and the **Allowed locations** built-in policy definition (ID:
34-
`e56962a6-4747-49cd-b67b-bf8b01975c4c`, reference `allowedLocations`):
35-
36-
```json
37-
{
38-
"id": "/subscriptions/{subId}/resourceGroups/ExemptRG/providers/Microsoft.Authorization/policyExemptions/resourceIsNotApplicable",
39-
"name": "resourceIsNotApplicable",
40-
"type": "Microsoft.Authorization/policyExemptions",
41-
"properties": {
42-
"displayName": "This resource is scheduled for deletion",
43-
"description": "This resources is planned to be deleted by end of quarter and has been granted a waiver to the policy.",
44-
"metadata": {
45-
"requestedBy": "Storage team",
46-
"approvedBy": "IA",
47-
"approvedOn": "2020-07-26T08:02:32.0000000Z",
48-
"ticketRef": "4baf214c-8d54-4646-be3f-eb6ec7b9bc4f"
49-
},
50-
"policyAssignmentId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyAssignments/resourceShouldBeCompliantInit",
51-
"policyDefinitionReferenceIds": [
52-
"requiredTags",
53-
"allowedLocations"
54-
],
55-
"exemptionCategory": "waiver",
56-
"expiresOn": "2020-12-31T23:59:00.0000000Z"
57-
}
58-
}
59-
```
60-
61-
Snippet of the related initiative with the matching `policyDefinitionReferenceIds` used by the
62-
policy exemption:
63-
64-
```json
65-
"policyDefinitions": [
66-
{
67-
"policyDefinitionId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyDefinitions/customOrgPolicy",
68-
"policyDefinitionReferenceId": "requiredTags",
69-
"parameters": {
70-
"reqTags": {
71-
"value": "[parameters('init_reqTags')]"
72-
}
73-
}
74-
},
75-
{
76-
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c",
77-
"policyDefinitionReferenceId": "allowedLocations",
78-
"parameters": {
79-
"listOfAllowedLocations": {
80-
"value": "[parameters('init_listOfAllowedLocations')]"
81-
}
82-
}
83-
}
84-
]
85-
```
86-
87-
## Display name and description
88-
89-
You use **displayName** and **description** to identify the policy exemption and provide context for
90-
its use with the specific resource. **displayName** has a maximum length of _128_ characters and
91-
**description** a maximum length of _512_ characters.
92-
93-
## Metadata
94-
95-
The **metadata** property allows creating any child property needed for storing relevant
96-
information. In the example above, properties **requestedBy**, **approvedBy**, **approvedOn**, and
97-
**ticketRef** contains customer values to provide information on who requested the exemption, who
98-
approved it and when, and an internal tracking ticket for the request. These **metadata** properties
99-
are examples, but they aren't required and **metadata** isn't limited to these child properties.
100-
101-
## Policy assignment ID
102-
103-
This field must be the full path name of either a policy assignment or an initiative assignment.
104-
`policyAssignmentId` is a string and not an array. This property defines which assignment the parent
105-
resource hierarchy or individual resource is _exempt_ from.
106-
107-
## Policy definition IDs
108-
109-
If the `policyAssignmentId` is for an initiative assignment, the **policyDefinitionReferenceIds** property may be used to specify which policy definition(s) in the initiative the subject resource
110-
has an exemption to. As the resource may be exempted from one or more included policy definitions,
111-
this property is an _array_. The values must match the values in the initiative definition in the
112-
`policyDefinitions.policyDefinitionReferenceId` fields.
113-
114-
## Exemption category
115-
116-
Two exemption categories exist and are used to group exemptions:
117-
118-
- **Mitigated**: The exemption is granted because the policy intent is met through another method.
119-
- **Waiver**: The exemption is granted because the non-compliance state of the resource is
120-
temporarily accepted. Another reason to use this category is for a resource or resource hierarchy
121-
that should be excluded from one or more definitions in an initiative, but shouldn't be excluded
122-
from the entire initiative.
123-
124-
## Expiration
125-
126-
To set when a resource hierarchy or an individual resource is no longer _exempt_ from an assignment,
127-
set the **expiresOn** property. This optional property must be in the Universal ISO 8601 DateTime
128-
format `yyyy-MM-ddTHH:mm:ss.fffffffZ`.
129-
130-
> [!NOTE]
131-
> The policy exemptions isn't deleted when the `expiresOn` date is reached. The object is preserved
132-
> for record-keeping, but the exemption is no longer honored.
133-
134-
## Required permissions
135-
136-
The Azure RBAC permissions needed to manage Policy exemption objects are in the
137-
`Microsoft.Authorization/policyExemptions` operation group. The built-in roles
138-
[Resource Policy Contributor](../../../role-based-access-control/built-in-roles.md#resource-policy-contributor)
139-
and [Security Admin](../../../role-based-access-control/built-in-roles.md#security-admin) both have
140-
the `read` and `write` permissions and
141-
[Policy Insights Data Writer (Preview)](../../../role-based-access-control/built-in-roles.md#policy-insights-data-writer-preview)
142-
has the `read` permission.
143-
144-
Exemptions have extra security measures because of the impact of granting an exemption. Beyond
145-
requiring the `Microsoft.Authorization/policyExemptions/write` operation on the resource hierarchy
146-
or individual resource, the creator of an exemption must have the `exempt/Action` verb on the target
147-
assignment.
9+
# Azure Policy applicability logic
10+
11+
Azure Policy effects are applied based on the evaluation result of the
12+
****If**** condition(s) defined in the definition JavaScript Object Notation (JSON)
13+
file.
14+
15+
## Applicability logic for Append/Mod**If**y/Audit/Deny/DataPlane effects
16+
17+
Azure Policy evaluates only type and name conditions in the **If** and treats other conditions as true (false when negated). **If** the final evaluation result is true, the policy is applicable. Otherwise, it's not applicable.
18+
19+
Following are special cases to the previously described applicability logic:
20+
21+
- Any invalid aliases in the ****If**** conditions
22+
- The policy is not applicable
23+
- When the **If** conditions consist of only type conditions
24+
- The policy is applicable to all resources. (Legacy logic. Configurable)
25+
- When the **If** conditions consist of only name conditions
26+
- The policy is applicable to all resources.
27+
- When the **If** conditions consist of only type and name conditions
28+
- It depends on which field the first condition in the **If** refers to. It applies the applicability logic with conditions with that field only. E.g. when "type" field appears in the first condition of the **If**, only type conditions are considered when deciding applicability. When "name" field appears in the first condition of the **If**, only name conditions are considered when deciding applicability.
29+
- When any conditions (including deployment parameters) include a location condition
30+
- Will not be applicable to subscriptions
31+
32+
## Applicability logic for AuditIfNotExists and DeployIfNotExists policy effects
33+
34+
Audit**If**NotExists / Deploy**If**NotExists policies
35+
The applicability is based on the **If** conditions.
36+
37+
Applicability logic
38+
When the **If** evaluates to false, the policy is not applicable.
39+
40+
41+
42+
43+
44+
45+
14846

14947
## Next steps
15048

151-
- Learn about the [policy definition structure](./definition-structure.md).
152-
- Understand how to [programmatically create policies](../how-to/programmatically-create.md).
153-
- Learn how to [get compliance data](../how-to/get-compliance-data.md).
49+
- Learn how to [Get compliance data of Azure resources](../how-to/get-compliance-data.md).
15450
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
155-
- Review what a management group is with
156-
[Organize your resources with Azure management groups](../../management-groups/overview.md).
51+
- Review the [update in policy compliance for resource type policies](https://azure.microsoft.com/en-us/updates/general-availability-update-in-policy-compliance-for-resource-type-policies/).

0 commit comments

Comments
 (0)