All practice questions
972 questions
You are deploying a microservice named `inventory-service` to an Azure Container Apps environment. The microservice must only accept incoming requests from other container apps within the same environment and must not be exposed to the public internet. Additionally, client requests must be routed to the same replica of `inventory-service` to support in-memory session caching.
Which two configuration settings must you apply to the Container App's ingress configuration? (Select two.)
Select all that apply
An organization is deploying a C# background service that runs on an on-premises Windows server. The service must periodically query Microsoft Graph using its own credentials, authenticated by a client certificate. Which MSAL.NET builder class must you use to instantiate the client application?
You are developing a .NET background worker service that processes batch database updates from an Azure Service Bus queue named `db-updates`. The queue has a message lock duration set to 1 minute.
Each update batch takes exactly 7 minutes to process. You write the following code to initialize the processor and handle messages:
csharp
var client = new ServiceBusClient(connectionString);
var options = new ServiceBusProcessorOptions
{
ReceiveMode = ServiceBusReceiveMode.PeekLock,
AutoCompleteMessages = false
};
var processor = client.CreateProcessor("db-updates", options);
processor.ProcessMessageAsync += MessageHandler;
processor.ProcessErrorAsync += ErrorHandler;
async Task MessageHandler(ProcessMessageEventArgs args)
{
await ProcessBatchAsync(args.Message); // Takes 7 minutes
await args.CompleteMessageAsync(args.Message);
}
The `MaxAutoLockRenewalDuration` property is left at its default configuration.
What is the behavior of the application when processing a message?
You manage an Azure App Service Web App named ImageResizerAPI that is deployed on a Standard (S2) App Service plan. The Web App is currently scaled to 3 instances. You configure an autoscale rule to scale out by increasing the instance count by 1 when the average CPU percentage exceeds . You need to configure a scale-in rule to decrease the instance count by 1 when the CPU load decreases. To prevent autoscale flapping, which scale-in CPU threshold should you configure?
An operations monitoring application uses an Azure Cosmos DB API for NoSQL account with a single write region in East US and read replicas in West US and East Asia. The database account is currently configured with the default Session consistency level. The development team needs to optimize the application for both performance and read guarantees.
Which two statements regarding Azure Cosmos DB consistency level configurations and their trade-offs are correct? (Select two.)
Select all that apply
An enterprise data archive application written in C# needs to update the custom metadata of an existing blob named `log-archive.txt` inside a container named `logs` using the `Azure.Storage.Blobs` SDK (v12). The blob currently has an active lease held by another process with the ID stored in a string variable named `activeLeaseId`.
You need to write the code to update the metadata dictionary with a key of `ProcessedBy` and a value of `SyncService`. The update must succeed without breaking or releasing the lease.
Which code segment should you use?
{
{ "ProcessedBy", "SyncService" }
};
await blobClient.SetMetadataAsync(metadata);
{
{ "ProcessedBy", "SyncService" }
};
var conditions = new BlobRequestConditions { LeaseId = activeLeaseId };
await blobClient.SetMetadataAsync(metadata, conditions);
{
{ "x-ms-meta-ProcessedBy", "SyncService" }
};
var conditions = new BlobRequestConditions { LeaseId = activeLeaseId };
await blobClient.SetMetadataAsync(metadata, conditions);
{
{ "ProcessedBy", "SyncService" }
};
var sasUri = blobClient.GenerateSasUri(BlobSasPermissions.Read | BlobSasPermissions.Write | BlobSasPermissions.Delete, DateTimeOffset.UtcNow.AddDays(30));
var sasClient = new BlobClient(sasUri);
await sasClient.SetMetadataAsync(metadata);
A developer is configuring a C# console application that will run on a user's workstation. The application must authenticate the user using the Microsoft Identity Platform to retrieve their profile from Microsoft Graph. Which two components must be configured to support this authentication flow? (Select two)
Select all that apply
A company runs a high-throughput transaction processing system that stores invoice documents in an Azure Cosmos DB container. To generate real-time financial reports, you are implementing a scaling consumer application with multiple active host instances. The instances must load-balance the processing of change feed events from the source container. Which configuration must you apply to the lease container and the Change Feed Processor instances to ensure correct load-balanced execution?
A developer is configuring a V4 Azure Function App to connect to a secure database. The database connection string is stored in Azure Key Vault. The developer wants to reference this secret directly in the Function App's application settings without writing custom code to retrieve it. The Function App has a system-assigned managed identity enabled. Which of the following configurations is required to successfully retrieve the secret at runtime?
A company is developing an Azure Cosmos DB API for NoSQL solution that replicates data across East US and West US. The Cosmos DB account is configured with Session consistency as the default. You deploy two distinct instances of a web client, AppClient1 and AppClient2. AppClient1 writes a document update to the database. AppClient2 must immediately read the updated document, but it does not have access to AppClient1's session token. Which of the following describes the consistency behavior AppClient2 will experience when reading the updated document?
You are developing a veterinary clinic management system that synchronizes patient health records. The system uses an Azure Service Bus queue named patient-sync to distribute updates (with an average payload size of ) to a clinic database. You are implementing a .NET console application that processes these messages.
The solution must meet the following requirements:
- Synchronize messages with at-least-once delivery guarantees. If the console application crashes during processing, the message must remain in the queue for subsequent processing.
- Configure client authentication using a Shared Access Signature (SAS) token that restricts the console application to only receiving and processing messages from the patient-sync queue, with no permissions to send messages or manage the queue.
Which two configuration settings should you apply? (Select two.)
Select all that apply
You are configuring diagnostic telemetry for a .NET web application hosted on an Azure App Service. The application is experiencing intermittent unhandled exceptions in production, and you need to enable the Application Insights Snapshot Debugger to collect call stacks when these exceptions occur. Developers must also be able to view these snapshots in the Azure portal.
Which of the following configuration actions are required? (Select TWO)
Select all that apply
A C# financial auditing application needs to update the custom metadata on an existing block blob containing a transaction ledger. To prevent concurrent write operations from other clients, the application must implement lease-controlled metadata updates using the Azure SDK for .NET. Which of the following sequences represents the correct order of steps the application must execute to perform this update securely?
Drag items to arrange them in the correct order
You are developing a client-side React single-page application (SPA) that will run in users' web browsers. The application must authenticate users against Microsoft Entra ID and access a secure downstream web API. You need to configure the authentication and identity settings for the React application. Which configuration should you implement in Microsoft Entra ID?
You are developing a C# service that manages customer profiles in Azure Cosmos DB using the .NET SDK v3. The service must connect to the database, navigate the resource hierarchy, and update a user profile. The database is named ProfileDb, the container is named Profiles, and the partition key path for the container is /userId.
You have an existing UserProfile instance named profile that contains a UserId property.
Which sequence of C# code blocks must you execute to initialize the client and upsert the user profile?
Drag items to arrange them in the correct order
You are deploying a secure web application named web-app to Azure Container Apps. The application needs to retrieve database credentials stored as a secret in an existing Azure Key Vault named kv-prod. You must configure the Container App to access the Key Vault secret securely using a user-assigned managed identity. Which sequence of steps should you perform to configure the Container App?
Drag items to arrange them in the correct order
You are developing a background daemon service named ConfigSync that runs as a containerized application in Azure Container Instances. The service must periodically query Microsoft Graph to read tenant group memberships to synchronize configurations. No user is signed in when the service runs.
You register the application in Microsoft Entra ID. You need to configure the API permissions for the application registration while adhering to the principle of least privilege.
Which configuration should you implement?
A SaaS application uses the Azure Cosmos DB .NET SDK v3 to store user settings in a container. The container is configured with Session consistency and is partitioned by `TenantId`. You are writing C# code to replace a user's settings document.
To ensure data consistency and verify the update immediately from a separate client instance, you need to execute the write and pass the session state to the second client.
Which code segment should you use to achieve this?
settings,
settings.Id,
new PartitionKey(settings.TenantId)
);
string sessionToken = writeResponse.Headers.Session;
ItemResponse<UserSettings> readResponse = await otherContainer.ReadItemAsync<UserSettings>(
settings.Id,
new PartitionKey(settings.TenantId),
new ItemRequestOptions { SessionToken = sessionToken }
);
settings,
settings.Id,
new PartitionKey(settings.TenantId)
);
ItemResponse<UserSettings> readResponse = await otherContainer.ReadItemAsync<UserSettings>(
settings.Id,
new PartitionKey(settings.TenantId)
);
settings,
settings.Id,
new PartitionKey(settings.IsActive.ToString())
);
string sessionToken = writeResponse.Headers.Session;
ItemResponse<UserSettings> readResponse = await otherContainer.ReadItemAsync<UserSettings>(
settings.Id,
new PartitionKey(settings.IsActive.ToString()),
new ItemRequestOptions { SessionToken = sessionToken }
);
settings,
settings.Id
);
string sessionToken = writeResponse.Headers.Session;
ItemResponse<UserSettings> readResponse = await otherContainer.ReadItemAsync<UserSettings>(
settings.Id,
new ItemRequestOptions { SessionToken = sessionToken }
);
You are configuring a daemon application (App1) to call a custom Web API (API1) programmatically. Both applications are registered in Microsoft Entra ID. You need to configure API1 to expose an application permission, assign that permission to App1, and ensure App1 can successfully request an access token. Which four actions should you perform in sequence?
Drag items to arrange them in the correct order
You are deploying an Azure App Service web application that must retrieve a database connection string from an Azure Key Vault without modifying the application code. You plan to configure an application setting in App Service to reference the Key Vault secret directly. The secret is located at the URI: https://contosovault.vault.azure.net/secrets/dbconn/f3b890. Which syntax format must you use for the App Service application setting value to reference this secret?