You are configuring Application Insights instrumentation for an ASP.NET Core web application that will be hosted on Azure App Service. You want to ensure telemetry data is collected and sent to Azure Monitor. Which two of the following configuration actions are required to achieve this?
- Register the telemetry services by calling builder.Services.AddApplicationInsightsTelemetry(builder.Configuration) in Program.cs.Cevap
- Set the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable in your App Service configuration.Cevap
- CInstantiate TelemetryClient directly in your controllers without defining a connection string or registering the telemetry services.
- DCreate and run a Kusto Query Language (KQL) query omitting the time range filter in order to trigger the telemetry engine.
Cevap
To configure Application Insights instrumentation, you must register the telemetry services in your application's startup file and specify the Application Insights connection string in the configuration settings.
Registering the services in Program.cs ensures the SDK captures built-in telemetry, and setting the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable instructs the SDK where to send the telemetry.
Adım Adım Çözüm
Anahtar Kavram
Successful Application Insights SDK setup requires registering the telemetry services in code and providing a connection string for routing.