All practice questions
972 questions
An Azure App Service web application experiences intermittent failures. You are troubleshooting the issues by querying Application Insights telemetry.
You need to correlate the exceptions recorded over the last hours with their associated failed requests to identify the most common problem IDs.
Which KQL query should you execute to retrieve this data with the best query performance?
| where timestamp > ago(24h)
| join kind=inner (
requests
| where success == false
) on operation_Id
| summarize OccurrenceCount = count() by problemId
| top 5 by OccurrenceCount desc
| join kind=inner (
requests
| where success == false
) on operation_Id
| summarize OccurrenceCount = count() by problemId
| top 5 by OccurrenceCount desc
| where timestamp > ago(24h)
| join kind=inner (
requests
| where timestamp > ago(24h)
| where success == false
) on operation_Id
| summarize OccurrenceCount = count() by problemId
| top 5 by OccurrenceCount desc
| join kind=inner (
requests
| where success == false
) on operation_Id
| where timestamp > ago(24h)
| summarize OccurrenceCount = count() by problemId
| top 5 by OccurrenceCount desc
You are designing a monitoring and remediation strategy for an enterprise web application hosted on Azure App Service. The application logs exceptions to an Application Insights workspace.
You need to implement an Azure Monitor Log Search Alert rule that triggers when the exception rate exceeds a specific threshold. The alert must execute the following workflow:
1. Dynamically email all users who hold the built-in 'Monitoring Contributor' role at the subscription level.
2. Invoke an automated remediation service hosted on an Azure Function App. This endpoint is secured using Microsoft Entra ID authentication.
3. Minimize query overhead and avoid duplicate filtering in the underlying Kusto Query Language (KQL) query execution.
Which configurations must you implement to meet these requirements?
Select all that apply
You are configuring an inbound policy in Azure API Management (APIM) to extract user information from a custom HTTP header named `X-Auth-Token`, which contains a raw JSON Web Token (JWT). The policy must extract the first value of the `email` claim from the token and forward it to the backend service inside a new request header named `X-User-Email`. If the claim is not present, it should default to an empty string.
Complete the XML policy definition below by filling in the correct C# extension method and JWT property name in the blanks.
Fill in the blanks below
<policies>
<inbound>
<base />
<set-header name="X-User-Email" exists-action="override">
<value>@(context.Request.Headers.GetValueOrDefault("X-Auth-Token", "").()?..GetValueOrDefault("email")?[0] ?? "")</value>
</set-header>
</inbound>
</policies>
You are developing a .NET background worker service that processes critical payment transactions from an Azure Service Bus queue. The processing of each payment involves calling a third-party gateway, which can take up to 2 minutes during peak hours. The Service Bus queue is configured with a default LockDuration of 30 seconds and a MaxDeliveryCount of 5.
You must ensure that:
1. Messages are never lost if the worker service crashes or restarts mid-transaction.
2. Messages are not processed by multiple workers simultaneously if processing exceeds 30 seconds.
3. Message processing failures due to transient errors are immediately released back to the queue for retry up to the maximum delivery count.
You use the Azure.Messaging.ServiceBus SDK to initialize the processor with the following code:
csharp
var client = new ServiceBusClient(connectionString);
var options = new ServiceBusProcessorOptions
{
ReceiveMode = [ReceiveMode],
AutoCompleteMessages = [AutoComplete],
MaxAutoLockRenewalDuration = [MaxAutoLockRenewal]
};
ServiceBusProcessor processor = client.CreateProcessor(queueName, options);
processor.ProcessMessageAsync += async args =>
{
try
{
await ProcessPaymentWithRetryAsync(args.Message);
[CompleteMessage]
}
catch (Exception)
{
[HandleException]
}
};
Which set of configuration values and code segments should you use to meet these requirements?
[AutoComplete] = false
[MaxAutoLockRenewal] = TimeSpan.FromMinutes(5)
[CompleteMessage] = await args.CompleteMessageAsync(args.Message);
[HandleException] = await args.AbandonMessageAsync(args.Message);
[AutoComplete] = true
[MaxAutoLockRenewal] = TimeSpan.FromMinutes(5)
[CompleteMessage] = // No-op
[HandleException] = // No-op
[AutoComplete] = false
[MaxAutoLockRenewal] = TimeSpan.Zero
[CompleteMessage] = await args.CompleteMessageAsync(args.Message);
[HandleException] = await args.AbandonMessageAsync(args.Message);
[AutoComplete] = true
[MaxAutoLockRenewal] = TimeSpan.FromMinutes(5)
[CompleteMessage] = await args.CompleteMessageAsync(args.Message);
[HandleException] = await args.AbandonMessageAsync(args.Message);
You are deploying an Azure API Management (APIM) self-hosted gateway to an on-premises Kubernetes cluster to manage local microservices. You have created the gateway resource within your APIM instance in the Azure portal. You need to configure the self-hosted gateway container deployment so that it can successfully register and retrieve its configuration from the parent APIM instance. Which two environment variables must you configure on the container to enable this connection? (Select two.)
Select all that apply
An enterprise web application hosted on Azure App Service is instrumented with Application Insights. You are implementing an Azure Monitor Log Search Alert rule to monitor server-side errors. The alert rule must trigger an Action Group if the percentage of HTTP 5xx responses exceeds of the total requests over a rolling 15-minute window, evaluated every 5 minutes.
The alert rule condition is configured with the following properties:
- Measure: Metric measurement
- Metric column: ErrorRate
- Aggregation type: Average
- Aggregation granularity (Period): 15 minutes
- Frequency of evaluation: 5 minutes
Which of the following configurations should you implement to satisfy the monitoring requirement and ensure telemetry ingestion and alert execution are successful?
You are implementing an event processor client in a C# (.NET) application using the `Azure.Messaging.EventHubs.Processor` library. The application consumes telemetry from an Azure Event Hub and uses an Azure Blob Storage container to store checkpoints and partition ownership metadata.
During a deployment, you encounter the following two issues:
1. A secondary management service in the application fails with an HTTP 412 (Precondition Failed) error when attempting to append custom monitoring metadata directly to the active partition ownership lease blobs.
2. The event processor client fails to authenticate with the Storage account when using a User-Assigned Managed Identity, throwing an credential authentication exception.
Which of the following actions should you perform to resolve these issues? (Select TWO)
Select all that apply
You are designing an airline flight booking system that processes seat reservation requests using Azure Service Bus queues. The system must meet the following technical requirements:
- Seat reservations for any specific flight must be processed in the exact order they are received.
- Any duplicate reservation requests sent due to client-side network retries within a 10-minute window must be automatically discarded by the queue.
- If a message fails to be processed after 5 attempts, it must be automatically routed to a dead-letter queue.
Which two configurations should you implement to satisfy the message ordering and duplicate detection requirements? (Select two.)
Select all that apply
An e-commerce system writes custom telemetry to Application Insights. To troubleshoot a sudden latency spike in checkout processing, you must identify the top 5 slowest dependencies of type 'HTTP' over the last 6 hours. You must write a query that minimizes resource consumption and query execution time.
Which KQL query should you execute to retrieve these results efficiently?
| where type == "HTTP"
| top 5 by duration desc
| where timestamp > ago(6h)
| where type == "HTTP"
| top 5 by duration desc
| where timestamp > ago(6h) and type == "HTTP"
| top 5 by duration desc
| project timestamp, type, duration, name
| top 5 by duration desc
| where type == "HTTP" and timestamp > ago(6h)
You are configuring a custom gateway domain for an Azure API Management (APIM) instance. The TLS certificate for the custom domain is stored in Azure Key Vault. You have enabled a system-assigned managed identity for the APIM instance. You need to configure the Azure Key Vault access policy to allow the APIM instance to retrieve the TLS certificate while adhering to the principle of least privilege. Which permission must you grant to the APIM system-assigned managed identity in the Key Vault access policy?
You are troubleshooting a performance issue in an Azure Web App. You need to write an optimized Kusto Query Language (KQL) query to find the average duration of requests grouped by the operation name. To avoid the performance impact of scanning all historical telemetry logs, you must first filter the telemetry data to only include requests from the last 6 hours.
Complete the KQL query by filling in the blanks.
Fill in the blanks below
| where >
| summarize AvgDuration = avg(duration) by operation_Name
You are configuring mutual TLS (mTLS) authentication between an Azure API Management (APIM) gateway and a backend API hosted on an Azure App Service. The client certificate used for authentication must be securely stored in Azure Key Vault and dynamically retrieved by APIM. You have already enabled a system-assigned managed identity for the APIM instance.
Which two configurations are required to ensure the APIM gateway successfully retrieves the certificate and authenticates with the backend API? (Select two.)
Select all that apply
You are designing autoscale rules for a production Azure Virtual Machine Scale Set (VMSS) hosting a microservice API. The VMSS has a minimum instance count of and a maximum instance count of .
The current autoscale settings are configured as follows:
* Scale-out rule: When the CPU Percentage (aggregated as Average) is greater than for minutes, increase the instance count by .
* Scale-in rule: When the CPU Percentage (aggregated as Average) is less than for minutes, decrease the instance count by .
You need to configure the scale-in rule to prevent autoscale flapping (repeated scale-out and scale-in cycles) under constant workload conditions.
Which two changes should you implement? (Select two.)
Select all that apply
You are developing a .NET background service that processes high-value medical prescription renewal messages from an Azure Service Bus queue named `prescriptions-queue`. The system has the following requirements:
1. Messages must be processed reliably; if the application crashes or restarts while a message is being processed, the message must not be lost and must be made available for reprocessing.
2. The application must authenticate to the Service Bus namespace using a managed identity that has an independent lifecycle from the hosting Azure resource.
3. The identity must follow the principle of least privilege, with permissions scoped directly to the queue rather than the entire namespace or resource group.
Which combination of Azure Role-Based Access Control (RBAC) role assignment and code implementation should you use?
An organization is deploying an API to Azure API Management (APIM) that communicates with a backend service hosted on Azure App Service. The API must meet the following security requirements:
1. Inbound requests to APIM must be authenticated using OAuth 2.0. APIM must validate that the JWT contains a claim named "roles" containing the value "Writer", and that the token is issued specifically by the company's Azure AD tenant (contoso.onmicrosoft.com). If validation fails, a 401 Unauthorized status must be returned.
2. APIM must authenticate to the backend App Service using a User-Assigned Managed Identity named "apim-identity" (Client ID: 11111111-1111-1111-1111-111111111111).
Which of the following policy configurations should you implement in the APIM policy definition to meet these requirements?
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
<openid-config url="https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="roles" match="any">
<value>Writer</value>
</claim>
</required-claims>
</validate-jwt>
<authentication-managed-identity resource="https://backend.contoso.com" client-id="11111111-1111-1111-1111-111111111111" />
</inbound>
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
<openid-config url="https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="roles" match="any">
<value>Writer</value>
</claim>
</required-claims>
</validate-jwt>
<authentication-managed-identity resource="https://backend.contoso.com" identity-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apim-identity" />
</inbound>
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
<openid-config url="https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="roles" match="any">
<value>Writer</value>
</claim>
</required-claims>
</validate-jwt>
</inbound>
<outbound>
<base />
<authentication-managed-identity resource="https://backend.contoso.com" client-id="11111111-1111-1111-1111-111111111111" />
</outbound>
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
<openid-config url="https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="roles" match="any">
<value>Writer</value> </claim> </required-claims>
</validate-jwt>
<authentication-managed-identity resource="https://backend.contoso.com" />
</inbound>
An Azure App Service web application is experiencing latency issues. You need to write an optimized Kusto Query Language (KQL) query in Application Insights to identify the top 5 slowest dependencies based on their average duration over the last 24 hours. The query must minimize the data scanned to ensure high performance.
Which KQL query should you run?
| where timestamp > ago(24h)
| summarize avg_duration = avg(duration) by target
| top 5 by avg_duration desc
| summarize avg_duration = avg(duration) by target
| top 5 by avg_duration desc
| where timestamp > ago(24h)
| where isnotempty(sdkVersion) and isnotempty(connectionString)
| summarize avg_duration = avg(duration) by target
| top 5 by avg_duration desc
| where timestamp > ago(24h)
| where target has "cdn" and url has "cache=bypass"
| summarize avg_duration = avg(duration) by target
| top 5 by avg_duration desc
An application processes background tasks using Azure Queue Storage. The application retrieves a message and processes it. Because processing can occasionally exceed the initial visibility timeout, the application must extend the visibility timeout of the retrieved message to prevent other workers from processing it concurrently.
Complete the C# code snippet below by filling in the blanks with the correct Azure Storage Queues SDK client library (.NET) method names and property names.
Fill in the blanks below
using System.Threading.Tasks;
using Azure.Storage.Queues;
using Azure.Storage.Queues.Models;
public class QueueWorker
{
public async Task ProcessMessageAsync(string connectionString)
{
QueueClient queueClient = new QueueClient(connectionString, "orders");
// Retrieve a single message and hide it for 30 seconds
var response = await queueClient.(1, TimeSpan.FromSeconds(30));
if (response.Value.Length > 0)
{
QueueMessage message = response.Value[0];
// Simulating long-running operation...
// Extend the visibility timeout by another 60 seconds without altering the message text
await queueClient.(
message.MessageId,
message.,
visibilityTimeout: TimeSpan.FromSeconds(60)
);
// Complete processing...
}
}
}
You are developing a C# (.NET) console application that transmits batch telemetry messages to an Azure Event Hub using the modern Azure.Messaging.EventHubs SDK. You need to write the publishing logic using the producer client to optimize performance and prevent message size violations. In which sequence should you perform the steps to initialize the client, build the batch, transmit the events, and release resources?
Drag items to arrange them in the correct order
You are configuring Azure API Management (APIM) to route requests to a secure backend Azure Function app. The backend function app requires Microsoft Entra ID authentication. You enable a user-assigned managed identity on the APIM instance, which has a client ID of `11111111-2222-3333-4444-555555555555`. You must configure APIM to authenticate against the backend function using this user-assigned managed identity. You define the following policy configuration:
xml
<policies>
<inbound>
<base />
<authentication-managed-identity resource="https://my-backend-function.azurewebsites.net" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
</policies>
When you test the API, requests to the backend fail with an HTTP 401 Unauthorized status. Which of the following modifications to the policy definition will resolve this issue?
You are troubleshooting a performance degradation in an Azure Web App. You need to analyze the daily failure rate of incoming HTTP requests recorded in Application Insights over the last 7 days. To prevent query timeouts and minimize resource usage on your Application Insights resource, the queries must be optimized. Which two of the following Kusto Query Language (KQL) queries will successfully calculate the daily failure rate while meeting the optimization requirement?
Select all that apply