Skip to content

Commit 737d152

Browse files
committed
fixes
1 parent 5c27074 commit 737d152

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ To apply a policy using the CLI, use the following commands:
5555
1. Create a policy assignment using
5656
```azurecli
5757
58-
az policy assignment create --name <policy assignment name> --policy "6b359d8f-f88d-4052-aa7c-32015963ecc1" --scope </subsciption/12345687-abcf-....> --params "{\"logAnalytics\": {\"value\": \"<log analytics workspace resource ID"}}" --mi-system-assigned --location <location>
58+
az policy assignment create --name <policy assignment name> --policy "6b359d8f-f88d-4052-aa7c-32015963ecc1" --scope <scope> --params "{\"logAnalytics\": {\"value\": \"<log analytics workspace resource ID"}}" --mi-system-assigned --location <location>
5959
```
6060
For example, to apply the policy to send audit logs to a log analytics workspace
6161

6262
```azurecli
63-
az policy assignment create --name "policy-assignment-1" --policy "6b359d8f-f88d-4052-aa7c-32015963ecc1" --scope /subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourceGroups/rg-001 --params "{\"logAnalytics\": {\"value\": \"/subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourcegroups/rg-001/providers/microsoft.operationalinsights/workspaces/workspace001\"}}" --mi-system-assigned --location eastus
63+
az policy assignment create --name "policy-assignment-1" --policy "6b359d8f-f88d-4052-aa7c-32015963ecc1" --scope /subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourceGroups/rg-001 --params "{\"logAnalytics\": {\"value\": \"/subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourcegroups/rg-001/providers/microsoft.operationalinsights/workspaces/workspace-001\"}}" --mi-system-assigned --location eastus
6464
```
6565

6666
2. Assign the required role to the identity created for the policy assignment.
@@ -156,7 +156,7 @@ To create a remediation task for policies during the policy assignment, select t
156156

157157
To create a remediation task after the policy has been assigned, select your assigned policy from the list on the Policy Assignments page.
158158

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.":::
159+
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/remediation-after-assignment.png" alt-text="A screenshot showing the policy remediation page.":::
160160

161161
Select **Remediate**.
162162
Track the status of your remediation task in the **Remediation tasks** tab of the Policy Remediation page.
@@ -269,12 +269,11 @@ You can get your policy assignment details using the following command:
269269

270270
### [CLI](#tab/cli)
271271

272-
Assign intitiatevs and remediatie policies using Azure CLI.
273272

274-
1. Log in to your Azure account using the `az login` command.
273+
1. Sign in to your Azure account using the `az login` command.
275274
1. Select the subscription where you want to apply the policy initiative using the `az account` set command.
276275

277-
1. Assign the initiative.
276+
1. Assign the initiative using [az policy assignment create](https://learn.microsoft.com/cli/azure/policy/assignment?view=azure-cli-latest#az-policy-assignment-create).
278277

279278
```azurecli
280279
az policy assignment create --name <assignment name> --resource-group <resource group name> --policy-set-definition <initiative name> --params <parameters object> --mi-system-assigned --location <location>
@@ -296,7 +295,7 @@ Assign intitiatevs and remediatie policies using Azure CLI.
296295
"deployment": {
297296
"properties": {...
298297
```
299-
Assign the required role:
298+
Assign the required role using [az policy assignment identity assign](https://learn.microsoft.com/cli/azure/policy/assignment/identity?view=azure-cli-latest):
300299
```azurecli
301300
az policy assignment identity assign --system-assigned --resource-group <resource group name> --role <role name or ID> --identity-scope <scope> --name <policy assignment name>
302301
```
@@ -305,23 +304,22 @@ Assign intitiatevs and remediatie policies using Azure CLI.
305304
```azurecli
306305
az policy assignment identity assign --system-assigned --resource-group "cli-example-01" --role 92aaf0da-9dab-42b6-94a3-d43ce8d16293 --identity-scope "/subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourcegroups/cli-example-01" --name assign-cli-example-01
307306
```
308-
1. Create remediation tasks for the policies in the initiative .
307+
1. Create remediation tasks for the policies in the initiative.
309308
310-
Remediation tasks are done on a per-policy basis. Each task is for a specific `definition-reference-id`, specified in the initiative as `policyDefinitionReferenceId`
311-
To find the `definition-reference-id` parameter use the follwoing command:
309+
Remediation tasks are created per-policy. Each task is for a specific `definition-reference-id`, specified in the initiative as `policyDefinitionReferenceId`. To find the `definition-reference-id` parameter, use the following command:
312310
```azurecli
313311
az policy set-definition show --name f5b29bc4-feca-4cc6-a58a-772dd5e290a5 |grep policyDefinitionReferenceId
314312
```
315-
Remediate the resources
313+
Remediate the resources using [az policy remediation create](https://learn.microsoft.com/cli/azure/policy/remediation?view=azure-cli-latest#az-policy-remediati
314+
316315
```azurecli
317316
az policy remediation create --resource-group <resource group name> --policy-assignment <assignment name> --name <remediation task name> --definition-reference-id "policy specific reference ID" --resource-discovery-mode ReEvaluateCompliance
318317
```
319318
For example:
320319
```azurecli
321320
az policy remediation create --resource-group "cli-example-01" --policy-assignment assign-cli-example-01 --name "rem-assign-cli-example-01" --definition-reference-id "keyvault-vaults" --resource-discovery-mode ReEvaluateCompliance
322321
```
323-
To create a remediation task for all of the policies in the initiative,
324-
322+
To create a remediation task for all of the policies in the initiative, use the following example:
325323
```bash
326324
for policyDefinitionReferenceId in $(az policy set-definition show --name f5b29bc4-feca-4cc6-a58a-772dd5e290a5 |grep policyDefinitionReferenceId |cut -d":" -f2|sed s/\"//g)
327325
do

0 commit comments

Comments
 (0)