A team is migrating an on-premises web application to a C# .NET 8 Minimal API hosted on Azure Kubernetes Service (AKS). The containerized application includes the `Microsoft.ApplicationInsights.AspNetCore` package.
In the `Program.cs` file, the team registers telemetry using the following code:
csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddApplicationInsightsTelemetry();
During testing in the AKS cluster, the team notices that no telemetry data is populated in the Azure Portal, although the application starts up and processes HTTP requests without any exceptions. The Kubernetes deployment manifest currently defines only the `APPINSIGHTS_INSTRUMENTATIONKEY` environment variable.
Which action must the team take to ensure telemetry is sent successfully?
- AModify the configuration to pass the legacy key directly to the telemetry configuration by setting the InstrumentationKey property in Program.cs.
- BGrant the managed identity of the AKS cluster the Monitoring Metrics Publisher role on the target Application Insights resource.
- Define an environment variable named APPLICATIONINSIGHTS_CONNECTION_STRING in the Kubernetes deployment manifest containing the resource's connection string.Answer
- DConfigure a Key Vault reference in appsettings.json using the @Microsoft.KeyVault syntax to map the legacy key.