Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announcement: InstrumentationKey based APIs are marked Obsolete. #2560

Closed
TimothyMothra opened this issue Mar 21, 2022 · 0 comments
Closed
Milestone

Comments

@TimothyMothra
Copy link
Member

TimothyMothra commented Mar 21, 2022

Deprecating Instrumentation Key based SDK configuration in favor of Connection String.

More information:

Summary of Changes

  • Microsoft.ApplicationInsights

    • TelemetryConfiguration
      Setting InstrumentationKey via constructor or via property is marked Obsolete.
      Use the default constructor and set the ConnectionString property instead.

    • TelemetryClient
      Setting InstrumentationKey property is marked Obsolete.
      Use the constructor to provide a TelemetryConfiguration with ConnectionString set.

  • Microsoft.Extensions.Logging.ApplicationInsights

    • Setting InstrumentationKey via AddApplicationInsights() extension method is marked Obsolete.
      Use the overload which accepts Action<TelemetryConfiguration> and set TelemetryConfiguration.ConnectionString.
  • Microsoft.ApplicationInsights.AspNetCore and Microsoft.ApplicationInsights.WorkerService

    • ApplicationInsightsServiceOptions
      The InstrumentationKey property is marked Obsolete.
      Use ConnectionString property instead.

    • ExtensionMethods

      • Setting InstrumentationKey via AddApplicationInsightsTelemetry() extension method is marked Obsolete.
        Use the overload which accepts Action<ApplicationInsightsServiceOptions> and set ApplicationInsightsServiceOptions.ConnectionString.

      • Setting InstrumentationKey via AddApplicationInsightsTelemetryWorkerService() extension method is marked Obsolete.
        Use the overload which accepts Action<ApplicationInsightsServiceOptions> and set ApplicationInsightsServiceOptions.ConnectionString.

      • Setting InstrumentationKey via AddApplicationInsightsSettings() extension method is marked Obsolete.
        Use the overload which accepts string connectionString.

Config files

Users should refrain from setting the InstrumentationKey in text-based config files and instead set the ConnectionString.

ApplicationInsights.config

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
    <ConnectionString>InstrumentationKey=00000000-0000-0000-0000-000000000000</ConnectionString>
</ApplicationInsights>

ASP.NET Core or Worker Service config:

{
  "ApplicationInsights": {
    "ConnectionString" : "InstrumentationKey=00000000-0000-0000-0000-000000000000;"
    }
  }

For Comments or Questions

Please open a new issue.

@TimothyMothra TimothyMothra added this to the 2.21 milestone Mar 21, 2022
@microsoft microsoft locked as resolved and limited conversation to collaborators May 23, 2022
@TimothyMothra TimothyMothra changed the title Mark InstrumentationKey based APIs as Obsolete Announcement: InstrumentationKey based APIs are marked Obsolete. May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant