Skip to content

Commit b45cb6c

Browse files
(AzureCXP) fixes MicrosoftDocs/azure-docs#99582
Updates the example for using tokencredential in .NET. The previous example was not clear - for using TelemetryConfig instance. Instead, the TelemetryConfig.Active would be used to update the connection string and token.
1 parent 9e99729 commit b45cb6c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,9 @@ Application Insights .NET SDK supports the credential classes provided by [Azure
7676
Below is an example of manually creating and configuring a `TelemetryConfiguration` using .NET:
7777

7878
```csharp
79-
var config = new TelemetryConfiguration
80-
{
81-
ConnectionString = "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/"
82-
}
79+
TelemetryConfiguration.Active.ConnectionString = "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/";
8380
var credential = new DefaultAzureCredential();
84-
config.SetAzureTokenCredential(credential);
81+
TelemetryConfiguration.Active.SetAzureTokenCredential(credential);
8582
```
8683

8784
Below is an example of configuring the `TelemetryConfiguration` using .NET Core:

0 commit comments

Comments
 (0)