Skip to content

Commit c594d9c

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into grp
2 parents 41140e8 + 34342f6 commit c594d9c

24 files changed

+653
-319
lines changed

articles/api-management/api-management-howto-app-insights.md

Lines changed: 62 additions & 49 deletions
Large diffs are not rendered by default.

articles/api-management/api-management-howto-log-event-hubs.md

Lines changed: 83 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: dlepow
66

77
ms.service: azure-api-management
88
ms.topic: how-to
9-
ms.date: 07/12/2024
9+
ms.date: 09/04/2024
1010
ms.author: danlep
1111

1212
---
@@ -31,64 +31,77 @@ Azure Event Hubs is a highly scalable data ingress service that can ingest milli
3131

3232
To log events to the event hub, you need to configure credentials for access from API Management. API Management supports either of the two following access mechanisms:
3333

34+
* A managed identity for your API Management instance (recommended)
3435
* An Event Hubs connection string
35-
* A managed identity for your API Management instance.
3636

37-
### Option 1: Configure Event Hubs connection string
38-
39-
To create an Event Hubs connection string, see [Get an Event Hubs connection string](../event-hubs/event-hubs-get-connection-string.md).
40-
41-
* You can use a connection string for the Event Hubs namespace or for the specific event hub you use for logging from API Management.
42-
* The shared access policy for the connection string must enable at least **Send** permissions.
37+
> [!NOTE]
38+
> Where possible, Microsoft recommends using managed identity credentials for enhanced security.
4339
44-
### Option 2: Configure API Management managed identity
4540

46-
> [!NOTE]
47-
> Using an API Management managed identity for logging events to an event hub is supported in API Management REST API version `2022-04-01-preview` or later.
41+
### Option 1: Configure API Management managed identity
4842

4943
1. Enable a system-assigned or user-assigned [managed identity for API Management](api-management-howto-use-managed-service-identity.md) in your API Management instance.
5044

5145
* If you enable a user-assigned managed identity, take note of the identity's **Client ID**.
5246

5347
1. Assign the identity the **Azure Event Hubs Data sender** role, scoped to the Event Hubs namespace or to the event hub used for logging. To assign the role, use the [Azure portal](../role-based-access-control/role-assignments-portal.yml) or other Azure tools.
5448

49+
50+
### Option 2: Configure Event Hubs connection string
51+
52+
To create an Event Hubs connection string, see [Get an Event Hubs connection string](../event-hubs/event-hubs-get-connection-string.md).
53+
54+
* You can use a connection string for the Event Hubs namespace or for the specific event hub you use for logging from API Management.
55+
* The shared access policy for the connection string must enable at least **Send** permissions.
56+
57+
5558
## Create an API Management logger
5659
The next step is to configure a [logger](/rest/api/apimanagement/current-ga/logger) in your API Management service so that it can log events to the event hub.
5760

5861
Create and manage API Management loggers by using the [API Management REST API](/rest/api/apimanagement/current-preview/logger/create-or-update) directly or by using tools including [Azure PowerShell](/powershell/module/az.apimanagement/new-azapimanagementlogger), a Bicep template, or an Azure Resource Management template.
5962

60-
### Logger with connection string credentials
63+
### Option 1: Logger with managed identity credentials (recommended)
6164

