You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/essentials/diagnostics-settings-policies-deployifnotexists.md
+32-6Lines changed: 32 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ ms.reviewer: lualderm
13
13
Policies and policy initiatives provide a simple method to enable logging at-scale via diagnostics settings for Azure Monitor. Using a policy initiative, you can turn on audit logging for all [supported resources](#supported-resources) in your Azure environment.
14
14
15
15
Enable resource logs to track activities and events that take place on your resources and give you visibility and insights into any changes that occur.
16
-
Assign policies to enable resource logs and to send them to destinations according to your needs. Send logs to Event Hubs for third-party SIEM systems, enabling continuous security operations. Send logs to storage accounts for longer term storage or the fulfillment of regulatory compliance.
16
+
Assign policies to enable resource logs and to send them to destinations according to your needs. Send logs to event hubs for third-party SIEM systems, enabling continuous security operations. Send logs to storage accounts for longer term storage or the fulfillment of regulatory compliance.
17
17
18
-
A set of built-in policies and initiatives exists to direct resource logs to Log Analytics Workspaces, Event Hubs, and Storage Accounts. The policies enable audit logging, sending logs belonging to the **audit** log category group to an Event Hub, Log Analytics workspace or Storage Account. The policies' `effect` is `DeployIfNotExists`, which deploys the policy as a default if there aren't other settings defined.
18
+
A set of built-in policies and initiatives exists to direct resource logs to Log Analytics Workspaces, Event Hubs, and Storage Accounts. The policies enable audit logging, sending logs belonging to the **audit** log category group to an event hub, Log Analytics workspace or Storage Account. The policies' `effect` is `DeployIfNotExists`, which deploys the policy as a default if there aren't other settings defined.
19
19
20
20
21
21
## Deploy policies.
@@ -31,7 +31,7 @@ The following steps show how to apply the policy to send audit logs to for key v
31
31
1. Select **Monitoring** from the Category dropdown
32
32
1. Enter *keyvault* in the **Search** field.
33
33
1. Select the **Enable logging by category group for Key vaults (microsoft.keyvault/vaults) to Log Analytics** policy,
34
-
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/policy-definitions.png" alt-text="A screenshot of the policy definitions page.":::
34
+
:::image type="content" source="./media/diagnostics-settings-policies-deployifnotexists/policy-definitions.png" lightbox="./media/diagnostics-settings-policies-deployifnotexists/policy-definitions.png" alt-text="A screenshot of the policy definitions page.":::
35
35
1. From the policy definition page, select **Assign**
36
36
1. Select the **Parameters** tab.
37
37
1. Select the Log Analytics Workspace that you want to send the audit logs to.
@@ -77,6 +77,12 @@ Find the role in the policy definition by searching for *roleDefinitionIds*
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
86
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).
81
87
82
88
```azurecli
@@ -131,6 +137,10 @@ To apply a policy using the PowerShell, use the following commands:
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.
> 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.
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.
@@ -359,13 +385,13 @@ The following table describes the common parameters for each set of policies.
359
385
360
386
### Event Hubs policy parameters
361
387
362
-
This policy deploys a diagnostic setting using a category group to route logs to an Event Hub.
388
+
This policy deploys a diagnostic setting using a category group to route logs to an event hub.
363
389
364
390
|Parameter| Description| Valid Values|Default|
365
391
|---|---|---|---|
366
392
|resourceLocation|Resource Location must be the same location as the event hub Namespace|Supported locations||
367
-
|eventHubAuthorizationRuleId|Event Hub Authorization Rule ID. The authorization rule is at event hub namespace level. For example, /subscriptions/{subscription ID}/resourceGroups/{resource group}/providers/Microsoft.EventHub/namespaces/{Event Hub namespace}/authorizationrules/{authorization rule}|||
368
-
|eventHubName|Event Hub Name||Monitoring|
393
+
|eventHubAuthorizationRuleId|Event hub Authorization Rule ID. The authorization rule is at event hub namespace level. For example, /subscriptions/{subscription ID}/resourceGroups/{resource group}/providers/Microsoft.EventHub/namespaces/{Event Hub namespace}/authorizationrules/{authorization rule}|||
0 commit comments