Event Grid in Azure: The Doorbell and Notice Board for Event-Driven Applications
An intermediate, plain-English guide to Azure Event Grid — how events are announced, filtered and delivered to the right handlers, how retries and dead-lettering protect you from failure, how the newer namespace features add pull delivery and an MQTT broker, and how to secure, monitor and pay for it sensibly.
Picture a large office building. When a parcel arrives at the front desk, nobody walks from floor to floor asking whether it is theirs. Instead the desk rings a bell or posts a note, and each team that cares about parcels, such as the post room, the finance team and the person who ordered it, reacts in its own way. The desk does not need to know who is listening, and the listeners do not need to keep checking the desk. Azure Event Grid works in exactly this way for software: something happens, a short announcement is made, and everyone who has signed up to hear about it is told promptly.
In this guide we will go step by step through what the service is, how its parts fit together, how a single event travels from its source to its handlers, how filtering, retries and dead-lettering keep the system dependable, and how the newer namespace capabilities extend the service beyond its original design. We will also be clear about how Event Grid differs from its neighbours, Service Bus and Event Hubs, because choosing the wrong one is the most common design mistake.
1What Event Grid Is and Why It Exists
Stop asking “has anything changed yet?” and start being told when it does.
Applications constantly need to react to things that happen elsewhere. A file lands in storage and must be scanned. A virtual machine is created and must be tagged. An order is placed and several systems must hear about it. The simplest way to notice such changes is polling: a program repeatedly asks “anything new?” every few seconds. Polling works, but it is wasteful, because most checks find nothing, and slow, because changes are only noticed at the next check.
Azure Event Grid replaces polling with a push approach. It is a fully managed event routing service. Event sources, such as Azure services or your own applications, publish small notifications called events. Event Grid receives them and delivers each one to every interested handler, such as a function, a workflow, a queue or a web address. You write code only for what should happen in response, not for the plumbing that notices the change and carries the news.
This style is called event-driven architecture. Components stay loosely connected: a publisher does not know who will react, and a handler does not know who raised the event. New reactions can be added without touching the publisher at all.
Think of a newspaper stand compared with a town crier. Polling is you walking to the stand every five minutes to see if a new edition has arrived. Event Grid is a delivery round that drops the paper on your doorstep the moment it is printed, only for the sections you subscribed to.
What makes it special
Event Grid is designed for reactive, near-real-time notifications at very large scale, with pricing based on the number of operations rather than reserved capacity. It has built-in support for events from many Azure services, so in many cases you can react to something happening in Azure without writing any publishing code at all.
2The Big Picture: Events, Messages and the Azure Messaging Family
Choosing between Event Grid, Service Bus and Event Hubs starts with one question: what are you actually sending?
Azure offers several messaging services that sound similar. They solve different problems, and the key is to understand the difference between an event and a message.
Event
A light notification that something happened, such as “a file was created”. The sender does not care what the receiver does and does not expect a particular result.
Message
A piece of data with intent, such as “process this payment”. The sender expects it to be handled, and delivery guarantees and ordering often matter a great deal.
Discrete events
Individual happenings that each trigger a reaction. Event Grid is built for these.
Event streams
Continuous flows of many readings, such as telemetry, that are analysed in bulk. Event Hubs is built for these.
| Service | Best at | Typical example |
|---|---|---|
| Event Grid | Reacting to discrete events and routing them to many handlers, with filtering | A new file in storage triggers image processing and a notification |
| Service Bus | Reliable enterprise messaging with queues, topics, ordering, sessions and transactions | Order processing where each order must be handled exactly as intended |
| Event Hubs | Ingesting huge streams of telemetry and logs for analysis | Millions of sensor readings per second flowing into analytics |
flowchart TD
A["What are you sending?"] --> B{"Something happened, tell interested parties?"}
B -->|"Yes, discrete notifications"| EG["Event Grid"]
A --> C{"A command or work item that must be processed reliably?"}
C -->|"Yes, with ordering, sessions or transactions"| SB["Service Bus"]
A --> D{"A continuous high-volume stream of data?"}
D -->|"Yes, telemetry or logs"| EH["Event Hubs"]
EG -.->|"Often combined"| SB
EG -.->|"Often combined"| EH
An event is like a doorbell: it only says someone is there. A message is like a letter with instructions you are expected to act on. A stream is like a river of water readings you measure over time. Different tools suit each.
These services are often combined. Event Grid can announce that something happened and deliver the notification into a Service Bus queue or an Event Hub, where the heavier processing happens. Do not think of them as rivals.
3Core Concepts You Must Know
A short vocabulary unlocks every portal screen and every design discussion.
Event Grid has a compact set of terms. Learn them once and the documentation becomes straightforward to follow.
Event
The smallest unit: a record of something that happened, containing details such as what occurred, when and about which resource.
Event source
Where the event originates, such as a storage account, a resource group or your own application.
Topic
The endpoint where a source sends events. Subscribers attach to topics to receive them.
System topic
A topic that represents events published by an Azure service, created for you or by you with no publishing code needed.
Custom topic
A topic you create so your own applications can publish their own events.
Domain
A management container for a large number of related topics, useful for multitenant solutions with one topic per customer.
Partner topic
A topic that receives events from a third-party event publisher, such as a software-as-a-service provider integrated with Azure.
Event subscription
A rule that tells Event Grid which events to deliver and where to send them.
Event handler
The destination that reacts: a function, a workflow, a queue, a hub or a web address.
Filter
Conditions on type, subject or data that decide whether a subscription receives a particular event.
Dead-letter destination
A storage location where events that could not be delivered are kept for later inspection.
Namespace
A newer container that groups topics and adds features such as pull delivery and an MQTT broker for device messaging.
A topic is like a radio channel. The broadcaster, which is the event source, transmits on it. An event subscription is your decision to tune in and only keep programmes about the weather. The handler is you, reacting when the weather report comes on.
Many people think the event contains all the data. Usually it carries a small description, such as which file was created and where it is stored, not the file itself. The handler fetches the actual data if it needs it.
4Architecture and Components
Publishers on one side, handlers on the other, and a routing layer in between.
Event Grid sits between event sources and event handlers. It is managed entirely by Azure, so there are no servers, brokers or clusters to run. Your responsibility is to define topics, subscriptions, filters and handlers.
flowchart LR
S1["Azure service events"] --> T1["System topic"]
S2["Your application"] --> T2["Custom topic"]
S3["Partner service"] --> T3["Partner topic"]
T1 --> E1["Event subscription with filter"]
T2 --> E2["Event subscription with filter"]
T2 --> E3["Event subscription with filter"]
T3 --> E4["Event subscription with filter"]
E1 --> H1["Azure Function"]
E2 --> H2["Logic App workflow"]
E3 --> H3["Service Bus queue"]
E4 --> H4["Webhook endpoint"]
| Component | Responsibility | Who operates it |
|---|---|---|
| Event sources | Produce events when something happens | Azure services, your applications or partners |
| Topics | Receive events and make them available to subscriptions | Azure hosts, you define |
| Event subscriptions | Define filters, destination, retry and dead-letter behaviour | You configure |
| Routing and delivery engine | Matches events to subscriptions, delivers, retries and records failures | Azure |
| Event handlers | React to events with your logic | You build, Azure may host |
| Dead-letter storage | Holds undeliverable events | You provide a storage account |
Two flavours inside the service
Event Grid today offers two related feature sets. The original one, often described as the Basic tier, uses push delivery and covers system topics, custom topics, domains and partner topics. The newer one, based on namespaces, offers namespace topics with both push and pull delivery and a built-in broker for the MQTT messaging protocol, which suits devices. Understanding which features belong to which helps you choose and avoids looking for a capability in the wrong place.
Basic: topics and domains
- Native events from many Azure services
- Push delivery to handlers
- Simple, pay-per-operation pricing
- Mature and widely used
Namespaces
- Pull delivery where the consumer controls the pace
- MQTT broker for devices and publish-subscribe messaging
- Capacity measured in throughput units
- Newer, with features still arriving, some in preview
Before designing around a feature, confirm which tier supports it and whether it is generally available or in preview. The documentation’s what’s-new page lists recent changes by month.
5Internal Working: The Life of One Event
From something happening to a handler reacting.
Following one event from start to finish shows how delivery, validation and retries fit together. The sequence below uses a push delivery to a web-based handler.
sequenceDiagram
participant Src as Event source
participant Topic as Topic
participant EG as Event Grid delivery engine
participant H as Event handler
Note over EG,H: Subscription creation: handshake proves the endpoint is expected
Src->>Topic: Publish event
Topic->>EG: Match against subscriptions and filters
EG->>H: Deliver event over HTTPS
alt Handler accepts
H-->>EG: Success response
EG->>EG: Mark delivered
else Handler fails or times out
H-->>EG: Error or no response
EG->>EG: Wait and retry with growing delay
EG->>H: Deliver again
end
Something happens
A file is created, a resource changes or your application raises an event. The source sends a small description of it to a topic.
The topic accepts the event
For system topics, the Azure service publishes automatically. For custom topics, your application posts events using an access key or an identity.
Subscriptions are matched
Event Grid checks each subscription’s filters. Only subscriptions whose conditions match will receive this event.
The event is delivered
For each matching subscription, Event Grid sends the event to the handler. Multiple subscriptions each get their own copy, which is how fan-out works.
Success or retry
If the handler confirms success, delivery is complete. If not, Event Grid retries according to the retry policy.
Expiry and dead-lettering
When retries are exhausted or the event is too old, it is dropped or, if configured, written to dead-letter storage for later review.
The validation handshake
When you create a subscription that delivers to a web address, Event Grid first needs to know that the owner of that address really wants the events. It sends a special validation request, and the endpoint must respond correctly. This prevents someone from flooding a stranger’s endpoint with events. Azure-native handlers such as functions and queues are validated automatically, so this step mostly matters for custom web endpoints.
Respond to events quickly and do heavy work elsewhere. A handler that takes too long looks like a failure and triggers retries. Accept the event, hand the real work to a queue or background process and return success fast.
6Event Sources and System Topics
Many Azure services already speak Event Grid fluently.
One of the best features of Event Grid is that many Azure services publish events without any extra code. You simply create a subscription and start reacting. These are exposed through system topics.
Examples of what services announce
Blob storage
Events when a blob is created or deleted. A very common use is to trigger processing, such as scanning, resizing or indexing, whenever a file lands in a container.
Resource groups and subscriptions
Events about resource creation, modification and deletion, which enable automatic tagging, compliance checks and audit notifications.
Messaging and data services
Services such as Service Bus, Event Hubs and Azure Container Registry announce useful happenings, such as messages waiting without a listener or a new image pushed.
App and device services
App Service, IoT Hub, Key Vault, Machine Learning and many others emit events about their state, such as a certificate nearing expiry or a model being registered.
Your own applications
For your own business events, such as “order shipped” or “invoice approved”, you create a custom topic and publish to it. Choose clear event type names and consistent structures so that handlers written by different teams can rely on them.
System topics are like the built-in alarms in a building, such as smoke detectors that come with the fire system. Custom topics are the extra buttons you install yourself, such as a button in the kitchen that tells the café staff the lunch order is ready.
Each service documents the exact events it publishes and the structure of their data. Check the current reference for the service you use, since events and properties are added over time and some services publish only a subset.
7Event Handlers and Delivery Styles
Where events go, and who controls the pace.
A subscription must say where to deliver. Event Grid supports a rich set of destinations, and the choice shapes how your solution behaves under load and failure.
Azure Functions
The most popular handler. Serverless code runs only when events arrive, and scales with the volume.
Logic Apps
Low-code workflows that connect to hundreds of services, ideal for notifications and business processes.
Service Bus and Storage queues
Buffer events for reliable, paced processing by workers.
Event Hubs
Pass events into a streaming pipeline for analytics.
Webhooks
Any secure web address, including your own services or external systems.
Automation and other Azure handlers
Runbooks and other supported destinations for operational tasks.
Push versus pull
Traditionally Event Grid pushes events to handlers: it calls your endpoint when events arrive. This is simple and fast but means your handler must be ready to accept whatever arrives. Namespace topics add pull delivery, where your consumer asks for events when it is ready, processes them and confirms or rejects them. Pull gives the consumer control over pace, which suits workers behind firewalls or systems that need to smooth out bursts.
| Aspect | Push delivery | Pull delivery |
|---|---|---|
| Who starts the call | Event Grid calls the handler | The consumer calls Event Grid |
| Pace control | Mostly the service, with retry rules | The consumer chooses when and how many |
| Network direction | Handler must be reachable by Event Grid | Consumer only needs outbound access |
| Best for | Quick reactions with serverless handlers | Controlled processing, private consumers and bursty loads |
Push is like a courier ringing your doorbell whenever a parcel arrives, whether or not you are ready. Pull is like collecting parcels from a locker when it suits you. Both deliver the parcel; they differ in who decides the moment.
When a downstream system is slow or fragile, deliver events into a queue first and let workers drain it at a safe rate. This turns spikes into a steady flow.
8Filtering and Routing
Handlers should receive what they need, and nothing more.
A topic may carry thousands of events per minute of many kinds. A given handler usually cares about only a small slice. Filtering at the subscription level lets Event Grid do the sorting, so your code is not woken up for irrelevant events and you do not pay for needless executions.
Event type
Receive only certain kinds of events, such as blob created but not blob deleted.
Subject prefix and suffix
Match on the beginning or end of the subject, for example only files in a specific folder or only files ending in a certain extension.
Advanced filters
Compare values in the event data using operators such as equals, one of, numeric ranges and string matches, so routing can depend on content.
Multiple subscriptions
Create many subscriptions on one topic, each with different filters and destinations, to route events to different handlers.
flowchart TD
U["Blob created events in storage account"] --> T["System topic"]
T --> F1{"Subject starts with images/ and ends with .jpg?"}
T --> F2{"Subject starts with invoices/ ?"}
T --> F3{"Event data size above a threshold?"}
F1 -->|"Match"| H1["Image resize function"]
F2 -->|"Match"| H2["Invoice processing workflow"]
F3 -->|"Match"| H3["Large file alert to Service Bus"]
Design tip: make subjects meaningful
For your own events, design the subject like a path that goes from general to specific, such as region, then department, then item. This lets subscribers filter by prefix and suffix cheaply, without inspecting the data.
Filters are like the sorting rules at a post office. Letters for one postcode go into one bag, parcels over a certain weight go on a different conveyor, and international mail goes elsewhere. The sorting is done before delivery, so each van carries only what it should.
There are documented limits on the number and complexity of filters per subscription. Plan your event design so most routing can use type and subject, and reserve advanced filters for cases that truly need them.
9Reliability: Retries, Dead-lettering and Duplicates
Networks fail and handlers crash. A good design expects both.
Event Grid provides at-least-once delivery. That means it tries hard to make sure every event reaches every matching handler, and in rare cases an event may be delivered more than once. It does not promise that events arrive in the order they were published. Understanding these two facts shapes how you write handlers.
Retry behaviour
If delivery fails, because the handler returns an error, times out or cannot be reached, Event Grid waits and tries again, increasing the delay between attempts. You can configure the maximum number of attempts and how long an event stays eligible for delivery. Some errors, such as a clearly invalid endpoint or authorisation failure, are treated as permanent and may not be retried.
flowchart TD
A["Event ready for delivery"] --> B["Send to handler"]
B --> C{"Handler responded with success?"}
C -->|"Yes"| D["Delivered, event complete"]
C -->|"No"| E{"Retries left and event not expired?"}
E -->|"Yes"| F["Wait with increasing delay"]
F --> B
E -->|"No"| G{"Dead-letter destination configured?"}
G -->|"Yes"| H["Write event to dead-letter storage"]
G -->|"No"| I["Event dropped"]
Dead-lettering
A dead-letter destination is a storage container where Event Grid writes events it could not deliver, along with the reason. Without it, such events vanish after retries are exhausted. With it, you can inspect failures, fix the handler and replay the events. Configure it for any subscription whose events matter.
Writing handlers that survive reality
Be idempotent
Handling the same event twice should produce the same result as handling it once. Use the event identifier to detect duplicates, or design actions so repeats are harmless.
Do not depend on order
If order matters, include a sequence number or timestamp in the event, or use a service that guarantees order, such as Service Bus sessions, downstream.
Return the right response quickly
Signal success only when you have safely taken responsibility for the event, for example after writing it to a queue.
Think of a courier who rings the bell, waits, tries again after an hour, then a day, and finally leaves a card at the depot if nobody answers. The dead-letter store is that depot. Idempotency is making sure that if the courier accidentally delivers two identical parcels, you do not pay twice.
Treating events as exactly-once and in-order. Handlers that assume this create duplicate orders, double charges or corrupt state when the occasional repeat or reorder appears.
10Namespaces: Pull Delivery and the MQTT Broker
The newer part of the service, built for control and for devices.
Event Grid namespaces extend the service in two important directions. They add new ways to consume events, and they add a messaging broker for devices and applications that use the lightweight MQTT protocol. Both arrived over recent years, and release notes show features moving from preview to general availability gradually, so always confirm the status of the specific feature you want.
Namespace topics
Namespace topics can deliver to subscribers by push, as before, or by pull. With pull delivery, consumers fetch events in batches, process them and then acknowledge, release or reject each one. Events that are not acknowledged become available again, which supports reliable processing without keeping a connection open for the service to call.
The MQTT broker
MQTT is a lightweight publish-subscribe protocol used widely by internet-of-things devices, vehicles and sensors. The broker in a namespace lets devices connect directly, publish to topics and subscribe to topics, with authentication through certificates or other supported methods. Messages can also be routed onwards, for example to other Azure services, so device data can feed the same event-driven pipelines as everything else.
Device publish and subscribe
Millions of small devices can exchange messages through topics, using standard protocol versions.
Routing to Azure
Device messages can be forwarded to handlers and stores for processing and analysis.
Throughput units
Namespace capacity is measured in throughput units, and an autoscale option has been introduced in preview for the standard tier.
Protocol features
Support for features such as retained messages and shared subscriptions has been rolling out, with status varying by feature.
The original Event Grid is like a notice board that tells people when something is posted. The MQTT broker is like a switchboard for thousands of small walkie-talkies, where each device can talk on channels and listen to channels, all coordinated centrally.
Use basic topics for reacting to Azure and application events. Use namespaces when you need pull-style consumption or direct device messaging. Do not assume one replaces the other.
Features in preview may change, have limits or lack full support commitments. Check each feature’s maturity before building a production system around it.
11Event Schemas and Designing Good Events
An event is a contract between strangers. Design it carefully.
Events travel between teams and systems that may never speak to each other. The structure of an event is therefore a public agreement. A confusing or unstable event design causes pain for every subscriber.
Schemas
Event Grid supports its own event format and also the industry-standard CloudEvents format, a vendor-neutral way of describing events. Using CloudEvents is often a good choice for new custom topics, because the same events can be understood by other platforms. Each event has common fields such as an identifier, a type, a source, a time and a subject, plus a data section with details specific to that event.
| Field idea | Purpose | Design advice |
|---|---|---|
| Identifier | Uniquely identifies the event | Use it to detect duplicates |
| Type | Says what kind of event it is | Use a clear, stable, namespaced name |
| Source or topic | Says where the event came from | Identify the publishing system precisely |
| Subject | Narrows to the item concerned | Use a path-like structure to enable filtering |
| Time | When it happened | Use a consistent time standard |
| Data | Details of this event | Keep small and stable, version if it must change |
Thin or fat events?
Thin events with a reference
- Small and cheap to move
- Sensitive data stays in its original store
- Always fetch the latest state when handling
- Less risk of publishing data that later changes
Fat events with full details
- Handlers need no extra lookup
- Larger payloads cost more and hit size limits
- Sensitive data spreads to every subscriber
- Content can go stale by the time it is processed
Include a version in event types or data, and only add fields rather than changing existing meaning. Subscribers you have never met will depend on today’s shape for years.
A good event is like a well-written delivery slip: it says what arrived, where it is and who it is for, but it does not attach the whole parcel to the slip. Whoever needs the parcel goes and collects it.
12Security: Who May Publish, Who May Receive
Events can contain information and can trigger actions, so both ends need protection.
A forged event could trigger a deployment or a payment, and a leaked event could expose data. Security therefore covers who is allowed to publish, who is allowed to receive and how the traffic travels between them.
Publisher authentication
Custom topics can be written to with access keys, shared access signatures or, preferably, Microsoft Entra identities with a role that allows sending. Identities avoid long-lived keys.
Delivery with managed identity
Event Grid can deliver to many Azure destinations using a managed identity, so no connection strings or keys are stored in the subscription.
Endpoint validation and protection
Webhook endpoints must pass the validation handshake and should validate each request, including a secret or token where supported, so that outsiders cannot imitate Event Grid.
Network controls
IP firewall rules, private endpoints and, in newer options, network security perimeter support restrict who can reach topics and namespaces. Check which controls apply to the type of topic you use.
Transport security
Traffic uses encrypted connections, and recent documentation covers supported transport security versions.
Cross-tenant delivery
Events can be delivered to destinations in another tenant for supported handlers, which requires deliberate trust configuration and careful review.
Imagine the building’s notice board. Only badge holders may pin notices, which is publisher authentication. The board only lists notices to people who signed in, which is handler authentication. And the courtyard it stands in is behind a gate, which is network control.
A topic access key allows anyone who holds it to publish events as your application. Prefer identity-based access, rotate any keys regularly and keep them in a secrets store, never in code.
Limit who can create event subscriptions. Anyone who can subscribe to a topic can receive its events, and anyone who can change a subscription can redirect events elsewhere.
13Integration Patterns That Work
A few shapes cover most real-world uses.
Once you know the building blocks, a small number of patterns appear again and again. Recognising them speeds up design.
Fan-out
One event, many independent reactions. When an order is placed, one subscription updates stock, another sends a confirmation email and another updates analytics, and none knows about the others.
Event-triggered processing
A file arrives and processing starts at once, without polling, such as image resizing, virus scanning or document extraction.
Reactive automation and governance
React to changes in Azure itself: tag new resources, validate settings, alert on risky changes or start clean-up when something is deleted.
Event to queue to worker
Event Grid announces, a queue buffers and workers process at a safe pace. This combination balances responsiveness with reliability.
SaaS and partner integration
Receive events from supported partner services into your Azure environment through partner topics, and react without building custom integration code.
Device messaging into cloud pipelines
Devices publish through the MQTT broker and messages are routed into the same processing and storage services as other events.
flowchart LR
U["User uploads a document"] --> B["Blob storage"]
B --> T["Event Grid system topic"]
T --> F["Function: validate and extract text"]
T --> L["Logic App: notify owner"]
T --> Q["Service Bus queue: heavy analysis workers"]
Q --> W["Worker processes at its own pace"]
W --> D["Results stored and published as new event"]
D --> T2["Custom topic for downstream teams"]
Handlers that publish new events create powerful chains, but also risk loops. A function that reacts to a file creation by writing a file into the same container can trigger itself endlessly. Use separate containers or filters to break cycles.
14Monitoring, Logging and Metrics
Event-driven systems fail quietly unless you watch them.
When components are loosely connected, a broken handler does not raise an error for the publisher. Events simply go undelivered or unprocessed. Without monitoring you may only notice days later, when a business process turns out never to have run.
Metrics to watch
Other useful metrics include events dropped because no subscription matched, delivery attempts, delivery latency and, for namespaces, throughput unit usage and connection counts. Compare published with delivered counts: a growing gap is an early warning.
Logs and alerts
Diagnostic logs
Send delivery failures and publish failures to a central workspace to see which events failed, to which subscription and why.
Alert rules
Alert on rising failed delivery counts, any dead-lettered events and unexpected silence from an important topic.
Dead-letter review
Make reviewing dead-lettered events a routine task, with a documented process for fixing and replaying them.
End-to-end tracing
Carry a correlation identifier in event data and log it in every handler, so a business transaction can be followed across many loosely connected components.
For events that should arrive regularly, such as a nightly file, alert when none have arrived by a certain time. The absence of events is itself a signal.
Events and dead-letter files can contain business data. Restrict access to dead-letter storage and diagnostic logs, and avoid logging full payloads where they include personal details.
15Cost, Scale, Limits and Resilience
Cheap per event, but volumes and design choices add up.
Event Grid’s basic offering is priced mainly by the number of operations, such as publishing events, delivery attempts and management calls, with an included allowance each month. Namespaces use a capacity model measured in throughput units plus operations. Prices and allowances change, so check the official pricing page for current numbers rather than relying on older articles.
What drives cost
Event volume
More events mean more operations. Publish only events that someone really needs.
Delivery attempts
Failing handlers cause retries, and each attempt counts. A broken endpoint can quietly multiply costs.
Number of subscriptions
Each matching subscription receives its own delivery. Fan-out to many handlers multiplies operations.
Handler costs
The real cost is often the compute that reacts, such as function executions. Good filtering saves more there than in Event Grid itself.
Scale, limits and resilience
The service scales to very high event volumes without you managing capacity, though documented limits apply to event size, batch size, number of subscriptions per topic and publishing rates. Namespaces add throughput units that can be adjusted, and an autoscale capability has been announced in preview for the standard tier. For resilience, Event Grid offers geo-disaster recovery options for supported resource types, and well-designed solutions also protect themselves by using dead-lettering and by making handlers idempotent so that replays are safe.
Savings and safety habits
- Filter early so handlers wake only when needed
- Set sensible retry and expiry limits
- Configure dead-lettering for important subscriptions
- Review unused topics and subscriptions
Common cost surprises
- Retry storms against a broken endpoint
- Event loops between handlers and sources
- Verbose events published for no subscriber
If events drive critical processes, decide what happens if a region is unavailable. Consider paired topics, regional failover for publishers and reconciliation jobs that detect missing work.
16Building, Testing and Operating Event-driven Systems
Loose coupling is wonderful in production and tricky to test.
Event-driven systems change how teams build and operate software. Because components are decoupled, you cannot read a single piece of code to see what will happen when an event is raised. The behaviour lives in the set of subscriptions, which makes documentation, testing and ownership especially important.
A sensible lifecycle
Catalogue your events
Keep a shared list of event types, structures, owners and versions, so teams can discover and trust them.
Define infrastructure as code
Create topics, subscriptions, filters and dead-letter settings in templates so environments match and changes are reviewed.
Test handlers with sample events
Send realistic and malformed events to handlers, including duplicates and out-of-order sequences, to prove they cope.
Test end to end in a staging area
Run complete flows with real services and verify results appear, not just that handlers ran.
Operate with runbooks
Document how to inspect dead letters, pause a subscription, replay events and escalate problems.
Draw a diagram of which events trigger which handlers, and keep it current. Teams that cannot see the flow can only discover side effects by surprise.
When many teams subscribe to one team’s events, it is easy to forget who depends on what. Establish an owner for each topic and a process for announcing changes to event structure.
17Design Patterns and Anti-patterns
Shapes that scale, and shortcuts that hurt later.
Patterns worth adopting
Thin events with references
Publish a small notification with an identifier or link, and let handlers fetch details they are allowed to see.
Event, queue, worker
Use Event Grid to announce and a queue to buffer, so slow workers do not lose events.
Idempotent handlers
Make every handler safe to run twice, using event identifiers or natural keys.
Dead-letter and replay
Always configure a dead-letter destination for important subscriptions, and keep a practised way to replay.
Identity everywhere
Use managed identities for delivery and Entra identities for publishing, avoiding stored keys.
Versioned, documented events
Treat event contracts like public interfaces with owners, versions and a change process.
Anti-patterns to avoid
Problem
Using Event Grid as a work queue for commands that must be processed exactly once and in order.
Why It’s Harmful
Event Grid promises at-least-once delivery without ordering, so duplicates and reordering lead to double processing and inconsistent results.
Correct Approach
Use Service Bus for commands that need ordering, sessions or transactions, and use Event Grid to announce that something happened.
Problem
No dead-letter destination and no monitoring on important subscriptions.
Why It’s Harmful
Failed events disappear silently after retries, business processes quietly do not run and nobody notices until customers complain.
Correct Approach
Configure dead-lettering, alert on failures and silence, and rehearse replay.
Problem
Handlers do all their heavy work inside the delivery call before responding.
Why It’s Harmful
Slow handlers look like failures, trigger retries and produce duplicates, and can be overwhelmed by bursts.
Correct Approach
Accept quickly, hand the work to a queue or background process and return success once it is safely recorded.
Problem
Putting entire records, including sensitive data, into every event and sharing topic keys widely.
Why It’s Harmful
Data spreads to every subscriber, payloads hit limits and anyone with a key can publish convincing fake events.
Correct Approach
Publish thin events, protect topics with identities and roles and restrict who can create subscriptions.
18Best Practices and Common Mistakes
Habits that separate quiet, dependable event systems from mysterious ones.
Best practices
- Pick the right service. Events to Event Grid, commands to Service Bus and streams to Event Hubs, combined where it helps.
- Filter at the subscription. Use type, subject and data filters so handlers run only when needed.
- Assume duplicates and disorder. Make handlers idempotent and carry sequence information when order matters.
- Always configure dead-lettering. Give failures a place to land and a person who reviews them.
- Use identities, not keys. Managed identities for delivery and Entra identities for publishing.
- Keep events small and stable. Thin payloads, clear types, versions and documented owners.
- Respond fast. Acknowledge quickly and process elsewhere.
- Monitor delivery and silence. Alert on failures, dead letters and missing expected events.
- Automate and document. Define topics and subscriptions in code and keep the event flow diagram current.
- Check feature maturity. Confirm whether capabilities such as namespace features are generally available before depending on them.
Common mistakes
Failing the endpoint validation. A custom webhook that does not answer the validation request correctly never receives events, and the subscription stays unusable. Test the handshake first.
Creating event loops. A handler that writes to the same place it listens to can trigger itself repeatedly and run up a large bill within minutes. Separate inputs from outputs and use filters.
Expecting events to be stored for replay. Event Grid is a routing service, not an event log. Undelivered events expire, so keep dead-lettering on and use a durable store when you need history.
Forgetting permissions on the destination. When using a managed identity for delivery, the identity must have the right role on the target, such as permission to send to a queue. Missing roles lead to failed deliveries that look mysterious.
Ignoring delivery delays and limits. Event delivery is fast but not instantaneous, and rate and size limits apply. Do not design flows that depend on exact timing.
When events do not reach a handler, check in this order: Was the event published to the expected topic? Does the subscription’s filter match its type and subject? Is the subscription healthy and was the endpoint validated? Does the handler respond successfully and quickly? Does the identity or key have the right permission? Are there dead-lettered events explaining the failure? Metrics comparing published, matched and delivered counts usually show where the chain breaks.
19Real-world and Industry Examples
How different organisations put the doorbell and notice board to work.
The following scenarios are typical patterns rather than descriptions of specific companies. They show how the same building blocks combine for very different needs.
Retailer processing orders
When an order is confirmed, a custom topic announces it. One subscription reserves stock, another sends a confirmation message, another feeds analytics and another notifies the warehouse through a queue. Adding a loyalty-points service later requires only a new subscription.
Media company handling uploads
Uploaded videos land in blob storage, which raises events. A function starts transcoding, another extracts thumbnails, and a workflow notifies editors. Heavy transcoding is queued so bursts of uploads do not overwhelm workers.
Bank enforcing cloud governance
Events about resource creation across subscriptions trigger checks. Non-compliant resources are tagged, reported to owners and, in some cases, corrected automatically. Every action is logged for audit.
Manufacturer connecting machines
Sensors and gateways publish to the MQTT broker in a namespace. Messages are routed into analytics and alerting pipelines, so a temperature warning can open a maintenance ticket within seconds.
Software provider serving many customers
A domain holds one topic per customer, letting each customer subscribe to their own events only. The provider manages thousands of topics through a single resource and consistent access rules.
Healthcare provider integrating systems
When a lab result is filed, a thin event announces its arrival without patient details. Authorised systems fetch the result using their own permissions, keeping sensitive data out of the event stream.
Platform team automating operations
Events announce expiring certificates, scaling events and failed deployments, and automation workflows respond by renewing, notifying or rolling back, reducing manual toil.
20Frequently Asked Questions
Quick answers to questions that come up again and again.
Event Grid routes discrete event notifications to many handlers. Service Bus provides reliable enterprise messaging with queues, ordering and transactions. Event Hubs ingests large streams of telemetry. They are often combined.
Not as a log for later reading. It delivers events and retries failures for a limited time. Use dead-lettering to capture failures, and a durable store if you need history.
No. Delivery is at-least-once without ordering guarantees, so design handlers to tolerate duplicates and out-of-order arrival.
A topic that represents events published by an Azure service, so you can subscribe to them without writing any publishing code.
When your own application needs to announce business events, such as an order shipped, to other systems or teams.
A management container for many related topics, typically used when each tenant or customer has its own topic.
Event Grid retries with increasing delays until the retry limit or event lifetime is reached, then drops the event or writes it to dead-letter storage if configured.
With push, Event Grid calls your handler. With pull, available on namespace topics, your consumer fetches events when ready and acknowledges them. Pull gives the consumer control over pace.
Yes, through the MQTT broker in namespaces, which supports publish and subscribe messaging from devices, with routing onward to other services.
Prefer Entra identities for publishers and managed identities for delivery, use network restrictions where available, validate webhook requests and limit who can create subscriptions.
Not necessarily. Many have reached general availability while others, such as autoscale for namespaces, have appeared in preview. Check the release notes for the maturity of the exact feature you plan to use.
21Summary and Key Takeaways
Azure Event Grid is the doorbell and notice board of the cloud. Sources announce small events, topics receive them, subscriptions filter them, and handlers such as functions, workflows, queues and web endpoints react, with retries, dead-lettering and managed identities supporting reliability and security. The original topic-based service handles Azure and application events, while namespaces add pull delivery and an MQTT broker for devices. Success depends on a few habits: choose Event Grid for discrete events and pair it with Service Bus or Event Hubs when you need ordering or streaming, make handlers idempotent, filter early, protect topics with identities rather than keys, configure dead-lettering, and monitor both failures and silence. Because newer namespace features are arriving continuously, always check which are generally available before you depend on them.
Key Takeaways
- Events notify, messages instruct — use Event Grid for discrete notifications, Service Bus for reliable commands and Event Hubs for high-volume streams, and combine them when useful.
- Topics, subscriptions and handlers — sources publish to topics, subscriptions apply filters, and handlers react, which lets you add new reactions without changing the publisher.
- Delivery is at-least-once, not ordered — design idempotent handlers, carry sequence information when it matters and never assume exactly-once.
- Retries and dead-lettering protect you — configure retry limits and a dead-letter destination, monitor failures and rehearse replay.
- Filter early and keep events thin — use type, subject and data filters, and publish small, versioned events that reference data instead of copying it.
- Secure both ends — use Entra identities for publishing and managed identities for delivery, restrict network access and control who can create subscriptions.
- Namespaces extend the service — pull delivery and the MQTT broker serve controlled consumption and device messaging, but check each feature’s maturity and watch cost drivers such as retries and loops.