Skip to content

Commit 972f03c

Browse files
committed
powershell for initiatives4
1 parent 550b2de commit 972f03c

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

articles/azure-monitor/essentials/diagnostics-settings-policies-deployifnotexists.md

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,31 @@ $policyAssignment=Get-AzPolicyAssignment -Name '<assignment name>' -Scope '/subs
143143
```azurepowershell
144144
Get-AzPolicyState -PolicyAssignmentName $policyAssignment.Name -ResourceGroupName $policyAssignment.ResourceGroupName|select-object IsCompliant , ResourceID
145145
```
146+
---
147+
## Remediation tasks
146148

149+
Policies are applied to new resources when they're created. To apply a policy to existing resources, create a remediation task. Remediation tasks bring resources into compliance with a policy.
147150

151+
Remediation tasks act for specific policies. For initiatives that contain multiple policies, create a remediation task for each policy in the initiative where you have resources that you want to bring into compliance.
152+
153+
Define remediation tasks when you first assign the policy, or at any stage after assignment.
154+
155+
To create a remediation task for policies during the policy assignment, select the **Remediation** tab on **Assign policy** page and select the **Create remediation task** checkbox.
156+
157+
To create a remediation task after the policy has been assigned, select your assigned policy from the list on the Policy Assignments page.
158+
159+
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/remediation-after-assignment.png" alt-text="A screenshot showing the edit-initiative-assignment page with the checkbox unselected.":::
160+
161+
Select **Remediate**.
162+
Track the status of your remediation task in the **Remediation tasks** tab of the Policy Remediation page.
163+
164+
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/new-remediation-task-after-assignment.png" alt-text="A screenshot showing the new remediation task page.":::
165+
166+
167+
168+
169+
For more information on remediation tasks, see [Remediate non-compliant resources](../../governance/policy/how-to/remediate-resources.md)
148170

149-
---
150171
## Assign initiatives
151172

152173
Initiatives are collections of policies. There are three initiatives for Azure Monitor Diagnostics settings:
@@ -226,8 +247,6 @@ Log Analytics*, ResourceID "/providers/Microsoft.Authorization/policySetDefinit
226247
```azurepowershell
227248
Start-AzPolicyComplianceScan -ResourceGroupName $rg.ResourceGroupName;
228249
```
229-
230-
231250
1. Get a list of resources to remediate and the required parameters by calling `Get-AzPolicyState`
232251
```azurepowershell
233252
$assignmentState=Get-AzPolicyState -PolicyAssignmentName $assignmentName -ResourceGroupName $rg.ResourceGroupName;
@@ -242,39 +261,16 @@ Log Analytics*, ResourceID "/providers/Microsoft.Authorization/policySetDefinit
242261
}
243262
```
244263
1. Check the compliance state when the remediation tasks have completed.
245-
```azurepowershell
264+
```azurepowershell
246265
Get-AzPolicyState -PolicyAssignmentName $assignmentName -ResourceGroupName $rg.ResourceGroupName|select-object IsCompliant , ResourceID
247-
```
266+
```
248267
249268
You can get your policy assignment details using the following command:
250269
```azurepowershell
251270
$policyAssignment=Get-AzPolicyAssignment -Name $assignmentName -Scope "/subscriptions/$subscriptionId/resourcegroups/$($rg.ResourceGroupName)";
252271
```
253272

254-
255-
## Remediation tasks
256-
257-
Policies are applied to new resources when they're created. To apply a policy to existing resources, create a remediation task. Remediation tasks bring resources into compliance with a policy.
258-
259-
Remediation tasks act for specific policies. For initiatives that contain multiple policies, create a remediation task for each policy in the initiative where you have resources that you want to bring into compliance.
260-
261-
Define remediation tasks when you first assign the policy, or at any stage after assignment.
262-
263-
To create a remediation task for policies during the policy assignment, select the **Remediation** tab on **Assign policy** page and select the **Create remediation task** checkbox.
264-
265-
To create a remediation task after the policy has been assigned, select your assigned policy from the list on the Policy Assignments page.
266-
267-
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/remediation-after-assignment.png" alt-text="A screenshot showing the edit-initiative-assignment page with the checkbox unselected.":::
268-
269-
Select **Remediate**.
270-
Track the status of your remediation task in the **Remediation tasks** tab of the Policy Remediation page.
271-
272-
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/new-remediation-task-after-assignment.png" alt-text="A screenshot showing the new remediation task page.":::
273-
274-
275-
276-
277-
For more information on remediation tasks, see [Remediate non-compliant resources](../../governance/policy/how-to/remediate-resources.md)
273+
---
278274

279275

280276

0 commit comments

Comments
 (0)