62-
For prerequisites, see [Configure Event Hubs connection string](#option-1-configure-event-hubs-connection-string).
65+
You can configure an API Management logger to an event hub using either system-assigned or user-assigned managed identity credentials.
6366

64-
#### [PowerShell](#tab/PowerShell)
67+
### Logger with system-assigned managed identity credentials
6568

66-
The following example uses the [New-AzApiManagementLogger](/powershell/module/az.apimanagement/new-azapimanagementlogger) cmdlet to create a logger to an event hub by configuring a connection string.
69+
For prerequisites, see [Configure API Management managed identity](#option-1-configure-api-management-managed-identity).
6770

68-
```powershell
69-
# API Management service-specific details
70-
$apimServiceName = "apim-hello-world"
71-
$resourceGroupName = "myResourceGroup"
71+
#### [REST API](#tab/PowerShell)
72+
73+
Use the API Management [Logger - Create or Update](/rest/api/apimanagement/current-preview/logger/create-or-update) REST API with the following request body.
74+
75+
```JSON
76+
{
77+
"properties": {
78+
"loggerType": "azureEventHub",
79+
"description": "Event Hub logger with system-assigned managed identity",
80+
"credentials": {
81+
"endpointAddress":"<EventHubsNamespace>.servicebus.windows.net",
82+
"identityClientId":"SystemAssigned",
83+
"name":"<EventHubName>"
84+
}
85+
}
86+
}
7287

73-
# Create logger
74-
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $apimServiceName
75-
New-AzApiManagementLogger -Context $context -LoggerId "ContosoLogger1" -Name "ApimEventHub" -ConnectionString "Endpoint=sb://<EventHubsNamespace>.servicebus.windows.net/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>" -Description "Event hub logger with connection string"
7688
```
7789

7890
#### [Bicep](#tab/bicep)
7991

8092
Include a snippet similar to the following in your Bicep template.
8193

8294
```Bicep
83-
resource ehLoggerWithConnectionString 'Microsoft.ApiManagement/service/loggers@2022-04-01-preview' = {
95+
resource ehLoggerWithSystemAssignedIdentity 'Microsoft.ApiManagement/service/loggers@2022-08-01' = {
8496
name: 'ContosoLogger1'
8597
parent: '<APIManagementInstanceName>'
8698
properties: {
8799
loggerType: 'azureEventHub'
88-
description: 'Event hub logger with connection string'
100+
description: 'Event hub logger with system-assigned managed identity'
89101
credentials: {
90-
connectionString: 'Endpoint=sb://<EventHubsNamespace>.servicebus.windows.net/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>'
91-
name: 'ApimEventHub'
102+
endpointAddress: '<EventHubsNamespace>.servicebus.windows.net'
103+
identityClientId: 'systemAssigned'
104+
name: '<EventHubName>'
92105
}
93106
}
94107
}
@@ -101,37 +114,38 @@ Include a JSON snippet similar to the following in your Azure Resource Manager t
101114
```JSON
102115
{
103116
"type": "Microsoft.ApiManagement/service/loggers",
104-
"apiVersion": "2022-04-01-preview",
117+
"apiVersion": "2022-08-01",
105118
"name": "ContosoLogger1",
106119
"properties": {
107120
"loggerType": "azureEventHub",
108-
"description": "Event hub logger with connection string",
109-
"resourceId": "<EventHubsResourceID>"
121+
"description": "Event Hub logger with system-assigned managed identity",
122+
"resourceId": "<EventHubsResourceID>",
110123
"credentials": {
111-
"connectionString": "Endpoint=sb://<EventHubsNamespace>/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>",
112-
"name": "ApimEventHub"
124+
"endpointAddress": "<EventHubsNamespace>.servicebus.windows.net",
125+
"identityClientId": "SystemAssigned",
126+
"name": "<EventHubName>"
113127
},
114128
}
115129
}
116130
```
117131
---
132+
#### Logger with user-assigned managed identity credentials
118133

119-
### Logger with system-assigned managed identity credentials
120-
121-
For prerequisites, see [Configure API Management managed identity](#option-2-configure-api-management-managed-identity).
134+
For prerequisites, see [Configure API Management managed identity](#option-1-configure-api-management-managed-identity).
122135

123136
#### [REST API](#tab/PowerShell)
124137

125-
Use the API Management [REST API](/rest/api/apimanagement/current-preview/logger/create-or-update) or a Bicep or ARM template to configure a logger to an event hub with system-assigned managed identity credentials.
138+
Use the API Management [Logger - Create or Update](/rest/api/apimanagement/current-preview/logger/create-or-update) REST API with the following request body.
139+
126140

127141
```JSON
128142
{
129143
"properties": {
130144
"loggerType": "azureEventHub",
131-
"description": "adding a new logger with system assigned managed identity",
145+
"description": "Event Hub logger with user-assigned managed identity",
132146
"credentials": {
133147
"endpointAddress":"<EventHubsNamespace>.servicebus.windows.net",
134-
"identityClientId":"SystemAssigned",
148+
"identityClientId":"<ClientID>",
135149
"name":"<EventHubName>"
136150
}
137151
}
@@ -144,15 +158,15 @@ Use the API Management [REST API](/rest/api/apimanagement/current-preview/logger
144158
Include a snippet similar to the following in your Bicep template.
145159

146160
```Bicep
147-
resource ehLoggerWithSystemAssignedIdentity 'Microsoft.ApiManagement/service/loggers@2022-04-01-preview' = {
161+
resource ehLoggerWithUserAssignedIdentity 'Microsoft.ApiManagement/service/loggers@2022-08-01' = {
148162
name: 'ContosoLogger1'
149163
parent: '<APIManagementInstanceName>'
150164
properties: {
151165
loggerType: 'azureEventHub'
152-
description: 'Event hub logger with system-assigned managed identity'
166+
description: 'Event Hub logger with user-assigned managed identity'
153167
credentials: {
154168
endpointAddress: '<EventHubsNamespace>.servicebus.windows.net'
155-
identityClientId: 'systemAssigned'
169+
identityClientId: '<ClientID>'
156170
name: '<EventHubName>'
157171
}
158172
}
@@ -166,59 +180,58 @@ Include a JSON snippet similar to the following in your Azure Resource Manager t
166180
```JSON
167181
{
168182
"type": "Microsoft.ApiManagement/service/loggers",
169-
"apiVersion": "2022-04-01-preview",
183+
"apiVersion": "2022-08-01",
170184
"name": "ContosoLogger1",
171185
"properties": {
172186
"loggerType": "azureEventHub",
173-
"description": "Event hub logger with system-assigned managed identity",
187+
"description": "Event Hub logger with user-assigned managed identity",
174188
"resourceId": "<EventHubsResourceID>",
175189
"credentials": {
176190
"endpointAddress": "<EventHubsNamespace>.servicebus.windows.net",
177-
"identityClientId": "SystemAssigned",
191+
"identityClientId": "<ClientID>",
178192
"name": "<EventHubName>"
179193
},
180194
}
181195
}
182196
```
183197
---
184-
### Logger with user-assigned managed identity credentials
185198

186-
For prerequisites, see [Configure API Management managed identity](#option-2-configure-api-management-managed-identity).
187199

188-
#### [REST API](#tab/PowerShell)
200+
### Option 2. Logger with connection string credentials
189201

190-
Use the API Management [REST API](/rest/api/apimanagement/current-preview/logger/create-or-update) or a Bicep or ARM template to configure a logger to an event hub with user-assigned managed identity credentials.
202+
For prerequisites, see [Configure Event Hubs connection string](#option-2-configure-event-hubs-connection-string).
191203

192-
```JSON
193-
{
194-
"properties": {
195-
"loggerType": "azureEventHub",
196-
"description": "adding a new logger with user-assigned managed identity",
197-
"credentials": {
198-
"endpointAddress":"<EventHubsNamespace>.servicebus.windows.net",
199-
"identityClientId":"<ClientID>",
200-
"name":"<EventHubName>"
201-
}
202-
}
203-
}
204+
> [!NOTE]
205+
> Where possible, Microsoft recommends configuring the logger with managed identity credentials. See [Configure logger with managed identity credentials](#option-1-logger-with-managed-identity-credentials-recommended), earlier in this article.
204206
207+
#### [PowerShell](#tab/PowerShell)
208+
209+
The following example uses the [New-AzApiManagementLogger](/powershell/module/az.apimanagement/new-azapimanagementlogger) cmdlet to create a logger to an event hub by configuring a connection string.
210+
211+
```powershell
212+
# API Management service-specific details
213+
$apimServiceName = "apim-hello-world"
214+
$resourceGroupName = "myResourceGroup"
215+
216+
# Create logger
217+
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $apimServiceName
218+
New-AzApiManagementLogger -Context $context -LoggerId "ContosoLogger1" -Name "ApimEventHub" -ConnectionString "Endpoint=sb://<EventHubsNamespace>.servicebus.windows.net/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>" -Description "Event hub logger with connection string"
205219
```
206220

207221
#### [Bicep](#tab/bicep)
208222

209-
Include a snippet similar the following in your Bicep template.
223+
Include a snippet similar to the following in your Bicep template.
210224

211225
```Bicep
212-
resource ehLoggerWithUserAssignedIdentity 'Microsoft.ApiManagement/service/loggers@2022-04-01-preview' = {
226+
resource ehLoggerWithConnectionString 'Microsoft.ApiManagement/service/loggers@2022-08-01' = {
213227
name: 'ContosoLogger1'
214228
parent: '<APIManagementInstanceName>'
215229
properties: {
216230
loggerType: 'azureEventHub'
217-
description: 'Event hub logger with user-assigned managed identity'
231+
description: 'Event Hub logger with connection string credentials'
218232
credentials: {
219-
endpointAddress: '<EventHubsNamespace>.servicebus.windows.net'
220-
identityClientId: '<ClientID>'
221-
name: '<EventHubName>'
233+
connectionString: 'Endpoint=sb://<EventHubsNamespace>.servicebus.windows.net/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>'
234+
name: 'ApimEventHub'
222235
}
223236
}
224237
}
@@ -231,16 +244,15 @@ Include a JSON snippet similar to the following in your Azure Resource Manager t
231244
```JSON
232245
{
233246
"type": "Microsoft.ApiManagement/service/loggers",
234-
"apiVersion": "2022-04-01-preview",
247+
"apiVersion": "2022-08-01",
235248
"name": "ContosoLogger1",
236249
"properties": {
237250
"loggerType": "azureEventHub",
238-
"description": "Event hub logger with user-assigned managed identity",
239-
"resourceId": "<EventHubsResourceID>",
251+
"description": "Event Hub logger with connection string credentials",
252+
"resourceId": "<EventHubsResourceID>"
240253
"credentials": {
241-
"endpointAddress": "<EventHubsNamespace>.servicebus.windows.net",
242-
"identityClientId": "<ClientID>",
243-
"name": "<EventHubName>"
254+
"connectionString": "Endpoint=sb://<EventHubsNamespace>/;SharedAccessKeyName=<KeyName>;SharedAccessKey=<key>",
255+
"name": "ApimEventHub"
244256
},
245257
}
246258
}

articles/azure-arc/servers/prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Azure Arc supports the following Windows and Linux operating systems. Only x86-6
4040

4141
* AlmaLinux 9
4242
* Amazon Linux 2 and 2023
43-
* Azure Linux (CBL-Mariner) 2.0
43+
* Azure Linux (CBL-Mariner) 2.0 and 3.0
4444
* Azure Stack HCI
4545
* Debian 11, and 12
4646
* Oracle Linux 7, 8, and 9

0 commit comments

Comments
 (0)