A developer is configuring a .NET Core Web API to use Azure Application Insights. In the Program.cs file, they add the call builder.Services.AddApplicationInsightsTelemetry(). However, they do not configure the Application Insights connection string in the appsettings.json file or in the App Service environment variables. What is the behavior of the application at runtime?
- AThe application throws an unhandled exception at startup due to the missing connection string.
- BThe application fails to initialize because it cannot access Key Vault due to a missing GET permission.
- The application starts and runs normally, but no telemetry is sent to Azure Monitor.Answer
- DThe application startup is blocked because the hosting App Service autoscale rules have conflicting metric thresholds.
Answer
The application starts and runs normally, but no telemetry is sent to Azure Monitor.
The correct answer states that the application starts and runs normally, but no telemetry is sent to Azure Monitor. When the Application Insights SDK is registered in code but the connection string is missing or empty, the SDK initializes successfully but does not transmit any telemetry. It does not throw a startup exception, ensuring application availability is not compromised by a telemetry configuration omission.
Step-by-Step Solution
Key Concept
Application Insights SDK Initialization Behavior with Missing Configuration