Soru

Zorluk: ZorConfigure Application Insights Web Tests and Availability Monitoring

You are migrating a deprecated multi-step web test that monitors an e-commerce checkout flow to a modern availability monitoring solution in Azure. The workflow requires logging in with a test account, searching for a product, and verifying the checkout service response.

You decide to implement a custom availability test using a Timer-triggered Azure Function and the Application Insights SDK. The function must run securely, retrieve test account credentials from Azure Key Vault, and report the workflow status to Application Insights.

You need to implement the telemetry reporting and ensure the function runs securely and successfully sends telemetry.

Which two actions should you perform? Select two.

  1. Instantiate TelemetryClient by passing a TelemetryConfiguration initialized with the Application Insights connection string, and call the TrackAvailability method with an AvailabilityTelemetry instance.Cevap
  2. Grant the Azure Function's system-assigned managed identity the Key Vault Secrets User role on the Key Vault that stores the test credentials, and reference those credentials in the function's application settings using Key Vault references.Cevap
  3. C
    Instantiate TelemetryClient using the default parameterless constructor without passing a connection string, relying on the local runtime environment to automatically inject the configuration.
  4. D
    Reference the test credentials in the function's application settings using the @Microsoft.KeyVault syntax, without configuring any access policies or Azure RBAC roles on the Key Vault.

Cevap

To implement the custom availability monitoring solution, you must instantiate the TelemetryClient using a TelemetryConfiguration initialized with the Application Insights connection string and call TrackAvailability with an AvailabilityTelemetry instance. Additionally, you must grant the function's managed identity the Key Vault Secrets User role to allow resolving Key Vault references in the application settings.
Migrating deprecated multi-step tests requires executing custom logic (such as logging in, searching, and checking out) in code, which can be done using a Timer-triggered Azure Function. To report custom availability telemetry, the Azure Function must use the Application Insights SDK. Instantiating TelemetryClient with a configuration containing the connection string ensures the telemetry is directed to the correct resource. Furthermore, retrieving credentials securely requires using Key Vault references in the application settings, which fails unless the function's system-assigned managed identity is granted authorization, such as the Key Vault Secrets User role.

Adım Adım Çözüm

1
Configure the Azure Function's App Settings to use Key Vault references for credentials, and authorize the Function's system-assigned managed identity to access the Key Vault.
The Function is granted authorization, allowing the runtime to resolve the @Microsoft.KeyVault references into actual credentials securely.
This is necessary because Azure resources do not have implicit access to Key Vault secrets, and credentials must be retrieved securely.
2
Initialize TelemetryConfiguration using the Application Insights connection string, and pass it to the constructor of TelemetryClient.
The TelemetryClient is correctly instantiated with the connection string, pointing to the intended Application Insights resource.
Instantiating the client without a connection string configuration will fail to transmit availability telemetry.
3
Construct an AvailabilityTelemetry instance with properties representing the test run (name, duration, success, location) and call TrackAvailability() on the TelemetryClient.
Custom availability data is successfully tracked and sent to Application Insights.
Standard web tests do not support multi-step checkout workflows or client certificates, necessitating custom availability logging via the SDK.

Anahtar Kavram

Custom availability monitoring with Application Insights SDK using Azure Functions and Key Vault integration
Bu soruyu puanla