AZ-204 Exam Questions

Total 271 Questions

Last Updated Exam : 15-Apr-2025

Topic 4, Misc. Questions

A company develops a series of mobile games. All games use a single leaderboard
service.
You have the following requirements:
•Code should be scalable and allow for growth.
•Each record must consist of a playedId, gameId, score, and time played.
•When users reach a new high score, the system will save the new score using the
SaveScore function below.
•Each game is assigned and Id based on the series title.
You have the following code. (Line numbers are included for reference only.)
You store customer information in an Azure Cosmos database. The following data already
exists in the database:






Box 1: Yes
Code for CosmosDB, example:
// Parse the connection string and return a reference to the storage account.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Retrieve a reference to the table.
CloudTable table = tableClient.GetTableReference("people");
// Create the TableOperation object that inserts the customer entity.
TableOperation insertOperation = TableOperation.Insert(customer1);
Box 2: No
A new record will always be added as TableOperation.Insert is used, instead of
TableOperation.InsertOrReplace.
Box 3: No
No partition key is used.
Box 4: Yes
References:
https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-dotnet

You are configuring a development environment for your team. You deploy the latest Visual
Studio image from the Azure Marketplace to your Azure subscription.
The development environment requires several software development kits (SDKs) and
third-party components to support application development across the organization. You
install and customize the deployed virtual machine (VM) for your development team. The customized VM must be saved to allow provisioning of a new team member development
environment.
You need to save the customized VM for future provisioning.
Which tools or services should you use? To answer, select the appropriate options in the
answer area.
NOTE: Each correct selection is worth one point.






Box 1: Azure Powershell
Creating an image directly from the VM ensures that the image includes all of the disks
associated with the VM, including the OS disk and any data disks.
Before you begin, make sure that you have the latest version of the Azure PowerShell
module.
You use Sysprep to generalize the virtual machine, then use Azure PowerShell to create
the image.
Box 2: Azure Blob Storage
References:
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-imageresource#
create-an-image-of-a-vm-using-powershell

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: Use the Reader role-based access control (RBAC) role to authenticate the VM
with Azure Resource Manager.
Does the solution meet the goal?

 


A.

Yes


B.

No





B.
  

No



Contoso, Ltd. provides an API to customers by using Azure API Management (APIM). The
API authorizes users with a JWT token.

You must implement response caching for the APIM gateway. The caching mechanism
must detect the user ID of the client that accesses data for a given location and cache the
response for that user ID.
You need to add the following policies to the policies file:
• a set-variable policy to store the detected user identity
• a cache-lookup-value policy
• a cache-store-value policy
• a find-and-replace policy to update the response body with the user profile information
To which policy section should you add the policies? To answer, drag the appropriate
sections to the correct policies. Each section may be used once, more than once, or not at
all. You may need to drag the split bar between panes or scroll to view content
NOTE: Each correct selection is worth one point






C:\Users\wk\Desktop\mudassar\Untitled.jpg
Box 1: Inbound.
A set-variable policy to store the detected user identity.
Example:
<policies>
<inbound>
<!- How you determine user identity is application dependent ->
<set-variable
name="enduserid"
value="@(context.Request.Headers.GetValueOrDefault("Authorization","").Split('
')[1].AsJwt()?.Subject)" />
Box 2: Inbound
A cache-lookup-value policy
Example:
<inbound>
<base />
<cache-lookup vary-by-developer="true | false" vary-by-developer-groups="true | false"
downstream-caching-type="none | private | public" must-revalidate="true | false">
<vary-by-query-parameter>parameter name</vary-by-query-parameter> <!- optional, can
repeated several times ->
</cache-lookup>
</inbound>

Box 3: Outbound
A cache-store-value policy.
Example:
<outbound>
<base />
<cache-store duration="3600" />
</outbound>
Box 4: Outbound
A find-and-replace policy to update the response body with the user profile information.
Example:
<outbound>
<!- Update response body with user profile->
<find-and-replace
from='"$userprofile$"'
to="@((string)context.Variables["userprofile"])" />
<base />
</outbound>

You develop a news and blog content delivery app for Windows devices.
A notification must arrive on a user's device when there is a new article available for them
to view.
You need to implement push notifications.
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.






