Microsoft

AZ-204 Free Practice Questions — Page 18

Question 179

You are updating an application that stores data on Azure and uses Azure Cosmos DB for storage. The application stores data in multiple documents associated with a single username. The application requires the ability to update multiple documents for a username in a single ACID operation. You need to configure Azure Cosmos DB. Which two actions should you perform? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.

A. Create a collection sharded on username to store documents.
B. Configure Azure Cosmos DB to use the Gremlin API.
C. Create an unsharded collection to store documents.
D. Configure Azure Cosmos DB to use the MongoDB API.
Show Answer
Correct Answer: C, D
Explanation:
The requirement is to update multiple documents for a single username in one ACID operation. In Azure Cosmos DB, multi-document ACID transactions are supported only when using the MongoDB API, and only within an unsharded (single-partition) collection. Creating an unsharded collection ensures all documents are in the same logical partition, which is required for a single atomic transaction. Other APIs or sharded collections do not support cross-partition ACID transactions.

Question 180

HOTSPOT - You implement an Azure solution to include Azure Cosmos DB, the latest Azure Cosmos DB SDK, and the Core (SQL) API. You also implement a change feed processor on a new container instance by using the Azure Functions trigger for Azure Cosmos DB. A large batch of documents continues to fail when reading one of the documents in the batch. The same batch of documents is continuously retried by the triggered function and a new batch of documents must be read. You need to implement the change feed processor to read the documents. Which feature should you implement? To answer, select the appropriate features in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-204 question 180
Show Answer
Correct Answer: Change feed estimator Dead-letter queue
Explanation:
To continue processing new batches while tracking a failing batch, use the change feed estimator to monitor progress and lag across the change feed. To handle repeated failures without blocking processing, persist failed documents to a dead-letter queue so the processor can move on and errors can be remediated separately.

Question 181

HOTSPOT - You are developing an application that monitors data added to an Azure Blob storage account. You need to process each change made to the storage account. 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.

Illustration for AZ-204 question 181
Show Answer
Correct Answer: GetChanges(x).AsPages() ContinuationToken
Explanation:
The change feed must be read page by page to process all events and resume processing. GetChanges(x).AsPages() returns pageable results that support continuation. The ContinuationToken from each page is stored and reused to continue reading subsequent changes.

Question 182

You are developing an application to store business-critical data in Azure Blob storage. The application must meet the following requirements: • Data must not be modified or deleted for a user-specified interval. • Data must be protected from overwrites and deletes. • Data must be written once and allowed to be read many times. You need to protect the data in the Azure Blob storage account. Which two actions should you perform? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.

A. Configure a time-based retention policy for the storage account.
B. Create an account shared-access signature (SAS).
C. Enable the blob change feed for the storage account.
D. Enable version-level immutability support for the storage account.
E. Enable point-in-time restore for containers in the storage account.
F. Create a service shared-access signature (SAS).
Show Answer
Correct Answer: A, D
Explanation:
The requirements describe Write-Once, Read-Many (WORM) protection: data cannot be modified or deleted for a specified interval and must be protected from overwrites and deletes. A time-based retention policy enforces WORM by preventing modification and deletion for a user-defined period. To apply immutability at the blob/version level, the storage account must have version-level immutability support enabled, which is required to enforce immutable retention on blob versions.

Question 184

You develop Azure Web Apps for a commercial diving company. Regulations require that all divers fill out a health questionnaire every 15 days after each diving job starts. You need to configure the Azure Web Apps so that the instance count scales up when divers are filling out the questionnaire and scales down after they are complete. You need to configure autoscaling. What are two possible auto scaling configurations to achieve this goal? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point.

A. Recurrence profile
B. CPU usage-based autoscaling
C. Fixed date profile
D. Predictive autoscaling
Show Answer
Correct Answer: B, D
Explanation:
The requirement is to scale based on actual load when many divers are filling out questionnaires, which can occur at varying times. CPU usage-based autoscaling reacts directly to increased application load and scales down when demand drops. Predictive autoscaling can also be used to anticipate recurring usage patterns based on historical data and scale out ahead of demand. Recurrence and fixed-date profiles rely on predefined schedules and are not suitable because questionnaire completion does not occur on a single shared schedule.

