All practice questions
972 questions
A food delivery platform dispatch system uses Azure Service Bus to process orders for multiple restaurants. The system must guarantee that orders for each restaurant are processed in the exact order they are received. Additionally, if the consumer application crashes during processing, the message must not be lost and should eventually be moved to the dead-letter queue after a specific number of retries. Which two configuration or implementation steps should you perform to meet these requirements? (Select two.)
Select all that apply
You manage an Azure Cache for Redis instance that stores session data and reference tables. The session keys are configured with an expiration time, while the reference tables must remain in the cache indefinitely and do not have an expiration time. Due to an unexpected surge in traffic, the cache is reaching its memory limit. You need to configure a policy that removes keys with an expiration time, prioritizing those closest to expiring, while ensuring the reference tables are not removed. Which maxmemory policy should you configure?
You are deploying a C# .NET 8 microservice to Azure Container Apps. You need to enable Application Insights instrumentation using the SDK. Which two actions should you perform to ensure the SDK is correctly initialized and telemetry is successfully sent to your Azure Monitor resource?
Select all that apply
A developer is writing a C# application that connects to an Azure Cache for Redis instance using the StackExchange.Redis SDK. To optimize application performance and socket reuse, the application must share a single, thread-safe connection instance using lazy initialization. You need to arrange the steps required to initialize the cache connection client and execute a write operation. What is the correct sequence of steps to configure, establish, and use the connection?
Drag items to arrange them in the correct order
A developer is configuring response caching for an API in Azure API Management. The developer applies the following policy configuration:
xml
<policies>
<inbound>
<base />
<cache-lookup vary-by-developer="false" vary-by-developer-groups="false" downstream-caching-type="none" />
<cache-store duration="3600" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
</policies>
Why does this policy configuration fail to save?
You are developing a C# console application that runs on an Azure Virtual Machine. The application must perform key wrapping and unwrapping operations using an RSA key stored in an Azure Key Vault named kv-prod-keys. The Key Vault is configured to use the Azure Role-Based Access Control (Azure RBAC) permission model. The virtual machine has a system-assigned managed identity enabled. You need to grant the application the minimum necessary permissions to perform the operations and configure the application code using the latest Azure SDK for .NET. Which two actions should you perform? (Select TWO.)
Select all that apply
An e-prescribing platform processes medical prescriptions using an Azure Service Bus queue named `prescription-processing`. You are writing a C# console application that retrieves these prescriptions and updates a database. Because patient safety is critical, the application must guarantee that if a receiver crashes or encounters an unhandled exception while processing a prescription, the message is not lost and becomes available again for other receiver instances to process.
You write the following code segment to initialize the receiver and handle incoming messages:
csharp
string connectionString = "Endpoint=sb://...";
string queueName = "prescription-processing";
await using var client = new ServiceBusClient(connectionString);
var options = new ServiceBusReceiverOptions
{
// Line X
};
ServiceBusReceiver receiver = client.CreateReceiver(queueName, options);
ServiceBusReceivedMessage message = await receiver.ReceiveMessageAsync();
try
{
await ProcessPrescriptionAsync(message);
// Line Y
}
catch (Exception)
{
// Line Z
}
Which set of code segments should you use to complete the implementation?
Line Y: // No action required
Line Z: // No action required
Line Y: await receiver.CompleteMessageAsync(message);
Line Z: await receiver.AbandonMessageAsync(message);
Line Y: await receiver.CompleteMessageAsync(message);
Line Z: await receiver.AbandonMessageAsync(message);
Line Y: await receiver.AbandonMessageAsync(message);
Line Z: await receiver.CompleteMessageAsync(message);
You are developing a C# ASP.NET Core Web API that will be hosted on Azure App Service. You want to programmatically configure the Application Insights SDK using connection strings read from your configuration provider. You add the Microsoft.ApplicationInsights.AspNetCore NuGet package to your project and write the following initialization code in Program.cs:
csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddApplicationInsightsTelemetry(options =>
{
// Configure telemetry connection string
});
var app = builder.Build();
Which of the following statements should you place inside the action delegate to correctly configure the telemetry connection string?
You are developing a .NET 8 background worker service that processes queue messages and communicates with an external database. You need to manually track the database call as a dependency using the Application Insights SDK, and ensure any thrown exceptions are logged to Application Insights.
Complete the code by filling in the blanks with the correct TelemetryClient method names.
Fill in the blanks below
using Microsoft.ApplicationInsights.DataContracts;
using System;
using System.Threading.Tasks;
public class QueueProcessor
{
private readonly TelemetryClient _telemetryClient;
private readonly IExternalService _externalService;
public QueueProcessor(TelemetryClient telemetryClient, IExternalService externalService)
{
_telemetryClient = telemetryClient;
_externalService = externalService;
}
public async Task ProcessJobAsync(string jobId)
{
// Start and correlate a dependency tracking operation
using (var operation = _telemetryClient.<DependencyTelemetry>("DatabaseCall"))
{
try
{
await _externalService.ExecuteAsync(jobId);
operation.Telemetry.Success = true;
}
catch (Exception ex)
{
operation.Telemetry.Success = false;
_telemetryClient.(ex);
throw;
}
}
}
}
You are developing a solution that uses Azure API Management (APIM). You need to configure an inbound policy that forwards the client's original IP address to the backend service by adding a custom request header named `X-Client-IP`. You must use a C# policy expression within the `<set-header>` policy.
Complete the policy configuration by filling in the missing C# expression in the blank. What is the C# expression to retrieve the client's IP address from the request context?
Fill in the blanks below
<base />
<set-header name="X-Client-IP" exists-action="override">
<value>@()</value>
</set-header>
</inbound>
You are developing a secure .NET web API hosted on an Azure App Service. The API needs to programmatically retrieve an X.509 certificate, including its private key, from an Azure Key Vault named `kv-prod` to sign outgoing requests.
The App Service is configured with a system-assigned managed identity and has been assigned only the 'Key Vault Secrets User' Azure RBAC role on `kv-prod`.
Which C# code segment should you use to retrieve the certificate along with its private key?
KeyVaultSecret secret = await client.GetSecretAsync("SigningCert");
var certificate = new X509Certificate2(Convert.FromBase64String(secret.Value));
KeyVaultCertificateWithPolicy cert = await client.GetCertificateAsync("SigningCert");
var certificate = new X509Certificate2(cert.Cer);
KeyVaultKey key = await client.GetKeyAsync("SigningCert");
var certificate = new X509Certificate2(key.Key.N);
var client = new SecretClient(new Uri("https://kv-prod.vault.azure.net/"), credential);
KeyVaultSecret secret = await client.GetSecretAsync("SigningCert");
var certificate = new X509Certificate2(Convert.FromBase64String(secret.Value));
A digital ticketing platform processes high-value concert ticket bookings using an Azure Service Bus queue. To prevent booking failures, the system must guarantee that if a processing instance crashes during the checkout transaction, the message is not lost and remains available in the queue for another instance to process. Which message receive mode and SDK action should you implement?
A developer is configuring a Premium tier Azure Cache for Redis instance for a retail e-commerce application. The cache stores two types of data: product inventory levels (which are critical and must never be evicted, and do not have an expiration time set) and user search queries (which have an expiration time set). Under memory pressure, the system must only evict search query data while preserving all product inventory levels. Additionally, you must reserve memory for background processes to ensure stable replication and failover operations. Which two configuration settings should you implement to meet these requirements?
Select all that apply
You need to create a new SSL/TLS certificate in Azure Key Vault using a non-integrated Certificate Authority (CA). Which sequence of steps should you perform to generate the Certificate Signing Request (CSR) and complete the certificate creation in Key Vault?
Drag items to arrange them in the correct order
You are configuring an Azure API Management (APIM) policy to authenticate requests to a secure backend service. The backend service requires Azure Active Directory (Azure AD) tokens for the resource `https://api.contoso.com`. You must use a user-assigned managed identity with the Client ID `` to authenticate the requests.
Which of the following XML configurations correctly implements this authentication?
<base />
<authentication-managed-identity resource="https://api.contoso.com" client-id="11111111-2222-3333-4444-555555555555" />
</outbound>
<base />
<authentication-managed-identity resource="https://api.contoso.com" client-id="11111111-2222-3333-4444-555555555555" />
</inbound>
<base />
<authentication-managed-identity resource="https://api.contoso.com" />
</inbound>
<base />
<authentication-managed-identity resource="https://api.contoso.com" client-id="{{kv-identity-client-id}}" />
</inbound>
You are developing an ASP.NET Core Web API that must secure its endpoints using the Microsoft Identity Platform. The Web API will accept JWT access tokens sent by client applications in the HTTP Authorization header. You need to configure the Web API to validate these tokens using the `Microsoft.Identity.Web` library. Which two actions should you perform to complete the configuration? (Select two.)
Select all that apply
An IoT monitoring solution uses Azure Cache for Redis to store two types of data:
1. The latest telemetry reading for each device, which does not have an expiration time (TTL) set.
2. Temporary event logs that are configured with a Time-to-Live (TTL) of 24 hours.
Due to a surge in device activity, the cache is approaching its maximum memory limit. You need to configure the cache eviction policy so that under memory pressure, the cache removes the least recently used temporary event logs first, while ensuring that the device telemetry readings are never evicted.
Which eviction policy should you configure?
An airline baggage tracking application uses an Azure Service Bus queue named `baggage-scans` to process scan events. You need to configure the queue and the receiver client to meet the following requirements:
1. Duplicate scan messages sent within a 10-minute window must be automatically discarded by the queue.
2. If a receiver application fails to process a scan event, the message must remain in the queue to be retried.
3. If processing a scan event fails 5 times, the message must be automatically routed to the dead-letter queue.
Which two configurations or actions should you implement? (Select two.)
Select all that apply
Your company is migrating an Azure App Service web application to a new security model. The web application must retrieve database connection strings stored as secrets in an Azure Key Vault. The Key Vault is configured to use the Azure role-based access control (Azure RBAC) authorization model. You need to configure the minimum permissions required for the web application's system-assigned managed identity to read the secrets. Which configuration should you apply?
A developer is implementing the Cache-Aside pattern in an Azure App Service web application that retrieves user profile information from an Azure SQL Database. The application uses Azure Cache for Redis to improve read latency. You need to sequence the actions the application must perform when a user profile is requested and a cache miss occurs. Which sequence of actions should the application execute? Move all actions to the answer area and arrange them in the correct order.
Drag items to arrange them in the correct order