0
0
Azurecloud~30 mins

Event Grid subscriptions and filters in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Event Grid Subscriptions and Filters
📖 Scenario: You are setting up an Azure Event Grid system to handle events from a storage account. You want to create subscriptions that only receive specific types of events to reduce unnecessary processing.
🎯 Goal: Build an Azure Event Grid subscription with filters that only allow events of a certain type to be delivered to a webhook endpoint.
📋 What You'll Learn
Create a variable with the event subscription name
Add a filter configuration to allow only 'BlobCreated' events
Create the Event Grid subscription with the filter and endpoint
Complete the subscription configuration with the correct scope and destination
💡 Why This Matters
🌍 Real World
Filtering events in Azure Event Grid helps reduce unnecessary processing and costs by delivering only relevant events to subscribers.
💼 Career
Cloud engineers and architects often configure event-driven architectures using Event Grid subscriptions and filters to build scalable and efficient systems.
Progress0 / 4 steps
1
Create the event subscription name variable
Create a variable called event_subscription_name and set it to the string "storageBlobCreatedSubscription".
Azure
Need a hint?

Use a simple assignment statement to create the variable with the exact string value.

2
Add a filter configuration for event types
Create a dictionary called filter_config with a key included_event_types set to a list containing the string "Microsoft.Storage.BlobCreated".
Azure
Need a hint?

Use a dictionary with the key exactly as included_event_types and the value as a list with one string.

3
Create the Event Grid subscription configuration
Create a dictionary called event_subscription_config with keys name, destination, and filter. Set name to event_subscription_name, destination to a dictionary with endpoint_type set to "WebHook" and endpoint_url set to "https://mywebhook.example.com/api/events", and filter set to filter_config.
Azure
Need a hint?

Use nested dictionaries to represent the destination and include the filter dictionary as is.

4
Complete the subscription with scope and create command
Create a variable called scope and set it to the string "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount". Then create a dictionary called event_subscription_request with keys scope set to scope and properties set to event_subscription_config.
Azure
Need a hint?

Use the exact resource ID string for scope and nest the event_subscription_config under properties.