Question 185

You develop Azure Durable Functions to manage vehicle loans. The loan process includes multiple actions that must be run in a specified order. One of the actions includes a customer credit check process, which may require multiple days to process. You need to implement Azure Durable Functions for the loan process. Which Azure Durable Functions type should you use?

A. orchestrator
B. client
C. entity
D. activity
Show Answer
Correct Answer: A
Explanation:
An orchestrator function is used to define and control the workflow of a Durable Functions application, including running actions in a specified order and handling long-running processes that can span days. The loan process requires coordination of multiple steps and waiting for a long-running credit check, which is exactly the responsibility of an orchestrator. Activity functions perform individual tasks, client functions start orchestrations, and entity functions manage shared state, none of which fit the overall workflow requirement.

Question 186

You develop Azure solutions. You must connect to a No-SQL globally-distributed database by using the .NET API. You need to create an object to configure and execute requests in the database. Which code segment should you use?

A. database_name = 'MyDatabase' database = client.create_database_if_not_exists(id=database_name)
B. client = CosmosClient(endpoint, key)
C. container_name = 'MyContainer' container = database.create_container_if_not_exists( id=container_name, partition_key=PartitionKey(path="/lastName"), offer_throughput=400 )
Show Answer
Correct Answer: B
Explanation:
To configure and execute requests against an Azure Cosmos DB NoSQL database using the .NET API, you must first create a CosmosClient object. CosmosClient is the primary entry point for the SDK and is required before you can create or access databases and containers or execute any requests. Options A and C depend on an existing CosmosClient instance and therefore cannot be used first.

Question 188

HOTSPOT - You are developing an Azure Function app. All functions in the app meet the following requirements: • Run until either a successful run or until 10 run attempts occur. • Ensure that there are at least 20 seconds between attempts for up to 15 minutes. You need to configure the host.json file. 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.

Illustration for AZ-204 question 188
Show Answer
Correct Answer: retry exponentialBackoff maxRetryCount
Explanation:
Use the host.json retry configuration. The requirement is up to 10 attempts with at least 20 seconds between retries and a cap of 15 minutes. The exponentialBackoff strategy supports minimumInterval (20s) and maximumInterval (15m), while maxRetryCount limits attempts to 10.

Question 189

HOTSPOT - You are developing a service where customers can report news events from a browser using Azure Web PubSub. The service is implemented as an Azure Function App that uses the JSON WebSocket subprotocol to receive news events. You need to implement the bindings for the Azure Function App. How should you configure the binding? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-204 question 189
Show Answer
Correct Answer: type: webPubSubTrigger eventType: user
Explanation:
Azure Functions receiving messages from Azure Web PubSub must use the webPubSubTrigger binding. When customers send events from the browser using the JSON WebSocket subprotocol, the event is classified as a user event, so eventType must be set to user. The eventName "message" matches user-sent messages.

Question 190

HOTSPOT - You are authoring a set of nested Azure Resource Manager templates to deploy Azure resources. You author an Azure Resource Manager template named mainTemplate.json that contains the following linked templates: linkedTemplate1.json, linkedTemplate2.json. You add parameters to a parameters template file named mainTemplate.parameters,json. You save all templates on a local device in the C:\templates\ folder. You have the following requirements: • Store the templates in Azure for later deployment. • Enable versioning of the templates. • Manage access to the templates by using Azure RBAC. • Ensure that users have read-only access to the templates. • Allow users to deploy the templates. You need to store the templates in Azure. How should you complete the command? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-204 question 190
Show Answer
Correct Answer: az ts create --template-file "mainTemplate.json"
Explanation:
Template Specs store ARM templates in Azure with versioning and RBAC. The az ts create command creates a Template Spec, and the template-file must point to the main template that links the nested templates.

$19

Get all 447 questions with detailed answers and explanations

  • Instant download HTML + PDF delivered the moment payment clears.
  • Secure Stripe checkout we never see or store your card details.
  • 7-day refund if files are defective see our refund policy.