Skip to content

Commit fd8192b

Browse files
authored
Merge pull request #220544 from Saglodha/patch-4
Updating entity level app group creation
2 parents 83612e2 + 8ebb780 commit fd8192b

File tree

3 files changed

+56
-30
lines changed

3 files changed

+56
-30
lines changed
Loading
Loading

articles/event-hubs/resource-governance-with-app-groups.md

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This article shows you how to perform the following tasks:
1414
- Create an application group.
1515
- Enable or disable an application group
1616
- Define threshold limits and apply throttling policies to an application group
17+
- Validate throttling with Diagnostic Logs
1718

1819
> [!NOTE]
1920
> 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
3233
1. On the **Add application group** page, follow these steps:
3334
1. Specify a **name** for the application group.
3435
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
3943

40-
| Key type | Auto-generated client group ID |
41-
| -------- | ------------------------------ |
42-
| Namespace-level key | `NamespaceSASKeyName=RootManageSharedAccessKey` |
43-
| Entity-level Key | `EntitySASKeyName=RootManageSharedAccessKey` |
44-
45-
> [!NOTE]
46-
> 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+
5046
1. If you selected **AAD application**:
5147
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.":::
50+
51+
### [Supported Security Context type](#supported-security-context-type)
52+
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|
55+
| ---| --- |
56+
| Namespace shared access key | `NamespaceSASKeyName=<NamespaceLevelKeyName>` |
57+
| Azure AD Application | `AADAppID=<AppID>` |
58+
| Event Hubs shared access key | `EntitySASKeyName=<EntityLevelKeyName>` |
59+
60+
> [!NOTE]
61+
> 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.
5362
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:
5665
1. Enter a **name** for the policy.
5766
1. For **Type**, select **Throttling policy**.
5867
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
7281

7382

7483
### [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
7686

7787
The following example creates an application group named `myAppGroup` in the namespace `mynamespace` in the Azure resource group `MyResourceGroup`. It uses the following configurations.
7888

7989
- 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>`.
8191
- First throttling policy for the `Incoming messages` metric with `10000` as the threshold.
8292
- Second throttling policy for the `Incoming bytes` metric with `20000` as the threshold.
8393

8494
```azurecli-interactive
8595
az eventhubs namespace application-group create --namespace-name mynamespace \
8696
-g MyResourceGroup \
8797
--name myAppGroup \
88-
--client-app-group-identifier SASKeyName=keyname \
98+
--client-app-group-identifier NamespaceSASKeyName=keyname \
8999
--throttling-policy-config name=policy1 metric-id=IncomingMessages rate-limit-threshold=10000 \
90100
--throttling-policy-config name=policy2 metric-id=IncomingBytes rate-limit-threshold=20000
91101
```
92102

93103
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).
94104

95105
### [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
97108

98109
The following example uses the [`New-AzEventHubThrottlingPolicyConfig`](/powershell/module/az.eventhub/new-azeventhubthrottlingpolicyconfig) to create two policies that will be associated with the application.
99110

@@ -108,13 +119,13 @@ $policy1 = New-AzEventHubThrottlingPolicyConfig -Name policy1 -MetricId Incoming
108119
$policy2 = New-AzEventHubThrottlingPolicyConfig -Name policy2 -MetricId IncomingMessages -RateLimitThreshold 23416
109120
110121
New-AzEventHubApplicationGroup -ResourceGroupName myresourcegroup -NamespaceName mynamespace -Name myappgroup
111-
-ClientAppGroupIdentifier SASKeyName=myauthkey -ThrottlingPolicyConfig $policy1, $policy2
122+
-ClientAppGroupIdentifier NamespaceSASKeyName=myauthkey -ThrottlingPolicyConfig $policy1, $policy2
112123
```
113124

114125
To learn more about the PowerShell command, see [`New-AzEventHubApplicationGroup`](/powershell/module/az.eventhub/new-azeventhubapplicationgroup).
115126

116127
### [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
118129

119130

120131
```json
@@ -127,7 +138,7 @@ The following example shows how to create an application group using an ARM temp
127138
"[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('eventHubNamespaceName'),parameters('namespaceAuthorizationRuleName'))]"
128139
],
129140
"properties": {
130-
"ClientAppGroupIdentifier": "SASKeyName=contososaspolicy",
141+
"ClientAppGroupIdentifier": "NamespaceSASKeyName=contososaspolicy",
131142
"policies": [{
132143
"Type": "ThrottlingPolicy",
133144
"Name": "ThrottlingPolicy1",
@@ -269,7 +280,7 @@ Set-AzEventHubApplicationGroup -ResourceGroupName myresourcegroup -NamespaceName
269280
```
270281

271282
### [ARM template](#tab/arm)
272-
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`.
273284

274285
```json
275286
{
@@ -281,7 +292,7 @@ The following ARM template shows how to update an existing namespace (`contosona
281292
"type": "String"
282293
},
283294
"client-app-group-identifier": {
284-
"defaultValue": "SASKeyName=RootManageSharedAccessKey",
295+
"defaultValue": "NamespaceSASKeyName=RootManageSharedAccessKey",
285296
"type": "String"
286297
}
287298
},
@@ -317,12 +328,12 @@ The following ARM template shows how to update an existing namespace (`contosona
317328

318329
### Decide threshold value for throttling policies
319330

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:
321332

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.
323334
2. Create an empty application group without any throttling policy.
324335
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:
326337

327338
```kusto
328339
AzureDiagnostics
@@ -334,15 +345,30 @@ Azure Event Hubs supports [runtime audit logs](monitor-event-hubs-reference.md#r
334345
:::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.":::
335346
336347
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.
338349
339350
## Publish or consume events
340351
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.
341352
342353
> [!NOTE]
343354
> When your client applications are throttled, you should experience a slowness in publishing or consuming data.
344355
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.
345359
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.
346372

347373
## Next steps
348374

0 commit comments

Comments
 (0)