Microsoft AZ-204 Practice Exams
Last updated on Nov 16,2026- Exam Code: AZ-204
- Exam Name: Developing Solutions for Microsoft Azure
- Certification Provider: Microsoft
- Latest update: Nov 16,2026
You are developing an online game that includes a feature that allows players to interact with other players on the same team within a certain distance. The calculation to determine the players in range occurs when players move and are cached in an Azure Cache for Redis instance.
The system should prioritize players based on how recently they have moved and should not prioritize players who have logged out of the game. You need to select an eviction policy.
Which eviction policy should you use?
- A . volatile-lru
- B . alllceys-lfu
- C . allkeys-lru
- D . volatile-ttl
You develop and deploy an ASP.NET Core application that connects o an Azure Database for MySQL instance.
Connections to the database appear to drop intermittently and the application code does not handle the connection failure.
You need to handle the transient connection errors in code by implementing retries.
What are three possible ways to achieve this goal? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
- A . Increase connection repeat attempts exponentially up to 120 seconds.
- B . Close the database connection and immediately report an error.
- C . Wait five seconds before repeating the connection attempt to the database.
- D . Disable connection pooling and configure a second Azure Database for MySQL instance.
- E . Set a maximum number of connection attempts to 10 and report an error on subsequent connections.
DRAG DROP
An organization has web apps hosted in Azure.
The organization wants to track events and telemetry data in the web apps by using Application Insights.
You need to configure the web apps for Application Insights.
Which three actions should you perform in sequence? To answer, move the appropnate actions from the list of actions to the answer area and arrange them in the correct order.

Explanation:
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You develop Azure solutions.
You must grant a virtual machine (VM) access to specific resource groups in Azure Resource Manager.
You need to obtain an Azure Resource Manager access token.
Solution: Run the Invoke-RestMethod cmdlet to make a request to the local managed identity for Azure resources endpoint.
Does the solution meet the goal?
- A . Yes
- B . No
A
Explanation:
Get an access token using the VM’s system-assigned managed identity and use it to call Azure Resource Manager
You will need to use PowerShell in this portion.
In the portal, navigate to Virtual Machines and go to your Windows virtual machine and in the Overview, click Connect.
Enter in your Username and Password for which you added when you created the Windows VM.
Now that you have created a Remote Desktop Connection with the virtual machine, open PowerShell in the remote session.
Using the Invoke-WebRequest cmdlet, make a request to the local managed identity for Azure resources endpoint to get an access token for Azure Resource Manager.
Example:
$response = Invoke-WebRequest -Uri
‘http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-
01&resource=https://management.azure.com/’ -Method GET -Headers @{Metadata="true"}
Reference: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-arm
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You develop Azure solutions.
You must grant a virtual machine (VM) access to specific resource groups in Azure Resource Manager.
You need to obtain an Azure Resource Manager access token.
Solution: Run the Invoke-RestMethod cmdlet to make a request to the local managed identity for Azure resources endpoint.
Does the solution meet the goal?
- A . Yes
- B . No
A
Explanation:
Get an access token using the VM’s system-assigned managed identity and use it to call Azure Resource Manager
You will need to use PowerShell in this portion.
In the portal, navigate to Virtual Machines and go to your Windows virtual machine and in the Overview, click Connect.
Enter in your Username and Password for which you added when you created the Windows VM.
Now that you have created a Remote Desktop Connection with the virtual machine, open PowerShell in the remote session.
Using the Invoke-WebRequest cmdlet, make a request to the local managed identity for Azure resources endpoint to get an access token for Azure Resource Manager.
Example:
$response = Invoke-WebRequest -Uri
‘http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-
01&resource=https://management.azure.com/’ -Method GET -Headers @{Metadata="true"}
Reference: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-arm
You need to ensure that all messages from Azure Event Grid are processed.
What should you use?
- A . Azure Event Grid topic
- B . Azure Service Bus topic
- C . Azure Service Bus queue
- D . Azure Storage queue
- E . Azure Logic App custom connector
D
Explanation:
As a solution architect/developer, you should consider using Service Bus queues when:
Your solution needs to receive messages without having to poll the queue. With Service Bus, you can achieve it by using a long-polling receive operation using the TCP-based protocols that Service Bus supports.
Reference: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted
You need to ensure that all messages from Azure Event Grid are processed.
What should you use?
- A . Azure Event Grid topic
- B . Azure Service Bus topic
- C . Azure Service Bus queue
- D . Azure Storage queue
- E . Azure Logic App custom connector
D
Explanation:
As a solution architect/developer, you should consider using Service Bus queues when:
Your solution needs to receive messages without having to poll the queue. With Service Bus, you can achieve it by using a long-polling receive operation using the TCP-based protocols that Service Bus supports.
Reference: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted
Your company has several containers based on the following operating systems:
• Windows Server 2019 Nano Server
• Windows Server 2019 Server Core
• Windows Server 2022 Nano Server
• Windows Server 2022 Server Core
• Linux
You plan to migrate the containers to an Azure Kubernetes cluster.
What is the minimum number of node pools that the cluster must have?
- A . 1
- B . 2
- C . 3
- D . 6
Your company has several containers based on the following operating systems:
• Windows Server 2019 Nano Server
• Windows Server 2019 Server Core
• Windows Server 2022 Nano Server
• Windows Server 2022 Server Core
• Linux
You plan to migrate the containers to an Azure Kubernetes cluster.
What is the minimum number of node pools that the cluster must have?
- A . 1
- B . 2
- C . 3
- D . 6
HOTSPOT
You need to implement the bindings for the CheckUserContent function.
How should you complete the code segment? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Explanation:
Box 1: [BlobTrigger(..)]
Box 2: [Blob(..)]
Azure Blob storage output binding for Azure Functions. The output binding allows you to modify and delete blob storage data in an Azure Function.
The attribute’s constructor takes the path to the blob and a FileAccess parameter indicating read or write, as shown in the following example:
[FunctionName("ResizeImage")]
public static void Run(
[BlobTrigger("sample-images/{name}")] Stream image,
[Blob("sample-images-md/{name}", FileAccess.Write)] Stream imageSmall)
{
…
}
Scenario: You must create an Azure Function named CheckUserContent to perform the content checks.
The company’s data science group built ContentAnalysisService which accepts user generated content as a string and returns a probable value for inappropriate content. Any values over a specific threshold must be reviewed by an employee of Contoso, Ltd.
Reference: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-output