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
## Configure and enable Microsoft Entra ID-based authentication
42
42
43
43
1. If you don't already have an identity, create one by using either a managed identity or a service principal.
44
44
45
-
- We recommend using a managed identity:
45
+
* We recommend using a managed identity:
46
46
47
47
[Set up a managed identity for your Azure service](../../active-directory/managed-identities-azure-resources/services-support-managed-identities.md) (Virtual Machines or App Service).
48
48
49
-
- We don't recommend using a service principal:
49
+
* We don't recommend using a service principal:
50
50
51
51
For more information on how to create a Microsoft Entra application and service principal that can access resources, see [Create a service principal](../../active-directory/develop/howto-create-service-principal-portal.md).
52
52
@@ -66,11 +66,11 @@ The following Software Development Kits (SDKs) and features are unsupported for
66
66
67
67
Application Insights .NET SDK supports the credential classes provided by [Azure Identity](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/identity/Azure.Identity#credential-classes).
68
68
69
-
- We recommend `DefaultAzureCredential` for local development.
70
-
- Authenticate on Visual Studio with the expected Azure user account. For more information, see [Authenticate via Visual Studio](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity#authenticate-via-visual-studio).
71
-
- We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
72
-
- For system-assigned, use the default constructor without parameters.
73
-
- For user-assigned, provide the client ID to the constructor.
69
+
* We recommend `DefaultAzureCredential` for local development.
70
+
* Authenticate on Visual Studio with the expected Azure user account. For more information, see [Authenticate via Visual Studio](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity#authenticate-via-visual-studio).
71
+
* We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
72
+
* For system-assigned, use the default constructor without parameters.
73
+
* For user-assigned, provide the client ID to the constructor.
74
74
75
75
The following example shows how to manually create and configure `TelemetryConfiguration` by using .NET:
76
76
@@ -85,8 +85,8 @@ The following example shows how to configure `TelemetryConfiguration` by using .
Use the `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` environment variable to let Application Insights authenticate to Microsoft Entra ID and send telemetry when using [Azure App Services autoinstrumentation](./azure-web-apps-net-core.md).
| APPLICATIONINSIGHTS_AUTHENTICATION_STRING |`Authorization=AAD;ClientId={Client id of the User-Assigned Identity}`|
111
111
112
112
113
113
### [Node.js](#tab/nodejs)
114
114
115
115
Azure Monitor OpenTelemetry and Application Insights Node.JS supports the credential classes provided by [Azure Identity](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credential-classes).
116
116
117
-
- We recommend `DefaultAzureCredential` for local development.
118
-
- We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
119
-
- For system-assigned, use the default constructor without parameters.
120
-
- For user-assigned, provide the client ID to the constructor.
121
-
- We recommend `ClientSecretCredential` for service principals.
122
-
- Provide the tenant ID, client ID, and client secret to the constructor.
117
+
* We recommend `DefaultAzureCredential` for local development.
118
+
* We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
119
+
* For system-assigned, use the default constructor without parameters.
120
+
* For user-assigned, provide the client ID to the constructor.
121
+
* We recommend `ClientSecretCredential` for service principals.
122
+
* Provide the tenant ID, client ID, and client secret to the constructor.
123
123
124
124
If using @azure/monitor-opentelemetry
125
125
```typescript
@@ -141,6 +141,7 @@ useAzureMonitor(options);
141
141
> Support for Microsoft Entra ID in the Application Insights Node.JS is included starting with [version 2.1.0-beta.1](https://www.npmjs.com/package/applicationinsights/v/2.1.0-beta.1).
Use the `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` environment variable to let Application Insights authenticate to Microsoft Entra ID and send telemetry when using [Azure App Services autoinstrumentation](./azure-web-apps-nodejs.md).
| APPLICATIONINSIGHTS_AUTHENTICATION_STRING |`Authorization=AAD;ClientId={Client id of the User-Assigned Identity}`|
169
170
170
171
### [Java](#tab/java)
171
172
172
173
> [!NOTE]
173
174
> Support for Microsoft Entra ID in the Application Insights Java agent is included starting with [Java 3.2.0-BETA](https://github.com/microsoft/ApplicationInsights-Java/releases/tag/3.2.0-BETA).
174
175
175
-
1.[Configure your application with the Java agent.](opentelemetry-enable.md?tabs=java#get-started)
176
+
1.[Configure your application with the Java agent.](opentelemetry-enable.md?tabs=java#enable-opentelemetry-with-application-insights)
176
177
177
178
> [!IMPORTANT]
178
179
> Use the full connection string, which includes `IngestionEndpoint`, when you configure your app with the Java agent. For example, use `InstrumentationKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;IngestionEndpoint=https://XXXX.applicationinsights.azure.com/`.
@@ -217,17 +218,17 @@ The following example shows how to configure the Java agent to use user-assigned
217
218
218
219
The `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` environment variable lets Application Insights authenticate to Microsoft Entra ID and send telemetry.
| APPLICATIONINSIGHTS_AUTHENTICATION_STRING |`Authorization=AAD;ClientId={Client id of the User-Assigned Identity}`|
231
232
232
233
Set the `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` environment variable using this string.
233
234
@@ -291,15 +292,17 @@ Now that your app is registered and has permissions to use the API, grant your a
291
292
### Request an authorization token
292
293
293
294
Before you begin, make sure you have all the values required to make the request successfully. All requests require:
294
-
- Your Microsoft Entra tenant ID.
295
-
- Your App Insights App ID - If you're currently using API Keys, it's the same app ID.
296
-
- Your Microsoft Entra client ID for the app.
297
-
- A Microsoft Entra client secret for the app.
295
+
296
+
* Your Microsoft Entra tenant ID.
297
+
* Your App Insights App ID - If you're currently using API Keys, it's the same app ID.
298
+
* Your Microsoft Entra client ID for the app.
299
+
* A Microsoft Entra client secret for the app.
298
300
299
301
The Application Insights API supports Microsoft Entra authentication with three different [Microsoft Entra ID OAuth2](/azure/active-directory/develop/active-directory-protocols-oauth-code) flows:
300
-
- Client credentials
301
-
- Authorization code
302
-
- Implicit
302
+
303
+
* Client credentials
304
+
* Authorization code
305
+
* Implicit
303
306
304
307
#### Client credentials flow
305
308
@@ -700,15 +703,15 @@ You can disable local authentication by using the Azure portal or Azure Policy o
700
703
701
704
1. From your Application Insights resource, select **Properties** under **Configure** in the menu on the left. Select **Enabled (click to change)** if the local authentication is enabled.
702
705
703
-
:::image type="content" source="./media/azure-ad-authentication/enabled.png" alt-text="Screenshot that shows Properties under the Configure section and the Enabled (select to change) local authentication button.":::
706
+
:::image type="content" source="./media/azure-ad-authentication/enabled.png" alt-text="Screenshot that shows Properties under the Configure section and the Enabled (select to change) local authentication button.":::
704
707
705
708
1. Select **Disabled** and apply changes.
706
709
707
-
:::image type="content" source="./media/azure-ad-authentication/disable.png" alt-text="Screenshot that shows local authentication with the Enabled/Disabled button.":::
710
+
:::image type="content" source="./media/azure-ad-authentication/disable.png" alt-text="Screenshot that shows local authentication with the Enabled/Disabled button.":::
708
711
709
712
1. After disabling local authentication on your resource, you'll see the corresponding information in the **Overview** pane.
710
713
711
-
:::image type="content" source="./media/azure-ad-authentication/overview.png" alt-text="Screenshot that shows the Overview tab with the Disabled (select to change) local authentication button.":::
714
+
:::image type="content" source="./media/azure-ad-authentication/overview.png" alt-text="Screenshot that shows the Overview tab with the Disabled (select to change) local authentication button.":::
712
715
713
716
### Azure Policy
714
717
@@ -824,11 +827,11 @@ The following example shows the Azure Resource Manager template you can use to c
824
827
825
828
When developing a custom client to obtain an access token from Microsoft Entra ID for submitting telemetry to Application Insights, refer to the following table to determine the appropriate audience string for your particular host environment.
826
829
827
-
| Azure cloud version | Token audience value |
828
-
|---|---|
829
-
| Azure public cloud |`https://monitor.azure.com`|
830
-
| Microsoft Azure operated by 21Vianet cloud |`https://monitor.azure.cn`|
831
-
| Azure US Government cloud |`https://monitor.azure.us`|
| Azure public cloud |`https://monitor.azure.com`|
833
+
| Microsoft Azure operated by 21Vianet cloud |`https://monitor.azure.cn`|
834
+
| Azure US Government cloud |`https://monitor.azure.us`|
832
835
833
836
If you're using sovereign clouds, you can find the audience information in the connection string as well. The connection string follows this structure:
834
837
@@ -920,8 +923,8 @@ Using Fiddler, you might notice the response `HTTP/1.1 403 Forbidden - provided
920
923
921
924
The issue could be due to:
922
925
923
-
- Creating the resource with a system-assigned managed identity or associating a user-assigned identity without adding the Monitoring Metrics Publisher role to it.
924
-
- Using the correct credentials for access tokens but linking them to the wrong Application Insights resource. Ensure your resource (virtual machine or app service) or user-assigned identity has Monitoring Metrics Publisher roles in your Application Insights resource.
926
+
* Creating the resource with a system-assigned managed identity or associating a user-assigned identity without adding the Monitoring Metrics Publisher role to it.
927
+
* Using the correct credentials for access tokens but linking them to the wrong Application Insights resource. Ensure your resource (virtual machine or app service) or user-assigned identity has Monitoring Metrics Publisher roles in your Application Insights resource.
925
928
926
929
#### Invalid Client ID
927
930
@@ -951,6 +954,6 @@ This error usually occurs when the provided credentials don't grant access to in
951
954
952
955
## Next steps
953
956
954
-
-[Monitor your telemetry in the portal](overview-dashboard.md)
955
-
-[Diagnose with Live Metrics Stream](live-stream.md)
956
-
-[Query Application Insights using Microsoft Entra authentication](./app-insights-azure-ad-api.md)
957
+
*[Monitor your telemetry in the portal](overview-dashboard.md)
958
+
*[Diagnose with Live Metrics Stream](live-stream.md)
959
+
*[Query Application Insights using Microsoft Entra authentication](./app-insights-azure-ad-api.md)
0 commit comments