Box 1: NotificationHubClient
Box 2: NotificationHubClient
Box 3: CreateClientFromConnectionString
// Initialize the Notification Hub
NotificationHubClient hub =
NotificationHubClient.CreateClientFromConnectionString(listenConnString, hubName);
Box 4: SendWindowsNativeNotificationAsync
Send the push notification.
var result = await hub.SendWindowsNativeNotificationAsync(windowsToastPayload);
References:
https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notificationregistration-
management
https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/app-service-mobile/appservice-
mobile-windows-store-dotnet-get-started-push.md

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 question, you will NOT be able to return to it. As a
result, these questions will not appear in the review screen.
You are developing a solution that will be deployed to an Azure Kubernetes Service (AKS)
cluster. The solution will include a custom VNet, Azure Container Registry images, and an
Azure Storage account.

The solution must allow dynamic creation and management of all Azure resources within
the AKS cluster.
You need to configure an AKS cluster for use with the Azure APIs.
Solution: Create an AKS cluster that supports network policy. Create and apply a network
to allow traffic only from within a defined namespace.
Does the solution meet the goal?

 


A.

Yes


B.

No





A.
  

Yes



When you run modern, microservices-based applications in Kubernetes, you often want to
control which components can communicate with each other. The principle of least
privilege should be applied to how traffic can flow between pods in an Azure Kubernetes
Service (AKS) cluster. Let's say you likely want to block traffic directly to back-end
applications. The Network Policy feature in Kubernetes lets you define rules for ingress and
egress traffic between pods in a cluster.
References:
https://docs.microsoft.com/en-us/azure/aks/use-network-policies

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.
Margie’s Travel is an international travel and bookings management service. The company
is expanding into restaurant bookings. You are tasked with implementing Azure Search for
the restaurants listed in their solution
You create the index in Azure Search.
You need to import the restaurant data into the Azure Search service by using the Azure
Search NET SDK.
Solution:
1 Create a SearchlndexClient object to connect to the search index
2. Create an IndexBatch that contains the documents which must be added.
3. Call the Documents.Index method of the SearchIndexClient and pass the IndexBatch.
.
Does the solution meet the goal?


A.

Yes


B.

No





A.
  

Yes



1. The index needs to be populated. To do this, we will need a SearchIndexClient. There
are two ways to obtain one: by constructing it, or by calling Indexes.GetClient on the
SearchServiceClient. Here we will use the first method.
2. Create the indexBatch with the documents
Something like:
var hotels = new Hotel[];
{
new Hotel()
{
HotelId = "3",
BaseRate = 129.99,
Description = "Close to town hall and the river"
}
};

var batch = IndexBatch.Upload(hotels);
3. The next step is to populate the newly-created index
Example:
var batch = IndexBatch.Upload(hotels);
try
{
indexClient.Documents.Index(batch);
}
References:
https://docs.microsoft.com/en-us/azure/search/search-howto-dotnet-sdk

You develop and deploy a Java RESTful API to Azure App Service.
You open a browser and navigate to the URL for the API. You receive the following error
message:

You need to resolve the error.
What should you do?


A.

Bind an SSL certificate


B.

Enable authentication


C.

Enable CORS


D.

Map a custom domain


E.

Add a CDN





C.
  

Enable CORS



We need to enable Cross-Origin Resource Sharing (CORS).
References:
https://medium.com/@xinganwang/a-practical-guide-to-cors-51e8fd329a1f

You are developing an application to use Azure Blob storage. You have configured Azure
Blob storage to include change feeds.
A copy of your storage account must be created in another region. Data must be copied
from the current storage account to the new storage account directly between the storage
servers.
You need to create a copy of the storage account in another region and copy the data.
In which order should you perform the actions? To answer, move all actions from the list of
actions to the answer area and arrange them in the correct order.






You are developing a Java application that uses Cassandra to store key and value data.
You plan to use a new Azure Cosmos DB resource and the Cassandra API in the
application. You create an Azure Active Directory (Azure AD) group named Cosmos DB
Creators to enable provisioning of Azure Cosmos accounts, databases, and containers.
The Azure AD group must not be able to access the keys that are required to access the
data.
You need to restrict access to the Azure AD group.
Which role-based access control should you use?


A.

DocumentDB Accounts Contributor


B.

Cosmos Backup Operator


C.

Cosmos DB Operator


D.

Cosmos DB Account Reader





C.
  

Cosmos DB Operator



Explanation:
Azure Cosmos DB now provides a new RBAC role, Cosmos DB Operator. This new role
lets you provision Azure Cosmos accounts, databases, and containers, but can’t access
the keys that are required to access the data. This role is intended for use in scenarios
where the ability to grant access to Azure Active Directory service principals to manage
deployment operations for Cosmos DB is needed, including the account, database, and
containers.
Reference:
https://azure.microsoft.com/en-us/updates/azure-cosmos-db-operator-role-for-role-basedaccess-
control-rbac-is-now-available/


Page 9 out of 28 Pages
Previous