Courseiva

AZ-204 Practice Question: Connect to and consume Azure services and third-party services

You are designing a solution that reads messages from an Azure Service Bus queue and processes them using an Azure Function. The function must process messages in order and ensure no duplicate processing. Which configuration should you use?

⚠ Common exam trap

Test-takers frequently confuse partitioning (which provides ordering within a partition but not globally) with sessions (which provide strict FIFO ordering across all messages with the same session ID), leading them to incorrectly choose option B.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Enable sessions on the queue and use peek-lock mode with automatic complete on success

Enabling sessions on a Service Bus queue guarantees message ordering within a session, and using peek-lock mode with automatic complete ensures exactly-once processing by locking the message during processing and only completing it upon success. This combination prevents duplicate processing and maintains order, which is essential for sequential message handling in Azure Functions.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use auto-forwarding to a dead-letter queue on failure

    Why it's wrong here

    Using auto-forwarding to a dead-letter queue on failure is incorrect because auto-forwarding is a feature that automatically moves messages from one queue or topic to another *upon send*, not a mechanism for handling processing failures or guaranteeing message order during consumption. It does not provide any guarantees for exactly-once processing or message ordering within a consumer application, as it operates at the broker level for message routing rather than consumer-side error handling.

  • Partition the queue and use multiple functions to process each partition in order

    Why it's wrong here

    Partitioning the queue and using multiple functions to process each partition in order is incorrect because while partitions can improve throughput and maintain order *within* a single partition, they do not guarantee global message order across all partitions. If the solution requires that all messages, regardless of their partition, are processed in the exact sequence they were sent, then partitioning will break this global ordering guarantee, as messages from different partitions can be processed concurrently and out of sequence relative to each other.

  • Enable sessions on the queue and use peek-lock mode with automatic complete on success

    Why this is correct

    Enabling sessions on the queue and using peek-lock mode with automatic complete on success is the correct approach. Service Bus sessions ensure that all messages belonging to a specific session ID are processed sequentially by a single receiver, guaranteeing order for related messages. Peek-lock mode ensures reliable delivery by holding the message in the queue until it's explicitly completed or abandoned, preventing message loss if the processing function fails. Automatic completion, often handled by the Azure Functions runtime, ensures the message is removed only after successful processing, contributing to exactly-once semantics.

  • Use receive and delete mode to ensure each message is processed only once

    Why it's wrong here

    Using receive and delete mode to ensure each message is processed only once is incorrect because this mode offers 'at-most-once' delivery, not 'exactly-once' delivery. When a message is received in receive and delete mode, it is immediately removed from the queue. If the processing function fails or crashes *after* receiving the message but *before* successfully completing its work, the message is permanently lost and cannot be retried, violating the requirement for reliable processing and potential data integrity.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

Go deeper

Related to this question

About these practice questions

One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.