Skip to content

Commit 51d40c9

Browse files
committed
removed workaround
1 parent edf2711 commit 51d40c9

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ Find the role in the policy definition by searching for *roleDefinitionIds*
7777
```azurecli
7878
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
7979
```
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-
```
80+
8681
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).
8782

8883
```azurecli
@@ -137,10 +132,6 @@ To apply a policy using the PowerShell, use the following commands:
137132
New-AzRoleAssignment -Scope $rg.ResourceId -ObjectId $policyAssignment.Identity.PrincipalId -RoleDefinitionId $roleDefId
138133
}
139134
```
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-
```
144135

145136
1. Scan for compliance, then create a remediation task to force compliance for existing resources.
146137
```azurepowershell
@@ -154,21 +145,6 @@ To apply a policy using the PowerShell, use the following commands:
154145
```
155146
---
156147

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-
171-
172148
## Remediation tasks
173149

174150
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.

0 commit comments

Comments
 (0)