Azure Event Grid · AZ-204: Developing Solutions for Microsoft Azure Connect to and Consume Azure and Third-party Services

A storage account publishes BlobCreated events. An Azure Function should receive only events for .jpg files stored in the photos container. Which Azu…

Practice question from Azure Event Grid (AZ-204: Developing Solutions for Microsoft Azure Connect to and Consume Azure and Third-party Services), with the correct answer and a step-by-step solution.

medium · MCQ · Q-2912AD

A storage account publishes BlobCreated events. An Azure Function should receive only events for .jpg files stored in the photos container. Which Azure CLI command creates the most appropriate Event Grid subscription filters?

  1. A.az eventgrid event-subscription create --name photo-sub --source-resource-id <storage-resource-id> --endpoint <function-endpoint> --included-event-types BlobCreated --subject-begins-with "/blobServices/default/containers/photos/blobs/" --subject-ends-with ".jpg"Correct answer
  2. B.az eventgrid event-subscription create --name photo-sub --source-resource-id <storage-resource-id> --endpoint <function-endpoint> --included-event-types BlobDeleted --subject-begins-with "/blobServices/default/containers/photos/blobs/" --subject-ends-with ".jpg"
  3. C.az eventgrid event-subscription create --name photo-sub --source-resource-id <storage-resource-id> --endpoint <function-endpoint> --included-event-types BlobCreated --subject-begins-with "/blobServices/default/containers/documents/blobs/" --subject-ends-with ".jpg"
  4. D.az eventgrid event-subscription create --name photo-sub --source-resource-id <storage-resource-id> --endpoint <function-endpoint> --included-event-types BlobCreated --subject-begins-with "/blobServices/default/containers/photos/blobs/" --subject-ends-with ".png"

Solution

The included event type limits delivery to BlobCreated events. The subject prefix identifies the photos container, and the subject suffix limits matching blob names to the .jpg extension. Event Grid applies these subscription filters before delivering events to the handler.

More from Azure Event Grid

All of Azure Event Grid

Practise more Connect to and Consume Azure and Third-party Services

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed