AZ-204 Technology & Digital Applications 2 — Questions and Answers
Question 1: You need to store session state for an Azure App Service web app that scales across multiple instances. Which solution ensures consistent session data across all instances?
- Use Azure Cache for Redis as a distributed session provider (Correct answer)
- Enable ARR Affinity (sticky sessions) in App Service settings
- Store session data in the local file system of each instance
- Use Azure Table Storage with manual session key management
Correct answer: Use Azure Cache for Redis as a distributed session provider
Azure Cache for Redis provides a centralized, distributed session store that all App Service instances can share, ensuring session consistency without requiring sticky sessions.
Question 2: An Azure Function triggered by an HTTP request must call an external API and return the result. The external API sometimes takes 5+ minutes to respond. What should you do?
- Increase the function timeout in host.json to 10 minutes
- Implement the Durable Functions async HTTP API pattern with status polling (Correct answer)
- Use a Service Bus queue to decouple the request and poll for completion
- Switch the trigger to a Timer trigger that runs every minute
Correct answer: Implement the Durable Functions async HTTP API pattern with status polling
The Durable Functions async HTTP API pattern lets the caller receive a 202 Accepted with a status URL to poll, avoiding HTTP timeout limits on long-running operations.
Question 3: You are building a multi-tenant SaaS application on Azure. Each tenant's data must be completely isolated at the database level. Which Azure Cosmos DB feature best supports this?
- Use a single container with a partition key set to TenantId
- Create a separate Cosmos DB account per tenant
- Use a single container with row-level security policies
- Use multiple databases within one Cosmos DB account, one per tenant (Correct answer)
Correct answer: Use multiple databases within one Cosmos DB account, one per tenant
Multiple databases within one Cosmos DB account provide logical isolation per tenant while sharing the account's infrastructure, balancing isolation with cost efficiency.
Question 4: Your Azure API Management instance must transform an XML backend response into JSON before returning it to clients. Where should you apply this transformation?
- In the inbound policy of the API operation
- In the outbound policy of the API operation (Correct answer)
- In the backend policy of the API operation
- In the on-error policy of the API operation
Correct answer: In the outbound policy of the API operation
Outbound policies execute after the backend response is received, making them the correct place to transform the response before it reaches the client.
Question 5: You need to run a containerized batch job on Azure that processes data for exactly 30 minutes and then terminates. Which service is most appropriate?
- Azure Kubernetes Service with a CronJob
- Azure Container Instances with a restart policy of Never (Correct answer)
- Azure App Service with WebJobs
- Azure Functions with a Consumption plan
Correct answer: Azure Container Instances with a restart policy of Never
Azure Container Instances with a restart policy of Never will run the container once, allow it to run to completion, and not restart it — ideal for short-lived batch jobs.
Question 6: A developer needs to authenticate an Azure Function to access Azure Key Vault without storing credentials in code or configuration. What is the correct approach?
- Store the Key Vault access key in the function's application settings
- Enable a system-assigned managed identity on the Function App and grant it Key Vault access (Correct answer)
- Use a service principal with a certificate stored in the function's file system
- Use the Azure CLI to authenticate interactively at runtime
Correct answer: Enable a system-assigned managed identity on the Function App and grant it Key Vault access
A system-assigned managed identity eliminates the need to manage credentials; Azure AD handles authentication between the Function App and Key Vault automatically.
Question 7: You are using Azure Event Grid to route events from Azure Blob Storage to an Azure Function. Events are not arriving at the function. What should you check first?
- Verify the Event Grid subscription filter matches the blob event types and container name (Correct answer)
- Increase the function timeout setting in host.json
- Enable diagnostic logs on the function and check for HTTP 429 errors
- Confirm the Blob Storage account is in the same region as the function
Correct answer: Verify the Event Grid subscription filter matches the blob event types and container name
Incorrect or overly restrictive Event Grid subscription filters are the most common reason events do not reach the subscriber; verifying subject/event type filters is the first step.
You need to store session state for an Azure App Service web app that scales across multiple instances.
Which solution ensures consistent session data across all instances?