App Service trace entry "AI: TelemetryChannel found a telemetry item without an InstrumentationKey. This is a required field and must be set in either your config file or at application startup." although configured correctly and other logging working.

Adams, Roger 0 Reputation points
2024-09-25T18:48:21.3666667+00:00

I created my azure app service web app with its corresponding application insights using the portal and its guided wizards. For some reason the app insights trace log has "AI: TelemetryChannel found a telemetry item without an InstrumentationKey. This is a required field and must be set in either your config file or at application startup." showing up nearly every 15 minutes. I even have the logging default set to loglevel.error. Any ideas on what could be causing this? The app insights connection string is defined in the app service environment variables. I have tried adding the InstrumentationKey separately and also in the appsettings.json but nothing works to remove that message.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,758 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 21,506 Reputation points
    2024-09-26T18:12:51.6166667+00:00

    @Adams, Roger Thanks for asking question! The error message "AI: TelemetryChannel found a telemetry item without an InstrumentationKey. This is a required field and must be set in either your config file or at application startup." indicates that there is an issue with the configuration of your Application Insights instance.

    Try the following steps:

    string APP_INSIGHTS = builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"] ?? "";
    
    var options = new ApplicationInsightsServiceOptions { ConnectionString = APP_INSIGHTS };
    
    builder.Services.AddApplicationInsightsTelemetry(options: options);
    

    Let us know

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.