Connect to and consume Azure services and third-party services →mediumMultiple ChoiceObjective-mapped
AZ-204 Practice Question: Connect to and consume Azure services and third-party services
You have an Azure Event Grid topic that receives storage blob created events. You only want to process events for files with a '.jpg' extension. You need to minimize cost and latency. How should you filter the events?
⚠ Common exam trap
Many candidates assume filtering in code is simpler or more flexible, but they overlook that Event Grid's built-in subject filtering is the most cost-effective and low-latency approach because it prevents unwanted events from ever reaching the function endpoint.
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
✓
Configure a subject filter in the Event Grid subscription with suffix '.jpg'
Event Grid subscriptions support subject filtering with prefix and suffix matching, allowing you to filter events at the Event Grid service level before they are delivered to your endpoint. By configuring a subject filter with suffix '.jpg', only blob created events for files ending in '.jpg' are sent to your Azure Function, minimizing both cost (fewer invocations) and latency (no unnecessary processing). This approach avoids the overhead of receiving and discarding unwanted events in your function code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Configure a subject filter in the Event Grid subscription with suffix '.jpg'
Why this is correct
Event Grid subscriptions support robust server-side filtering capabilities, including subject suffix matching. By configuring a `subjectEndsWith` filter with '.jpg', only events where the blob name (which forms part of the event subject for Storage events) ends with '.jpg' will be delivered to the subscriber. This significantly reduces the volume of events processed by the Azure Function, optimizing compute costs and minimizing unnecessary invocations and associated latency.
- ✗
Filter inside the Azure Function code by checking the blob name extension
Why it's wrong here
Filtering within the Azure Function code means the function is invoked for *every* blob event published to the topic, regardless of its relevance. Each invocation consumes compute resources, incurs billing costs for execution time and memory, and adds latency for events that are ultimately discarded by the function's internal logic. This approach negates the efficiency benefits of Event Grid's serverless event routing and leads to wasteful resource utilization.
- ✗
Use Azure Service Bus topics instead of Event Grid, with a filter on message properties
Why it's wrong here
Using Service Bus topics introduces a brokered messaging layer with inherent queuing and ordered delivery, which adds latency and cost compared to Event Grid’s push-based, serverless event routing. The requirement to minimise both latency and cost makes Event Grid’s native event filtering on subject or event type the correct mechanism. This option is tempting because Service Bus topics do support advanced SQL-based message property filters, which would be a valid choice if the scenario required complex, multi-condition filtering or guaranteed ordered processing.
- ✗
Create separate Event Grid topics for JPEG files and route only JPEG events
Why it's wrong here
Creating separate Event Grid topics for different file types introduces unnecessary architectural complexity and management overhead. Each topic requires individual provisioning, configuration, and monitoring, increasing the operational burden and potential for misconfiguration. Event Grid's built-in subscription filtering mechanism is specifically designed to handle such routing requirements efficiently within a single topic, making multiple topics redundant and less maintainable for this scenario.
Go deeper
Related to this question
About these practice questions
This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.