App service https 4xx errors not showing in application insights

Gaurav Sharma 5 Reputation points
2024-12-12T14:17:24.2166667+00:00

I am sending app service diagnostic data to log analytics workspace and my app insights instance is also connected to same log analytics but application performance data is not showing under app insights

User's image

Thought for every 401 error ,monitoring alert is triggered and data shows under app service

User's image

but since both are connected to the same workspace instance app insights doesn't show any logs.

am i missing some configuration or app insights only works when you make connection from inside your app code ?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,155 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Laxman Reddy Revuri 1,525 Reputation points Microsoft Vendor
    2024-12-26T00:49:18.8866667+00:00

    Hi @gaurav sharma
    Thanks for the question and using MS Q&A platform.
    Based on the monitoring data you've shared I understand you're experiencing an issue where Application Insights isn't showing performance data despite having both App Service diagnostics and Application Insights connected to the same Log Analytics workspace.

    You're correct - Application Insights primarily requires instrumentation from within your application code to collect detailed performance telemetry. Simply connecting App Service diagnostics to Log Analytics workspace is not sufficient for Application Insights to show performance data.

    Instrument your application code with Application Insights:

    For .NET applications:

    <!-- Add to .csproj -->
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
    

    And in your startup code:

     services.AddApplicationInsightsTelemetry();
    

    For Node.js:

     const appInsights = require('applicationinsights'); appInsights.setup('<your-instrumentation-key>').start();
    

    Verify your application settings include:

    • APPLICATIONINSIGHTS_CONNECTION_STRING
    • ApplicationInsightsAgent_EXTENSION_VERSION (set to ~3 for latest version)
    1. Check these common gotchas:
    • Make sure you're using the correct instrumentation key/connection string
    • Verify the App Insights SDK version is compatible with your application framework
    • Ensure your application has the necessary permissions to send telemetry

    The HTTP 401 errors you're seeing in App Service diagnostics are platform-level logs, which is why they appear regardless of application instrumentation. Application Insights, however, needs code-level integration to provide detailed performance metrics, request tracking, and dependency calls.

    references:

    Application Insights portal connectivity issues - Azure | Microsoft Learn

    Troubleshoot problems with Azure Application Insights Profiler - Azure Monitor | Azure Docs

    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.