Skip to content

Commit bdfc0a2

Browse files
Merge pull request #232585 from EdB-MSFT/policies-remove-workaround
removed workaround
2 parents ae72094 + 1165ce2 commit bdfc0a2

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

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

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ The following steps show how to apply the policy to send audit logs to for key v
4343
1. Select **Review + create**, then select **Create** .
4444
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/assign-policy-remediation.png" alt-text="A screenshot of the assign policy page, remediation tab.":::
4545

46-
The policy visible in the resources' diagnostic setting after approximately 30 minutes.
4746

4847
### [CLI](#tab/cli)
4948
To apply a policy using the CLI, use the following commands:
@@ -77,12 +76,7 @@ Find the role in the policy definition by searching for *roleDefinitionIds*
7776
```azurecli
7877
az policy assignment identity assign --system-assigned --resource-group rg-001 --role 92aaf0da-9dab-42b6-94a3-d43ce8d16293 --identity-scope /subscriptions/12345678-aaaa-bbbb-cccc-1234567890ab/resourceGroups/rg001 --name policy-assignment-1
7978
```
80-
81-
When assigning policies that send logs to event hubs, you must manually add the *Azure Event Hubs Data Owner* role for the event hub to your policy assigned identity.
82-
83-
```azurecli
84-
az role assignment create --assignee <Principal ID> --role "Azure Event Hubs Data Owner" --scope /subscriptions/<subscription ID>/resourceGroups/<event hub's resource group>
85-
```
79+
8680
1. Trigger a scan to find existing resources using [`az policy state trigger-scan`](https://learn.microsoft.com/cli/azure/policy/state?view=azure-cli-latest#az-policy-state-trigger-scan).
8781

8882
```azurecli
@@ -137,10 +131,6 @@ To apply a policy using the PowerShell, use the following commands:
137131
New-AzRoleAssignment -Scope $rg.ResourceId -ObjectId $policyAssignment.Identity.PrincipalId -RoleDefinitionId $roleDefId
138132
}
139133
```
140-
When assigning policies that send logs to event hubs, you must manually add the *Azure Event Hubs Data Owner* role for the event hub to your system assigned Managed Identity.
141-
```azurepowershell
142-
New-AzRoleAssignment -Scope /subscriptions/<subscription ID>/resourceGroups/<event hub's resource group> -ObjectId $policyAssignment.Identity.PrincipalId -RoleDefinitionId "Azure Event Hubs Data Owner"
143-
```
144134

145135
1. Scan for compliance, then create a remediation task to force compliance for existing resources.
146136
```azurepowershell
@@ -154,20 +144,7 @@ To apply a policy using the PowerShell, use the following commands:
154144
```
155145
---
156146

157-
> [!Note]
158-
> When assigning policies that send logs to event hubs, you must manually add the *Azure Event Hubs Data Owner* role for the event hub to your policy assigned identity.
159-
> Use the `az role assignment create` Azure CLI command.
160-
> ```azurecli
161-
> az role assignment create --assignee <Principal ID> --role "Azure Event Hubs Data Owner" --scope /subscriptions/<subscription ID>/resourceGroups/<event hub's resource group>
162-
>```
163-
> For example:
164-
> ```azurecli
165-
> az role assignment create --assignee xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --role "Azure Event Hubs Data Owner" --scope /subscriptions/yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy/resourceGroups/myResourceGroup
166-
>```
167-
>
168-
> Find your principal ID on the **Policy Assignment** page, **Managed Identity** tab.
169-
> :::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/find-principal.png" alt-text="A screenshot showing the policy assignment page, managed identity tab.":::
170-
147+
The policy is visible in the resources' diagnostic settings after approximately 30 minutes.
171148

172149
## Remediation tasks
173150

0 commit comments

Comments
 (0)