Skip to content

Commit 7078be8

Browse files
authored
Merge pull request #285905 from davidsmatlak/ds-policy-remediate-20240830
Adds note about Azure Policy remediations
2 parents e48c9d5 + a626f16 commit 7078be8

File tree

1 file changed

+48
-56
lines changed

1 file changed

+48
-56
lines changed
Lines changed: 48 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
---
22
title: Details of the policy remediation task structure
33
description: Describes the policy remediation task definition used by Azure Policy to bring resources into compliance.
4-
ms.date: 11/03/2022
4+
ms.date: 08/30/2024
55
ms.topic: conceptual
66
ms.author: kenieva
77
author: kenieva
88
---
9+
910
# Azure Policy remediation task structure
1011

11-
The Azure Policy remediation task feature is used to bring resources into compliance established from a definition and assignment. Resources that are non-compliant to a [modify](./effects.md#modify) or [deployIfNotExist](./effects.md#deployifnotexists) definition assignment, can be brought into compliance using a remediation task. Remediation task deploys the deployIFNotExist template or the modify operations to the selected non-compliant resources using the identity specified in the assignment. See [policy assignment structure](./assignment-structure.md#identity). to understand how the identity is define and [remediate non-compliant resources tutorial](../how-to/remediate-resources.md#configure-the-managed-identity) to configure the identity.
12+
The Azure Policy remediation task feature is used to bring resources into compliance established from a definition and assignment. Resources that are non-compliant to a [modify](./effect-modify.md) or [deployIfNotExists](./effect-deploy-if-not-exists.md) definition assignment, can be brought into compliance using a remediation task. A remediation task deploys the `deployIfNotExists` template or the `modify` operations to the selected non-compliant resources using the identity specified in the assignment. For more information, see [policy assignment structure](./assignment-structure.md#identity) to understand how the identity is defined and [remediate non-compliant resources tutorial](../how-to/remediate-resources.md#configure-the-managed-identity) to configure the identity.
13+
14+
Remediation tasks remediate existing resources that aren't compliant. Resources that are newly created or updated that are applicable to a `deployIfNotExists` or `modify` definition assignment are automatically remediated.
1215

1316
> [!NOTE]
14-
> Remediation tasks remediate exisiting resources that are not compliant. Resources that are newly created or updated that are applicable to a deployIfNotExist or modify definition assignment are automatically remediated.
17+
> The Azure Policy service deletes remediation task resources 60 days after their last modification.
1518
1619
You use JavaScript Object Notation (JSON) to create a policy remediation task. The policy remediation task contains elements for:
1720

@@ -26,93 +29,82 @@ You use JavaScript Object Notation (JSON) to create a policy remediation task. T
2629
- [provisioning state and deployment summary](#provisioning-state-and-deployment-summary)
2730

2831

29-
For example, the following JSON shows a policy remediation task for policy definition named `requiredTags` a part of
30-
an initiative assignment named `resourceShouldBeCompliantInit` with all default settings.
32+
For example, the following JSON shows a policy remediation task for policy definition named `requiredTags` a part of an initiative assignment named `resourceShouldBeCompliantInit` with all default settings.
3133

3234
```json
3335
{
34-
"id": "/subscriptions/{subId}/resourceGroups/ExemptRG/providers/Microsoft.PolicyInsights/remediations/remediateNotCompliant",
35-
"apiVersion": "2021-10-01",
36-
"name": "remediateNotCompliant",
37-
"type": "Microsoft.PolicyInsights/remediations",
38-
"properties": {
39-
"policyAssignmentId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyAssignments/resourceShouldBeCompliantInit",
40-
"policyDefinitionReferenceIds": "requiredTags",
41-
"resourceCount": 42,
42-
"parallelDeployments": 6,
43-
"failureThreshold": {
44-
"percentage": 0.1
45-
}
36+
"id": "/subscriptions/{subId}/resourceGroups/ExemptRG/providers/Microsoft.PolicyInsights/remediations/remediateNotCompliant",
37+
"apiVersion": "2021-10-01",
38+
"name": "remediateNotCompliant",
39+
"type": "Microsoft.PolicyInsights/remediations",
40+
"properties": {
41+
"policyAssignmentId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyAssignments/resourceShouldBeCompliantInit",
42+
"policyDefinitionReferenceId": "requiredTags",
43+
"resourceCount": 42,
44+
"parallelDeployments": 6,
45+
"failureThreshold": {
46+
"percentage": 0.1
4647
}
48+
}
4749
}
4850
```
49-
Steps on how to trigger a remediation task at [how to remediate non-compliant resources guide](../how-to/remediate-resources.md)
50-
51-
> [!NOTE]
52-
> These settings cannot be changed once the remediation task has started.
5351

52+
Steps on how to trigger a remediation task at [how to remediate non-compliant resources guide](../how-to/remediate-resources.md). These settings can't be changed after the remediation task begins.
5453

5554
## Display name and description
5655

57-
You use **displayName** and **description** to identify the policy remediation task and provide context for
58-
its use. **displayName** has a maximum length of _128_ characters and
59-
**description** a maximum length of _512_ characters.
56+
You use `displayName` and `description` to identify the policy remediation task and provide context for its use. `displayName` has a maximum length of _128_ characters and `description` a maximum length of _512_ characters.
6057

6158
## Policy assignment ID
6259

63-
This field must be the full path name of either a policy assignment or an initiative assignment.
64-
`policyAssignmentId` is a string and not an array. This property defines which assignment the parent
65-
resource hierarchy or individual resource to remediate.
60+
This field must be the full path name of either a policy assignment or an initiative assignment. `policyAssignmentId` is a string and not an array. This property defines which assignment the parent resource hierarchy or individual resource to remediate.
6661

6762
## Policy definition ID
6863

69-
If the `policyAssignmentId` is for an initiative assignment, the **policyDefinitionReferenceId** property must be used to specify which policy definition in the initiative the subject resource(s) are to be remediated. As a remediation can only remediate in a scope of one definition,
70-
this property is a _string_ and not an array. The value must match the value in the initiative definition in the
71-
`policyDefinitions.policyDefinitionReferenceId` field instead of the global identifier for policy definition `Id`.
64+
If the `policyAssignmentId` is for an initiative assignment, the `policyDefinitionReferenceId` property must be used to specify which policy definition in the initiative the subject resources are to be remediated. As a remediation can only remediate in a scope of one definition, this property is a _string_ and not an array. The value must match the value in the initiative definition in the `policyDefinitions.policyDefinitionReferenceId` field instead of the global identifier for policy definition `Id`.
7265

7366
## Resource count and parallel deployments
7467

75-
Use **resource count** to determine how many non-compliant resources to remediate in a given remediation task. The default value is 500, with the maximum number being 50,000. **Parallel deployments** determines how many of those resources to remediate at the same time. The allowed range is between 1 to 30 with the default value being 10.
68+
Use `resourceCount` to determine how many non-compliant resources to remediate in a given remediation task. The default value is 500, with the maximum number being 50,000. `parallelDeployments` determines how many of those resources to remediate at the same time. The allowed range is between 1 to 30 with the default value being 10.
7669

77-
> [!NOTE]
78-
> Parallel deployments are the number of deployments within a singular remediation task with a maximum of 30. There can be a maximum of 100 remediation tasks running in parallel for a single policy definition or policy reference within an initiative.
70+
Parallel deployments are the number of deployments within a singular remediation task with a maximum of 30. There can be a maximum of 100 remediation tasks running in parallel for a single policy definition or policy reference within an initiative.
7971

8072
## Failure threshold
8173

82-
An optional property used to specify whether the remediation task should fail if the percentage of failures exceeds the given threshold. The **failure threshold** is represented as a percentage number from 0 to 100. By default, the failure threshold is 100%, meaning that the remediation task will continue to remediate other resources even if resources fail to remediate.
74+
An optional property used to specify whether the remediation task should fail if the percentage of failures exceeds the given threshold. The `failureThreshold` is represented as a percentage number from 0 to 100. By default, the failure threshold is 100%, meaning that the remediation task continues to remediate other resources even if resources fail to remediate.
8375

84-
## Remediation filters
76+
## Remediation filters
8577

86-
An optional property refines what resources are applicable to the remediation task. The allowed filter is resource location. Unless specified, resources from any region can be remediated.
78+
An optional property refines what resources are applicable to the remediation task. The allowed filter is resource location. Unless specified, resources from any region can be remediated.
8779

8880
## Resource discovery mode
8981

90-
This property decides how to discover resources that are eligible for remediation. For a resource to be eligible, it must be non-compliant. By default, this property is set to `ExistingNonCompliant`. It could also be set to `ReEvaluateCompliance`, which will trigger a new compliance scan for that assignment and remediate any resources that are found non-compliant.
82+
This property decides how to discover resources that are eligible for remediation. For a resource to be eligible, it must be non-compliant. By default, this property is set to `ExistingNonCompliant`. It could also be set to `ReEvaluateCompliance`, which triggers a new compliance scan for that assignment and remediate any resources that are found non-compliant.
9183

9284
## Provisioning state and deployment summary
9385

94-
Once a remediation task is created, **provisioning state** and **deployment summary** properties are populated. **Provisioning state** indicates the status of the remediation task. Allow values are `Running`, `Canceled`, `Cancelling`, `Failed`, `Complete`, or `Succeeded`. **Deployment summary** is an array property indicating the number of deployments along with number of successful and failed deployments.
86+
Once a remediation task is created, `ProvisioningState` and `DeploymentSummary` properties are populated. The `ProvisioningState` indicates the status of the remediation task. Allow values are `Running`, `Canceled`, `Cancelling`, `Failed`, `Complete`, or `Succeeded`. The `DeploymentSummary` is an array property indicating the number of deployments along with number of successful and failed deployments.
9587

96-
Sample of remediation task that completed successfully:
88+
Sample of remediation task that completed successfully:
9789

9890
```json
9991
{
100-
"id": "/subscriptions/{subId}/resourceGroups/ExemptRG/providers/Microsoft.PolicyInsights/remediations/remediateNotCompliant",
101-
"Type": "Microsoft.PolicyInsights/remediations",
102-
"Name": "remediateNotCompliant",
103-
"PolicyAssignmentId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyAssignments/resourceShouldBeCompliantInit",
104-
"policyDefinitionReferenceIds": "requiredTags",
105-
"resourceCount": 42,
106-
"parallelDeployments": 6,
107-
"failureThreshold": {
108-
"percentage": 0.1
109-
},
110-
"ProvisioningState": "Succeeded",
111-
"DeploymentSummary": {
112-
"TotalDeployments": 42,
113-
"SuccessfulDeployments": 42,
114-
"FailedDeployments": 0
115-
},
92+
"id": "/subscriptions/{subId}/resourceGroups/ExemptRG/providers/Microsoft.PolicyInsights/remediations/remediateNotCompliant",
93+
"Type": "Microsoft.PolicyInsights/remediations",
94+
"Name": "remediateNotCompliant",
95+
"PolicyAssignmentId": "/subscriptions/{mySubscriptionID}/providers/Microsoft.Authorization/policyAssignments/resourceShouldBeCompliantInit",
96+
"policyDefinitionReferenceId": "requiredTags",
97+
"resourceCount": 42,
98+
"parallelDeployments": 6,
99+
"failureThreshold": {
100+
"percentage": 0.1
101+
},
102+
"ProvisioningState": "Succeeded",
103+
"DeploymentSummary": {
104+
"TotalDeployments": 42,
105+
"SuccessfulDeployments": 42,
106+
"FailedDeployments": 0
107+
},
116108
}
117109
```
118110

@@ -122,5 +114,5 @@ Sample of remediation task that completed successfully:
122114
- Learn how to [get compliance data](../how-to/get-compliance-data.md).
123115
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
124116
- Understand how to [react to Azure Policy state change events](./event-overview.md).
125-
- Learn about the [policy definition structure](./definition-structure.md).
117+
- Learn about the [policy definition structure](./definition-structure-basics.md).
126118
- Learn about the [policy assignment structure](./assignment-structure.md).

0 commit comments

Comments
 (0)