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/event-hubs/resource-governance-with-app-groups.md
+56-30Lines changed: 56 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ This article shows you how to perform the following tasks:
14
14
- Create an application group.
15
15
- Enable or disable an application group
16
16
- Define threshold limits and apply throttling policies to an application group
17
+
- Validate throttling with Diagnostic Logs
17
18
18
19
> [!NOTE]
19
20
> Application groups are available only in **premium** and **dedicated** tiers.
@@ -32,27 +33,35 @@ You can create an application group using the Azure portal by following these st
32
33
1. On the **Add application group** page, follow these steps:
33
34
1. Specify a **name** for the application group.
34
35
1. Confirm that **Enabled** is selected. To have the application group in the disabled state first, clear the **Enabled** option. This flag determines whether the clients of an application group can access Event Hubs or not.
35
-
1. For **Security context type**, select **Shared access policy** or **AAD application**. When you create the application group, you should associate with either a shared access signatures (SAS) or Azure Active Directory(Azure AD) application ID, which is used by client applications.
36
-
1. If you selected **Shared access policy**:
37
-
1. For **SAS key name**, select the SAS policy that can be used as a security context for this application group. Application group supports the selection of SAS key at either namespace or at entity (event hub) level. You can select **Add SAS Policy** to add a new policy and then associate with the application group.
38
-
1. Review the auto-generated **Client group ID**, which is the unique ID associated with the application group. You can update it if you like. The following table shows auto generated Client Group ID for different level keys:
36
+
1. For **Security context type**, select **Namespace Shared access policy**, **event hub Shared Access Policy** or **AAD application**.Application group supports the selection of SAS key at either namespace or at entity (event hub) level. When you create the application group, you should associate with either a shared access signatures (SAS) or Azure Active Directory(Azure AD) application ID, which is used by client applications.
37
+
1. If you selected **Namespace Shared access policy**:
38
+
1. For **SAS key name**, select the SAS policy that can be used as a security context for this application group.You can select **Add SAS Policy** to add a new policy and then associate with the application group.
39
+
40
+
:::image type="content" source="./media/resource-governance-with-app-groups/create-application-groups-with-namespace-shared-access-key.png" alt-text="Screenshot of the Add application group page with Namespace Shared access policy option selected.":::
41
+
1. If you selected **Event Hubs Shared access policy**:
42
+
1. For **SAS key name**, copy the SAS policy name from Event Hubs "Shared Access Policies" Page and paste into textbox
> All existing application groups created with namespace level key would continue to work with client group ID starting with `SASKeyName`. However all new application groups would have updated client group ID as shown above.
47
-
48
-
49
-
:::image type="content" source="./media/resource-governance-with-app-groups/add-app-group.png" alt-text="Screenshot of the Add application group page with Shared access policy option selected.":::
44
+
:::image type="content" source="./media/resource-governance-with-app-groups/create-application-groups-with-event-hub-shared-access-key.png" alt-text="Screenshot of the Add application group page with event hub Shared access policy option selected.":::
45
+
50
46
1. If you selected **AAD application**:
51
47
1. For **AAD Application (client) ID**, specify the Azure Active Directory (Azure AD) application or client ID.
52
-
1. Review the auto-generated **Client group ID**, which is the unique ID associated with the application group. You can update it if you like. The scope of application governance (namespace or entity level) would depend on the access level for the used Azure AD application ID.
48
+
49
+
:::image type="content" source="./media/resource-governance-with-app-groups/add-app-group-active-directory.png" alt-text="Screenshot of the Add application group page with Azure AD option.":::
Review the auto-generated **Client group ID**, which is the unique ID associated with the application group. The scope of application governance (namespace or entity level) would depend on the access level for the used Azure AD application ID. The following table shows auto generated Client Group ID for different security Context type:
53
+
54
+
| Security Context type | Auto-generated client group ID|
> All existing application groups created with namespace shared access key would continue to work with client group ID starting with `SASKeyName`. However all new application groups would have updated client group ID as shown above.
53
62
54
-
:::image type="content" source="./media/resource-governance-with-app-groups/add-app-group-active-directory.png" alt-text="Screenshot of the Add application group page with Azure AD option.":::
55
-
1. To add a policy, follow these steps:
63
+
64
+
1. To add a policy, follow these steps:
56
65
1. Enter a **name** for the policy.
57
66
1. For **Type**, select **Throttling policy**.
58
67
1. For **Metric ID**, select one of the following options: **Incoming messages**, **Outgoing messages**, **Incoming bytes**, **Outgoing bytes**. In the following example, **Incoming messages** is selected.
@@ -72,28 +81,30 @@ You can create an application group using the Azure portal by following these st
72
81
73
82
74
83
### [Azure CLI](#tab/cli)
75
-
Use the CLI command: [`az eventhubs namespace application-group create`](/cli/azure/eventhubs/namespace/application-group#az-eventhubs-namespace-application-group-create) to create an application group in an Event Hubs namespace.
84
+
Use the CLI command: [`az eventhubs namespace application-group create`](/cli/azure/eventhubs/namespace/application-group#az-eventhubs-namespace-application-group-create) to create an application group at Event Hubs namespace or event hub level. You must set --client-app-group-identifier based on the security
85
+
context type you are choosing. Please review the [table](#supported-security-context-type) above to know supported Security context type
76
86
77
87
The following example creates an application group named `myAppGroup` in the namespace `mynamespace` in the Azure resource group `MyResourceGroup`. It uses the following configurations.
78
88
79
89
- Shared access policy is used as the security context
80
-
- Client app group ID is set to `SASKeyName=<NameOfTheSASkey>`.
90
+
- Client app group ID is set to `NamespaceSASKeyName=<NameOfTheSASkey>`.
81
91
- First throttling policy for the `Incoming messages` metric with `10000` as the threshold.
82
92
- Second throttling policy for the `Incoming bytes` metric with `20000` as the threshold.
83
93
84
94
```azurecli-interactive
85
95
az eventhubs namespace application-group create --namespace-name mynamespace \
To learn more about the CLI command, see [`az eventhubs namespace application-group create`](/cli/azure/eventhubs/namespace/application-group#az-eventhubs-namespace-application-group-create).
94
104
95
105
### [Azure PowerShell](#tab/powershell)
96
-
Use the PowerShell command: [`New-AzEventHubApplicationGroup`](/powershell/module/az.eventhub/new-azeventhubapplicationgroup) to create an application group in an Event Hubs namespace.
106
+
Use the PowerShell command: [`New-AzEventHubApplicationGroup`](/powershell/module/az.eventhub/new-azeventhubapplicationgroup) to create an application group at Event Hubs namespace or event hub level. You must set -ClientAppGroupIdentifier based on the security
107
+
context type you are choosing. Please review the [table](#supported-security-context-type) above to know supported Security context type
97
108
98
109
The following example uses the [`New-AzEventHubThrottlingPolicyConfig`](/powershell/module/az.eventhub/new-azeventhubthrottlingpolicyconfig) to create two policies that will be associated with the application.
To learn more about the PowerShell command, see [`New-AzEventHubApplicationGroup`](/powershell/module/az.eventhub/new-azeventhubapplicationgroup).
115
126
116
127
### [ARM template](#tab/arm)
117
-
The following example shows how to create an application group using an ARM template. In this example, the application group is associated with an existing SAS policy name `contososaspolicy` by setting the client `AppGroupIdentifier` as `SASKeyName=contososaspolicy`. The application group policies are also defined in the ARM template.
128
+
The following example shows how to create an application group using an ARM template. In this example, the application group is associated with an existing SAS policy name `contososaspolicy` by setting the client `AppGroupIdentifier` as `NamespaceSASKeyName=contososaspolicy`. The application group policies are also defined in the ARM template. You must set ClientAppGroupIdentifier based on the security context type you are choosing. Please review the [table](#supported-security-context-type) above to know supported Security context type
118
129
119
130
120
131
```json
@@ -127,7 +138,7 @@ The following example shows how to create an application group using an ARM temp
The following ARM template shows how to update an existing namespace (`contosonamespace`) to add throttling policies. The identifier for the app group is `SASKeyName=RootManageSharedAccessKey`.
283
+
The following ARM template shows how to update an existing namespace (`contosonamespace`) to add throttling policies. The identifier for the app group is `NamespaceSASKeyName=RootManageSharedAccessKey`.
273
284
274
285
```json
275
286
{
@@ -281,7 +292,7 @@ The following ARM template shows how to update an existing namespace (`contosona
@@ -317,12 +328,12 @@ The following ARM template shows how to update an existing namespace (`contosona
317
328
318
329
### Decide threshold value for throttling policies
319
330
320
-
Azure Event Hubs supports [runtime audit logs](monitor-event-hubs-reference.md#runtime-audit-logs) functionality to help you decide on a threshold value for your usual throughput to throttle the application group. You can follow these steps to find out threshold value to explore a good threshold value:
331
+
Azure Event Hubs supports [Application Metric Logs ](monitor-event-hubs-reference.md#application-metrics-logs) functionality to observe usual throughput within your system and accordingly decide on the threshold value for application group. You can follow these steps to decide on a threshold value:
321
332
322
-
1. Turn on [diagnostic settings](monitor-event-hubs.md#collection-and-routing) in Event Hubs with **runtime audit logs** as selected category and choose **Log Analytics** as destination.
333
+
1. Turn on [diagnostic settings](monitor-event-hubs.md#collection-and-routing) in Event Hubs with **Application Metric logs** as selected category and choose **Log Analytics** as destination.
323
334
2. Create an empty application group without any throttling policy.
324
335
3. Continue sending messages/events to event hub at usual throughput.
325
-
4. Go to **Log Analytics workspace** and query for the right activity name (based on the metric ID) in **AzureDiagnostics** table. The following sample query is set to track threshold value for incoming messages:
336
+
4. Go to **Log Analytics workspace** and query for the right activity name (based on the (resource-governance-overview.md#throttling-policy---threshold-limits)) in **AzureDiagnostics** table. The following sample query is set to track threshold value for incoming messages:
:::image type="content" source="./media/resource-governance-with-app-groups/azure-monitor-logs.png" lightbox="./media/resource-governance-with-app-groups/azure-monitor-logs.png" alt-text="Screenshot of the Azure Monitor logs page in the Azure portal.":::
335
346
336
347
In this example, you can see that the usual throughput never crossed more than 550 messages (expected current throughput). This observation helps you define the actual threshold value.
337
-
6. Once you decide the best threshold value, add a new throttling policy inside the application group.
348
+
6. Once you decide the threshold value, add a new throttling policy inside the application group.
338
349
339
350
## Publish or consume events
340
351
Once you successfully add throttling policies to the application group, you can test the throttling behavior by either publishing or consuming events using client applications that are part of the `contosoAppGroup` application group. To test, you can use either an [AMQP client](event-hubs-dotnet-standard-getstarted-send.md) or a [Kafka client](event-hubs-quickstart-kafka-enabled-event-hubs.md) application and same SAS policy name or Azure AD application ID that's used to create the application group.
341
352
342
353
> [!NOTE]
343
354
> When your client applications are throttled, you should experience a slowness in publishing or consuming data.
344
355
356
+
### Validate Throttling with Application Groups
357
+
358
+
Similar to [Deciding Threshold limits for Throttling Policies](resource-governance-with-app-groups.md#decide-threshold-value-for-throttling-policies), you can use Application Metric logs to validate throttling and find more details.
345
359
360
+
You can use the below example query to find out all the throttled requests in certain timeframe. You must update the ActivityName to match the operation that you expect to be throttled.
361
+
362
+
363
+
```kusto
364
+
365
+
AzureDiagnostics
366
+
| where Category =="ApplicationMetricsLogs"
367
+
| where ActivityName_s =="IncomingMessages"
368
+
| where Outcome_s =="Throttled"
369
+
370
+
```
371
+
Due to restrictions at protocol level, throttled request logs are not generated for consumer operations within event hub ( `OutgoingMessages` or `OutgoingBytes`). when requests are throttled at consumer side, you would observe sluggish egress throughput.
0 commit comments