Skip to content

Commit 141523f

Browse files
committed
Update
1 parent e03a195 commit 141523f

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

articles/azure-monitor/app/azure-ad-authentication.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ services.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions
9696

9797
### [Node.js](#tab/nodejs)
9898

99-
> [!NOTE]
100-
> 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).
10199

102-
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).
100+
101+
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).
103102

104103
- We recommend `DefaultAzureCredential` for local development.
105104
- We recommend `ManagedIdentityCredential` for system-assigned and user-assigned managed identities.
@@ -108,10 +107,29 @@ Application Insights Node.JS supports the credential classes provided by [Azure
108107
- We recommend `ClientSecretCredential` for service principals.
109108
- Provide the tenant ID, client ID, and client secret to the constructor.
110109

110+
If using @azure/monitor-opentelemetry
111+
```typescript
112+
const { useAzureMonitor, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
113+
const { ManagedIdentityCredential } = require("@azure/identity");
114+
115+
const credential = new ManagedIdentityCredential();
116+
const options: AzureMonitorOpenTelemetryOptions = {
117+
azureMonitorExporterOptions: {
118+
connectionString:
119+
process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "<your connection string>",
120+
credential: credential
121+
}
122+
};
123+
useAzureMonitor(options);
124+
```
111125

112-
```javascript
113-
import appInsights from "applicationinsights";
114-
import { DefaultAzureCredential } from "@azure/identity";
126+
> [!NOTE]
127+
> 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).
128+
129+
If using applicationinsights npm package.
130+
```typescript
131+
const appInsights = require("applicationinsights");
132+
const { DefaultAzureCredential } = require("@azure/identity");
115133

116134
const credential = new DefaultAzureCredential();
117135
appInsights.setup("InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/").start();

articles/azure-monitor/app/opentelemetry-configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ const credential = new ManagedIdentityCredential();
615615
// Create a new AzureMonitorOpenTelemetryOptions object and set the credential property to the credential object.
616616
const options: AzureMonitorOpenTelemetryOptions = {
617617
azureMonitorExporterOptions: {
618+
connectionString:
619+
process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "<your connection string>",
618620
credential: credential
619621
}
620622
};

0 commit comments

Comments
 (0)