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
@@ -20,7 +20,7 @@ You can easily integrate Azure Application Insights with Azure API Management. A
20
20
* Learn strategies for reducing performance impact on your API Management service instance.
21
21
22
22
> [!NOTE]
23
-
> In an API Management [workspace](workspaces-overview.md), a workspace owner can independently integrate Application Insights and enable Application Insights logging for the workspace's APIs. The general guidance to integrate a workspace with Application Insights is similar to the guidance for an API Management instance; however, configuration is scoped to the workspace only. Currently, you must integrate Application Insights in a workspace by configuring an instrumentation key or connection string.
23
+
> In an API Management [workspace](workspaces-overview.md), a workspace owner can independently integrate Application Insights and enable Application Insights logging for the workspace's APIs. The general guidance to integrate a workspace with Application Insights is similar to the guidance for an API Management instance; however, configuration is scoped to the workspace only. Currently, you must integrate Application Insights in a workspace by configuring a connection string (recommended) or an instrumentation key.
24
24
25
25
> [!WARNING]
26
26
> When using our [self-hosted gateway](self-hosted-gateway-overview.md), we do not guarantee all telemetry will be pushed to Azure Application Insights given it relies on [Application Insights' in-memory buffering](./../azure-monitor/app/telemetry-channels.md#built-in-telemetry-channels).
@@ -34,9 +34,9 @@ You can easily integrate Azure Application Insights with Azure API Management. A
34
34
> [!NOTE]
35
35
> The Application Insights resource **can be** in a different subscription or even a different tenant than the API Management resource.
36
36
37
-
* If you plan to configure a managed identity for API Management to use with Application Insights, you need to complete the following steps:
37
+
* If you plan to configure managed identity credentials to use with Application Insights, complete the following steps:
38
38
39
-
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.
39
+
1. Enable a system-assigned or user-assigned [managed identity for API Management](api-management-howto-use-managed-service-identity.md).
40
40
41
41
* If you enable a user-assigned managed identity, take note of the identity's **Client ID**.
42
42
@@ -46,18 +46,18 @@ You can easily integrate Azure Application Insights with Azure API Management. A
46
46
47
47
The following are high level steps for this scenario.
48
48
49
-
1. First, you create a connection between Application Insights and API Management
49
+
1. First, create a connection between Application Insights and API Management
50
50
51
51
You can create a connection between Application Insights and your API Management using the Azure portal, the REST API, or related Azure tools. API Management configures a *logger* resource for the connection.
52
52
53
-
> [!NOTE]
54
-
> If your Application Insights resource is in a different tenant, then you must create the logger using the [REST API](#create-a-connection-using-the-rest-api-bicep-or-arm-template) as shown in a later section of this article.
55
-
56
53
> [!IMPORTANT]
57
-
> Currently, in the portal, API Management only supports connections to Application Insights using an Application Insights instrumentation key. To use an Application Insights connection string or an API Management managed identity, use the REST API, Bicep, or ARM template to create the logger. [Learn more](../azure-monitor/app/sdk-connection-string.md) about Application Insights connection strings.
54
+
> Currently, in the portal, API Management only supports connections to Application Insights using an Application Insights instrumentation key. For enhanced security, we recommend using an Application Insights connection string with an API Management managed identity. To configure connection string with managed identity credentials, use the [REST API](#create-a-connection-using-the-rest-api-bicep-or-arm-template)or related tools as shown in a later section of this article. [Learn more](../azure-monitor/app/sdk-connection-string.md) about Application Insights connection strings.
58
55
>
59
56
60
-
1. Second, you enable Application Insights logging for your API or APIs.
57
+
> [!NOTE]
58
+
> If your Application Insights resource is in a different tenant, then you must create the logger using the [REST API](#create-a-connection-using-the-rest-api-bicep-or-arm-template) or related tools as shown in a later section of this article.
59
+
60
+
1. Second, enable Application Insights logging for your API or APIs.
61
61
62
62
In this article, you enable Application Insights logging for your API using the Azure portal. API Management configures a *diagnostic* resource for the API.
63
63
@@ -66,6 +66,10 @@ The following are high level steps for this scenario.
66
66
67
67
Follow these steps to use the Azure portal to create a connection between Application Insights and API Management.
68
68
69
+
> [!NOTE]
70
+
> Where possible, Microsoft recommends using connection string with managed identity credentials for enhanced security. To configure these credentials, use the [REST API](#create-a-connection-using-the-rest-api-bicep-or-arm-template) or related tools as shown in a later section of this article.
71
+
72
+
69
73
1. Navigate to your **Azure API Management service instance** in the **Azure portal**.
70
74
1. Select **Application Insights** from the menu on the left.
71
75
1. Select **+ Add**.
@@ -87,28 +91,32 @@ Follow these steps to use the Azure portal to create a connection between Applic
87
91
88
92
## Create a connection using the REST API, Bicep, or ARM template
89
93
90
-
Follow these steps to use the REST API, Bicep, or ARM template to create a connection between Application Insights and API Management. You can configure a logger that uses a connection string, system-assigned managed identity, or user-assigned managed identity.
94
+
Follow these steps to use the REST API, Bicep, or ARM template to create an Application Insights logger for your API Management instance. You can configure a logger that uses connection string with managed identity credentials (recommended), or a logger that uses only a connection string.
91
95
92
-
### Logger with connection string credentials
96
+
### Logger with connection string with managed identity credentials (recommended)
97
+
98
+
See the [prerequisites](#prerequisites) for using an API Management managed identity.
93
99
94
100
The Application Insights connection string appears in the **Overview** section of your Application Insights resource.
95
101
102
+
#### Connection string with system-assigned managed identity
103
+
96
104
#### [REST API](#tab/rest)
97
105
98
106
Use the API Management [Logger - Create or Update](/rest/api/apimanagement/current-preview/logger/create-or-update) REST API with the following request body.
99
107
100
-
If you are configuring the logger for a workspace, use the [Workspace Logger - Create or Update](/rest/api/apimanagement/workspace-logger/create-or-update?view=rest-apimanagement-2023-09-01-preview&preserve-view=true) REST API.
101
-
102
108
```JSON
103
109
{
104
110
"properties": {
105
111
"loggerType": "applicationInsights",
106
-
"description": "adding a new logger with connection string",
112
+
"description": "Application Insights logger with system-assigned managed identity",
### Logger with user-assigned managed identity credentials
216
222
217
-
See the [prerequisites](#prerequisites) for using an API Management managed identity.
223
+
### Logger with connection string credentials only
224
+
225
+
The Application Insights connection string appears in the **Overview** section of your Application Insights resource.
218
226
219
227
#### [REST API](#tab/rest)
220
228
221
229
Use the API Management [Logger - Create or Update](/rest/api/apimanagement/current-preview/logger/create-or-update) REST API with the following request body.
222
230
231
+
If you are configuring the logger for a workspace, use the [Workspace Logger - Create or Update](/rest/api/apimanagement/workspace-logger/create-or-update?view=rest-apimanagement-2023-09-01-preview&preserve-view=true) REST API.
232
+
223
233
```JSON
224
234
{
225
235
"properties": {
226
236
"loggerType": "applicationInsights",
227
-
"description": "adding a new logger with user-assigned managed identity",
237
+
"description": "Application Insights logger with connection string",
Include a JSON snippet similar to the following in your Azure Resource Manager template.
259
269
270
+
If you are configuring the logger for a workspace, create a `Microsoft.ApiManagement/service.workspace/loggers` resource and set `apiVersion` to `2023-09-01-preview` instead.
> See [Application Insights limits](../azure-monitor/service-limits.md#application-insights) for information about the maximum size and number of metrics and events per Application Insights instance.
329
342
330
343
## Emit custom metrics
331
-
You can emit [custom metrics](../azure-monitor/essentials/metrics-custom-overview.md) to Application Insights from your API Management instance. API Management emits custom metrics using the [emit-metric](emit-metric-policy.md) policy.
344
+
You can emit [custom metrics](../azure-monitor/essentials/metrics-custom-overview.md) to Application Insights from your API Management instance. API Management emits custom metrics using policies such as [emit-metric](emit-metric-policy.md)and [azure-openai-emit-token-metric](azure-openai-emit-token-metric-policy.md). The following section uses the `emit-metric` policy as an example.
332
345
333
346
> [!NOTE]
334
347
> Custom metrics are a [preview feature](../azure-monitor/essentials/metrics-custom-overview.md) of Azure Monitor and subject to [limitations](../azure-monitor/essentials/metrics-custom-overview.md#design-limitations-and-considerations).
@@ -362,7 +375,7 @@ To emit custom metrics, perform the following configuration steps.
362
375
363
376
### Limits for custom metrics
364
377
365
-
Azure Monitor imposes [usage limits](../azure-monitor/essentials/metrics-custom-overview.md#quotas-and-limits) for custom metrics that may affect your ability to emit metrics from API Management. For example, Azure Monitor currently sets a limit of 10 dimension keys per metric, and a limit of 50,000 total active time series per region in a subscription (within a 12 hour period).
378
+
Azure Monitor imposes [usage limits](../azure-monitor/essentials/metrics-custom-overview.md#quotas-and-limits) for custom metrics that may affect your ability to emit metrics from API Management. For example, Azure Monitor currently sets a limit of 10 dimension keys per metric, and a limit of 50,000 total active time series per region in a subscription (within a 12 hour period).
366
379
367
380
These limits have the following implications for configuring custom metrics in API Management:
368
381
@@ -404,4 +417,4 @@ Addressing the issue of telemetry data flow from API Management to Application I
404
417
405
418
+ Learn more about [Azure Application Insights](../azure-monitor/app/app-insights-overview.md).
406
419
+ Consider [logging with Azure Event Hubs](api-management-howto-log-event-hubs.md).
407
-
+ Learn about visualizing data from Application Insights using [Azure Managed Grafana](visualize-using-managed-grafana-dashboard.md)
420
+
+ Learn about visualizing data from Application Insights using [Azure Managed Grafana](visualize-using-managed-grafana-dashboard.md)
0 commit comments