Question

Difficulty: Very hardConfigure Application Insights Web Tests and Availability Monitoring

You are developing a secure Web API hosted in Azure App Service. The API requires mutual TLS (mTLS) client certificate authentication for all incoming requests. You need to configure availability monitoring for this API using Application Insights. The solution must verify that the API successfully authenticates clients using their client certificates. Which monitoring solution should you implement?

  1. A
    Configure a Standard web test in Application Insights. In the request configuration, set the HTTPS URL of the API and add a custom header named X-Client-Cert containing the secret identifier of the client certificate stored in Azure Key Vault.
  2. B
    Create an Azure Function app with a timer-triggered function. Retrieve the client certificate, perform the HTTPS request to the API, and instantiate a new TelemetryClient using the default parameterless constructor without setting the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable before calling TrackAvailability.
  3. Create an Azure Function app with a timer-triggered function. Configure the function to retrieve the client certificate from Azure Key Vault using a managed identity, perform the HTTPS request to the API with the certificate attached, and send the result using the TrackAvailability method of the TelemetryClient class.Answer
  4. D
    Create an Azure Function app with a timer-triggered function. Configure a system-assigned managed identity for the Function app, grant it the Monitoring Metrics Publisher role on the App Service, and write code to push availability metrics directly to Azure Monitor using the Azure Monitor REST API.

Answer

Create an Azure Function app with a timer-triggered function. Configure the function to retrieve the client certificate from Azure Key Vault using a managed identity, perform the HTTPS request to the API with the certificate attached, and send the result using the TrackAvailability method of the TelemetryClient class.
To monitor an API requiring client certificate authentication, standard Application Insights web tests cannot be used because they do not support mutual TLS (mTLS) client certificate presentation. A custom availability test must be implemented. An Azure Function with a timer trigger can run on a schedule, securely retrieve the client certificate from Azure Key Vault using a managed identity, make the HTTPS call with the client certificate, and send the availability metrics using the TrackAvailability method of the TelemetryClient class.

Step-by-Step Solution

1
Determine if standard Application Insights tests can be used.
Standard ping and web tests do not support presenting client certificates for mutual TLS (mTLS) authentication, requiring a custom solution.
Standard tests run from public Azure test locations and cannot authenticate using custom client certificates.
2
Select the hosting mechanism for the custom availability test.
A timer-triggered Azure Function is chosen to run the test logic on a schedule.
Azure Functions offer a serverless, scheduled execution environment that integrates well with Key Vault and Application Insights.
3
Retrieve the certificate and perform the request.
Use a managed identity to authenticate against Azure Key Vault, fetch the certificate, and attach it to the HTTP request client.
This avoids hardcoding credentials and ensures secure certificate retrieval.
4
Track and report the availability status.
Instantiate TelemetryClient with the correct connection string and call the TrackAvailability method.
The TrackAvailability method publishes the results into the availability telemetry table, which enables built-in availability reporting and alerting.

Key Concept

Custom availability monitoring using TelemetryClient.TrackAvailability() for endpoints requiring client certificate authentication.
Rate this question