Azure Event Grid: Telling Your Systems What Just Happened

Azure Event Grid: Telling Your Systems What Just Happened

A complete, plain-English guide to Event Grid: events, topics, subscriptions, handlers, schemas, filtering, delivery and retries, dead-lettering, namespaces with MQTT and pull delivery, security, monitoring, cost, and how it fits beside Service Bus and Event Hubs.

Imagine a large office building with a front desk. Whenever something happens, a delivery arrives, a visitor signs in, a fire alarm test begins, the desk does not phone every department one by one. Instead, it rings a bell and announces the news on a notice board, and every department that has asked to hear about that kind of news is told immediately. Nobody has to keep walking to the desk asking, “Anything new?” Azure Event Grid is that announcement system for the cloud.

This guide assumes you know nothing about event-driven systems. Every new term is explained the first time it appears, with an everyday comparison. We then go deep: what an event is, how events travel from sources to handlers, how to choose and filter what you receive, how delivery, retries and failures are handled, how security works, how the newer namespace features such as MQTT and pull delivery fit in, and how to keep cost and complexity under control. Event Grid has grown into several related offerings, and details such as schemas, limits and prices change, so where details may have moved we say so and ask you to confirm with the official documentation before designing anything new.

1Why Events Matter and What Event Grid Is

Many systems waste effort asking “has anything changed?” over and over. Events turn that around.

Polling versus being told

The simplest way for one system to learn about changes in another is polling: ask every few seconds, “Is there anything new?” Polling is wasteful, because most answers are “no”, and slow, because a change is noticed only at the next question. It also couples systems tightly, since the asker must know where to look and how often.

An event-driven design reverses the flow. When something happens, the system where it happened publishes a small message called an event: a short, factual statement that something occurred, such as “a file was uploaded” or “an order was placed”. Other systems that care subscribe and are told right away. The sender does not need to know who is listening, how many listeners there are, or what they will do.

Simple Analogy

Polling is walking to the post office every hour to check whether a parcel has arrived. Events are the postman ringing your doorbell the moment it comes. You save the walks, you learn sooner, and the post office does not need to know your daily routine.

What Event Grid does

Azure Event Grid is a fully managed service for routing events from sources to handlers. It receives events from Azure services, from your own applications, and from partner services, and delivers them to the places that asked for them, with filtering, retries and dead-lettering built in. It scales automatically and you pay for what you use, with no servers to run.

Strength

Reactive by design

Systems respond within moments of something happening instead of waiting for the next scheduled check.

Strength

Loose coupling

Publishers and handlers know nothing about each other. You can add or remove handlers without touching the source.

Strength

Built-in Azure sources

Many Azure services announce their own events, such as a file landing in storage, with no code on the sending side.

Strength

Managed reliability

Retries, backoff and dead-lettering are part of the service, so you do not build them yourself.

4
core ideas: source, topic, subscription, handler
Push
and pull delivery styles are both available
0
servers to manage for the classic service
!
Check Before You Plan

Event Grid has been evolving, with a newer namespace-based offering adding MQTT messaging and pull delivery alongside the original push-based service. This guide was written from memory without a live search. Before building, confirm features, regional availability, quotas and pricing on the official Azure documentation.

2The Core Vocabulary

Six words explain almost everything in Event Grid.

TermMeaningEveryday comparison
EventA small record saying that something happened, with details about itA line on the notice board: “Parcel arrived at 10:02”
Event sourceThe system where the event happenedThe front desk or the delivery door
TopicThe endpoint where a source sends events; the category boardThe “Deliveries” board
Event subscriptionAn instruction saying which events to send whereA department’s request: “Tell me about deliveries for floor three”
Event handlerThe place that receives the event and acts on itThe department that reacts
Event schemaThe agreed shape of an event messageThe standard form for notices
flowchart LR
  S["Event source"] -->|Publishes events| T["Topic"]
  T --> SUB1["Subscription A with filter"]
  T --> SUB2["Subscription B with filter"]
  T --> SUB3["Subscription C with filter"]
  SUB1 --> H1["Handler: function"]
  SUB2 --> H2["Handler: queue"]
  SUB3 --> H3["Handler: webhook"]
        
FIG 1 — The basic flow: a source publishes to a topic, subscriptions filter and deliver to handlers

What an event looks like

An event is mostly a labelled envelope with a few standard fields, plus a data section with details that depend on the event. Typical envelope fields identify the event, say what kind of event it is, name the subject it is about, record when it happened, and say what version of the schema it follows. The data section carries the specifics, such as the name and size of a file. Events are meant to be small and factual. They tell handlers that something happened and where to look, not necessarily everything about it.

Simple Analogy

A notice says “Invoice 2041 was approved at 10:05”, not the whole invoice with all its attachments. Anyone who needs the full invoice goes to the filing system and fetches it. Keeping notices short keeps the board readable and fast.

i
Good to know

An event states a fact that already happened, so it is named in the past tense: “order placed”, “file created”. That differs from a command, which asks someone to do something, such as “ship this order”. Mixing the two makes designs confusing.

3Events Versus Messages: Choosing the Right Mental Model

Not every piece of data sent between systems is an event. The distinction decides which Azure service fits.

AspectEventMessage
PurposeAnnounces that something happenedCarries data or a command that must be processed
Sender’s expectationNone; the sender does not care what listeners doSender expects the work to be done
Number of listenersZero, one or manyUsually one processor per message
Ordering and workflow controlUsually loosely orderedOften needs ordering, sessions and transactions
Typical Azure serviceEvent GridService Bus
High-volume stream of telemetryNot designed for itEvent Hubs is built for streams
Simple Analogy

An event is a public announcement over the loudspeaker: “The cafeteria is open.” A message is a work order placed on one specific person’s desk: “Please repair this machine.” The announcement is for anyone interested; the work order must be done by someone and tracked.

Reactive programming and discrete events

Event Grid is built for discrete events: individual, separate happenings that someone may want to react to. Examples are a file added, a virtual machine created, a deployment finished, or an order placed. It is not built for continuous streams, such as a million sensor readings a second, where the interest lies in the flow as a whole. For streams, Event Hubs is the usual choice, and Event Grid can be combined with it when stream data needs to trigger discrete reactions.

i
Practical Rule

Ask: does the sender care what happens next? If not, and many parties might react, use an event. If the sender needs the work done reliably by exactly one processor, use a message queue.

4Kinds of Topics: System, Custom, Partner and Domains

A topic is where events are sent. Which kind you use depends on who the source is.

Topic

System topics

Built-in topics for Azure services that publish their own events, such as storage, resource groups, subscriptions and many others. You create subscriptions on them; you do not publish to them yourself.

Topic

Custom topics

Topics you create for your own applications to publish events to, using a web address and credentials.

Topic

Partner topics

Topics through which a partner service, outside Azure, publishes events into your Azure environment, set up through a partner registration and authorization.

Topic

Event domains

A management container for very large numbers of topics, for example one per customer, under a single endpoint, with per-topic access control and subscriptions.

flowchart TD
  A["Azure services such as Storage or Resource Manager"] --> ST["System topic"]
  B["Your applications"] --> CT["Custom topic"]
  C["Partner SaaS service"] --> PT["Partner topic"]
  D["Multi-tenant application"] --> DM["Event domain with many topics"]
  ST --> SUBS["Event subscriptions"]
  CT --> SUBS
  PT --> SUBS
  DM --> SUBS
  SUBS --> HAND["Handlers"]
        
FIG 2 — The kinds of topic and how they all lead to subscriptions and handlers
Simple Analogy

System topics are the building’s own automatic boards, fed by the building’s sensors. Custom topics are boards your department puts up for its own news. Partner topics are boards where an outside company, such as the courier, can post. Domains are a whole wall of boards, one for each tenant, managed together.

When to use event domains

If you build a multi-tenant application where every customer needs a separate topic with its own access and subscriptions, creating thousands of individual topics would be hard to manage. An event domain gives you one endpoint to publish to, with the topic named inside each event, and lets you grant each customer rights only to its own topic. It is a good fit for software-as-a-service products that want to expose events to customers.

!
Common Mistake

Creating one custom topic per event type out of habit. Usually one topic per publishing application or business area, with event types and subjects used for finer distinction, is simpler to operate and secure.

5Event Subscriptions: Who Gets What

A subscription connects a topic to a handler and says which events to deliver.

An event subscription belongs to a topic and defines three things: the filter that selects events, the destination where matching events are delivered, and the delivery rules such as retries, expiry and dead-lettering. Many subscriptions can exist on one topic, and each receives its own copy of every matching event. That is the fan-out behavior: one event, many independent reactions.

sequenceDiagram
  participant SRC as Source
  participant TOP as Topic
  participant SUB as Subscription with filter
  participant HAN as Handler
  SRC->>TOP: Publish event
  TOP->>SUB: Offer event to each subscription
  SUB->>SUB: Check filter
  SUB->>HAN: Deliver if matched
  HAN-->>SUB: Success response
  Note over SUB,HAN: If no success, retry later according to policy
        
FIG 3 — How an event is offered to a subscription and delivered to a handler
Simple Analogy

Each department fills a request slip: “Send me notices about deliveries to floor three, to this desk, try again if I am away for up to a day, and put anything you cannot deliver in this tray.” The front desk keeps one slip per request and works through all of them for every notice.

1

Choose the topic

Pick the system, custom, partner or domain topic that carries the events you care about.

2

Choose the filter

Select event types, subject patterns or data conditions so you receive only relevant events.

3

Choose the destination

Select the handler and decide how Event Grid will authenticate to it.

4

Set the delivery rules

Configure retry duration, maximum attempts, expiration and a dead-letter location.

5

Validate and monitor

Confirm the destination accepts events, then watch delivery metrics and failures.

i
Practical Rule

Give each handler its own subscription. Sharing one subscription between unrelated handlers means one slow or failing handler affects the others, and you cannot filter or tune them separately.

6Event Handlers: Where Events Land

Event Grid delivers to many kinds of destination. The right one depends on what must happen next.

HandlerBest forWatch out for
Azure FunctionsSmall pieces of code reacting to events, with automatic scalingMake functions idempotent because duplicates can occur
Logic AppsLow-code workflows with approvals and business connectorsCost per action in busy flows
WebhookAny web service, including your own applications and external toolsMust prove ownership during validation and respond quickly
Service Bus queue or topicBuffering events for controlled, ordered or transactional processingAdds another service to operate and pay for
Storage queueSimple, low-cost bufferingFewer advanced features than Service Bus
Event HubsSending events into a streaming pipeline for analyticsThroughput planning on the Event Hubs side
Hybrid ConnectionsReaching an application behind a firewall without opening inbound portsRequires the relay listener to be running
Automation runbook through webhookOperational actions on cloud and private resourcesProtect the webhook address as a secret
flowchart LR
  E["Event: file uploaded"] --> G["Event Grid"]
  G --> F["Function: scan the file"]
  G --> L["Logic App: notify the team"]
  G --> Q["Queue: buffer for batch processing"]
  G --> H["Event Hub: feed analytics stream"]
        
FIG 4 — One event fanning out to several different kinds of handler

Buffering with a queue

Sometimes the handler cannot keep up with bursts of events, or must process them carefully, one by one. A queue between Event Grid and the handler absorbs the burst: Event Grid delivers quickly to the queue, and the handler pulls work at its own pace. This is a very common and robust pattern, and it combines the broadcast strength of Event Grid with the control strength of Service Bus.

Simple Analogy

If the department can only handle five notices an hour, but fifty arrive at once, the front desk puts them in the department’s in-tray rather than shouting them all at once. The department works through the tray calmly.

ANTI-PATTERN-01 Avoid
Problem

A slow, fragile web service is subscribed directly to a very busy topic, with no buffer.

Why It’s Harmful

The service is overwhelmed, returns errors, and Event Grid backs off and retries, delaying all events for that subscription and eventually dead-lettering many of them.

Correct Approach

Deliver into a queue, and let the service consume at its own pace, or scale the handler to match the event rate.

7Event Schemas: Event Grid, CloudEvents and Custom Input

An agreed shape for events lets different systems understand each other.

Schema

Event Grid schema

The original Azure-specific shape, with fields for identifier, subject, event type, time, data and version. Used by many Azure system topics.

Schema

CloudEvents schema

An open industry standard from the Cloud Native Computing Foundation for describing events in a common way. Recommended for new designs where supported because it helps portability across clouds and tools.

Schema

Custom input schema

Lets you publish events in your own shape and map its fields to the standard fields, so existing applications can publish without reformatting.

Why a standard schema matters

If every team invents its own event format, every consumer must learn every format, and changing one breaks others. A standard envelope means tools, filters and monitoring work the same way for all events. The data section can still be specific to each event type. Treat the data shape as a public contract: version it, add fields rather than renaming or removing them, and document it where consumers can find it.

Design choiceAdvice
Event type namingUse a consistent, dotted, namespaced form that includes the domain and the fact, in the past tense
SubjectUse a path-like value that identifies the thing the event is about, so that prefix and suffix filters work well
Data sizeKeep events small; pass identifiers and links to large content, not the content itself
VersioningInclude a version and change by adding fields; publish a new event type for breaking changes
Sensitive dataDo not put secrets or unnecessary personal data in events; they pass through several systems and logs
Simple Analogy

A standard notice form means every department can read every notice. If one department invents its own form, others cannot file or search it. Adding a new box to the form is fine; removing or renaming boxes breaks everyone’s filing cabinets.

!
Check Before You Plan

Schema support differs between the classic service, system topics and the namespace offering. Confirm which schemas your chosen topic type supports before standardizing, and note that some Azure services publish only in the original Event Grid schema.

8Filtering: Receiving Only What You Need

Good filters save money, reduce load and keep handlers simple.

Filter

Event type filter

Choose which event types to receive, for example only “created” events and not “deleted” ones.

Filter

Subject filter

Match the beginning or end of the subject, such as everything under one folder path, or only files ending in a given extension. Can be made case-sensitive or not.

Filter

Advanced filter

Compare fields in the event, including inside the data section, with operators such as equals, one of a list, greater than, contains, starts with, or is null. Several conditions can be combined, within documented limits.

flowchart TD
  EV["Incoming event"] --> T{"Event type matches?"}
  T -->|No| DROP["Not delivered to this subscription"]
  T -->|Yes| S{"Subject matches prefix and suffix?"}
  S -->|No| DROP
  S -->|Yes| A{"Advanced conditions satisfied?"}
  A -->|No| DROP
  A -->|Yes| DEL["Deliver to handler"]
        
FIG 5 — The order in which filters are applied to decide delivery

Filter at the source of truth

Filter in the subscription rather than inside the handler whenever possible. Filtering in the subscription means unwanted events are never delivered, never billed as deliveries to that handler, never start a function, and never create noise in logs. It also makes the intent visible: anyone reading the subscription sees exactly which events trigger which reaction.

Only images in a folder

A storage subscription receives only “blob created” events whose subject begins with the uploads folder path and ends with an image extension, so the image-processing function runs only for images.

Only high-value orders

An advanced filter on an order amount field in the event data sends only large orders to a review workflow, while all orders go to the accounting queue.

Only production changes

A subscription on resource events filters on the subject to react only to changes in the production resource groups.

Simple Analogy

A good request slip says “only deliveries for floor three, only parcels, only urgent ones”. A poor slip says “tell me everything”, and the department spends its day reading notices it has no interest in.

!
Common Mistake

Relying on filters for security. Filters decide what is delivered, but they are not a substitute for access control. Never assume a filter protects confidential events from a subscriber who has been given access to the topic.

9Delivery, Retries and Dead-Lettering

What happens when the handler is slow, busy or down?

Event Grid guarantees at-least-once delivery for the push model. That means that every event is delivered at least one time to every matching subscription, and in rare cases it may be delivered more than once. It does not promise ordering. Handlers must therefore be able to cope with duplicates and with events arriving in a different order than they happened.

The retry story

When a delivery attempt fails or the handler does not respond with a success code in time, Event Grid retries with increasing waits between attempts, a pattern called exponential backoff. By default it keeps trying for up to a day, for a limited number of attempts, and you can shorten both. Some failures are treated as permanent, for example when the destination does not exist or rejects the request as unauthorized, and are not retried in the same way. Slow or unhealthy endpoints may also have their deliveries delayed to protect them from being overwhelmed.

flowchart TD
  A["Event matched"] --> B["Attempt delivery"]
  B --> C{"Success response?"}
  C -->|Yes| D["Done"]
  C -->|No| E{"Retry window and attempts left?"}
  E -->|Yes| F["Wait with increasing delay"]
  F --> B
  E -->|No| G{"Dead-letter configured?"}
  G -->|Yes| H["Store event in blob storage with failure reason"]
  G -->|No| I["Event is dropped"]
        
FIG 6 — Retry and dead-letter flow for a failing delivery

Dead-lettering

If delivery ultimately fails, the event can be saved in a storage container you choose, together with information about why it failed. This is called dead-lettering. Without it, such events are simply dropped. Enable dead-lettering on every subscription that matters, monitor the container, and create a procedure for examining and replaying events once the underlying problem is fixed.

Simple Analogy

If the department is out, the front desk tries again after a few minutes, then after an hour, then later still. If after a whole day nobody has collected the notice, it goes into a labelled “undelivered” tray with a note explaining what happened. Without the tray, it would be thrown away.

SettingMeaningAdvice
Event time to liveHow long Event Grid keeps trying before giving upMatch to how long the event stays useful; stale events can be harmful
Maximum delivery attemptsCap on attempts within the time windowLower for time-sensitive events, higher for important ones
Dead-letter destinationStorage location for undelivered eventsAlways configure for important flows, with identity-based access
BatchingDelivering several events per request to a destination that supports itImproves efficiency for high-volume flows; handlers must handle arrays

Designing handlers for duplicates and disorder

Make handlers idempotent: processing the same event twice must have the same final effect as processing it once. A common approach is to record the identifier of each processed event, or to design operations as “set to this value” instead of “add one”. For disorder, do not assume that “created” arrives before “updated”. Use timestamps or version numbers in the data to decide whether an event is newer than what you already have.

ANTI-PATTERN-02 Avoid
Problem

A handler sends a customer email and charges a card each time it receives an “order placed” event, without checking whether that event was already processed.

Why It’s Harmful

Because delivery is at-least-once, a retry after a timeout can cause duplicate emails and double charges.

Correct Approach

Record processed event identifiers or use idempotency keys with downstream systems, so repeated events cause no extra effect.

10Endpoint Validation and Webhook Handshakes

Event Grid will not send events to an address until it is sure the owner agrees.

If anyone could point Event Grid at any web address, the service could be used to flood a stranger’s server. To prevent this, when you create a subscription to a webhook, Event Grid first sends a special validation event. The endpoint must prove it controls the address, either by echoing back a code included in the validation event or by visiting a validation address provided. Many Azure destinations, such as Functions with an Event Grid trigger, queues and Event Hubs, are validated automatically when you have rights to them.

sequenceDiagram
  participant EG as Event Grid
  participant WH as Webhook endpoint
  EG->>WH: Send validation event with a code
  WH-->>EG: Echo the code or confirm validation
  EG->>EG: Mark subscription as validated
  EG->>WH: Begin sending real events
        
FIG 7 — The handshake that proves a webhook owner agrees to receive events
Simple Analogy

Before the courier starts leaving packages at an address, they ring the bell once and ask, “Do you really live here and want my packages?” Only after you answer correctly do deliveries begin.

i
Practical Rule

If your webhook is behind a gateway or firewall, make sure validation requests can reach it, and that the handler distinguishes validation events from real ones. A common failure at set-up is simply that the handshake request is blocked.

!
Check Before You Plan

Validation methods and supported schemas for webhooks have changed over time, and the newer CloudEvents handshake differs from the original one. Check the current documentation for the exact handshake your chosen schema uses.

11Publishing Your Own Events

Besides Azure’s built-in events, your applications can announce their own.

To publish to a custom topic or domain, an application sends events to the topic’s web address over a secure connection, authenticating either with an access key, a shared access signature or, preferably, a Microsoft Entra identity that has been granted a data sender role on the topic. Events can be sent in batches to improve efficiency. The publisher gets a success response once Event Grid has accepted the events, which means the events are stored and will be delivered; it does not mean any handler has finished.

1

Decide what is worth announcing

Choose facts that others might care about, such as state changes in your business domain.

2

Define the event types and data

Agree on names, subjects and data fields, and document them as a contract.

3

Create the topic and grant sender rights

Use a managed identity or application identity with only the sender role.

4

Publish after the change is committed

Make sure the event is sent only once the underlying change is safely stored, so listeners never react to something that did not really happen.

5

Handle publish failures

Retry on temporary errors and have a plan if the topic is unreachable, so events are not silently lost.

Simple Analogy

A department that announces “Contract signed” should do so after the contract is really signed and filed, not before. Otherwise others act on news that turns out to be false.

The outbox idea

A subtle problem arises when an application must both save data in its database and publish an event. If it saves and then crashes before publishing, the event is lost. If it publishes and then fails to save, listeners react to something that never happened. A well-known solution is the outbox pattern: the application writes the event into a table in the same database transaction as the business change, and a separate small process reads that table and publishes the events, marking them as sent. This gives reliable publishing, and combined with idempotent handlers it gives dependable end-to-end behavior.

flowchart LR
  APP["Application"] -->|One transaction| DB["Database: business data plus outbox table"]
  DB --> REL["Relay process reads unsent events"]
  REL -->|Publish| EG["Event Grid topic"]
  REL -->|Mark as sent| DB
        
FIG 8 — The outbox pattern for reliable publishing
i
Good to know

Not every system needs the outbox. For low-stakes announcements, publishing directly after the commit is acceptable. Use the outbox where losing or duplicating an event has a real business cost.

12Event Grid Namespaces: MQTT Broker and Pull Delivery

A newer part of Event Grid broadens what it can do beyond classic push delivery.

Alongside the original topics, Event Grid offers a namespace, a container that hosts newer capabilities. Two stand out. First, an MQTT broker: MQTT is a lightweight messaging protocol widely used by devices and sensors, built around publishers and subscribers exchanging messages on named topics. The namespace can accept connections from many devices, route their messages to each other, and also route them onward to Azure handlers. Second, pull delivery: instead of Event Grid pushing events to a handler, the handler connects and pulls events from a namespace topic at its own pace, then acknowledges, releases or rejects each one.

Namespace

MQTT broker

Supports device and application messaging using the MQTT protocol, with publish and subscribe, authentication using certificates or identity, and routing to other Azure services.

Namespace

Pull delivery

Handlers fetch events when ready, control their own rate, and settle each event with an explicit outcome. Useful when the handler sits behind a firewall or needs flow control.

Namespace

Push delivery from namespaces

Namespace topics can also push to some destinations, offering a path to the same style as classic topics where supported.

AspectPush deliveryPull delivery
Who starts the exchangeEvent Grid calls the handlerThe handler calls Event Grid
Handler must be reachableYes, from Event GridNo; it only needs outbound access
Rate controlEvent Grid adjusts with backoffThe handler decides how fast to fetch
Handling outcomeSuccess or failure responseAcknowledge, release or reject each event
Best forReactive code that scales automaticallyControlled, rate-limited or private consumers
flowchart LR
  D1["Device 1"] -->|MQTT publish| N["Event Grid namespace MQTT broker"]
  D2["Device 2"] -->|MQTT publish| N
  N -->|MQTT subscribe| APP["Control application"]
  N -->|Route to namespace topic| NT["Namespace topic"]
  NT -->|Pull| PROC["Processing service"]
        
FIG 9 — Devices publishing through an MQTT broker, with routing onward to a pulled topic
Simple Analogy

Push delivery is the postman ringing your bell. Pull delivery is you collecting your mail from the post office box whenever you have time, and signing for each letter. The MQTT broker is a switchboard where many small devices, like intercoms, talk to each other and to the office through named channels.

!
Check Before You Plan

The namespace features are newer and still evolving: supported protocol versions, client limits, routing options, tiers and pricing may change. Some earlier arrangements, such as running Event Grid on edge or Kubernetes environments, have also been changed or retired. Confirm what is currently supported before committing a design.

13Common Azure System Event Sources

Many Azure services announce events without any extra code from you.

SourceExample eventsTypical reaction
Blob StorageFile created, file deletedScan, resize, index or copy the file
Azure subscriptions and resource groupsResource written, deleted or action completedEnforce tagging, audit, notify, trigger governance runbooks
Container RegistryImage pushed or deletedStart a deployment or a security scan
Key VaultSecret or certificate near expiry, new version createdRotate secrets, notify owners, restart dependent apps
IoT HubDevice connected, disconnected, createdTrack device lifecycle and raise alerts
Service Bus and Event HubsMessages available with no active listener, capture file createdWake up processors only when work exists
App Service and FunctionsApp changed, restarted, plan scaledOperational notifications
Machine Learning and other data servicesModel registered, run completedStart downstream pipelines
Maps, Communication Services and othersGeofence entered, message receivedBusiness reactions in applications

Secret expiry handled before an outage

Key Vault announces that a certificate is about to expire. A subscription starts a workflow that renews it, updates dependent applications and informs the owners, so expiry never causes a surprise outage.

Governance on every new resource

A subscription-level system topic announces new resources. A function checks the tags and location against company rules and either corrects them or opens a ticket.

Simple Analogy

These are the building’s own sensors: the door sensor, the smoke detector and the temperature gauge, all already wired to the notice board. You simply choose which notices to read.

i
Good to know

The list of services that publish events and the event types they support keeps growing. Before assuming a service can notify you of a change, check the supported event sources page; if not available, an alternative is the service’s own activity log or diagnostic stream.

14Architecture Patterns with Event Grid

A few designs appear again and again.

Pattern 1: Fan-out reaction

One event, many independent reactions. A file upload triggers a virus scan, a thumbnail creator, a metadata indexer and an audit log entry, each through its own subscription. Adding a fifth reaction later requires no change to the uploader.

Pattern 2: Event-carried notification with fetch

The event is small and holds identifiers. Handlers who need more details call the source service to fetch them. This keeps events cheap and avoids sending stale or sensitive data around.

Pattern 3: Choreography

Services react to each other’s events without a central controller. Order service announces “order placed”; payment service reacts and announces “payment taken”; shipping service reacts and announces “parcel dispatched”. Each service knows only the events it consumes and produces. It is flexible, but the overall flow becomes harder to see, so document it and trace it.

Pattern 4: Orchestration with events as triggers

A workflow service coordinates a long process and uses events to start it or to wake it when something external happens. This gives visibility and control for processes with many steps, approvals and compensation.

Pattern 5: Buffered integration

Event Grid delivers into a queue so that downstream systems process at their own pace and failures are isolated.

flowchart LR
  OS["Order service"] -->|Order placed| EG["Event Grid"]
  EG --> PS["Payment service"]
  EG --> INV["Inventory service"]
  EG --> NOT["Notification service"]
  PS -->|Payment taken| EG2["Event Grid"]
  EG2 --> SH["Shipping service"]
  EG2 --> NOT
        
FIG 10 — Choreography: services reacting to each other’s events without a central controller
PatternStrengthWeakness
Fan-outEasy to extend, decoupledMany consumers can hide dependencies
Notification and fetchSmall events, fresh dataExtra call; source must stay available
ChoreographyNo central bottleneck, flexible teamsHard to see the whole flow and to debug
OrchestrationClear flow and error handlingCentral coordinator to maintain
Buffered integrationResilient, rate controlledExtra service and cost
Simple Analogy

Choreography is a group of dancers who each know their own steps and react to what others do. Orchestration is a conductor who tells each musician when to play. Small ensembles dance well; big symphonies need conductors.

15Event Grid, Service Bus and Event Hubs Compared

Three messaging services, three different jobs.

QuestionEvent GridService BusEvent Hubs
Core ideaAnnounce discrete events to many subscribersReliable enterprise messaging between applicationsIngest huge streams of data
Typical data“Something happened” notificationsCommands, orders, business messagesTelemetry, logs, clickstreams
Delivery stylePush to handlers, with pull available in namespacesConsumer pulls from queues or subscriptionsConsumer reads partitions from a position
OrderingNot guaranteedAvailable with sessionsOrdered within a partition
Transactions and duplicates detectionNot offered in the same wayAvailableNot typical
RetentionShort retry window and dead-letterMessages kept until processed or expiredTime-based retention for replay
Scale patternMany events, many subscriptionsModerate volume, rich featuresVery high throughput
Simple Analogy

Event Grid is the loudspeaker announcement. Service Bus is the registered mail service with tracking, signatures and proof of delivery. Event Hubs is the giant conveyor belt that carries a constant river of items to be sorted later.

They are often combined

Event Grid into Service Bus

A resource event is delivered into a Service Bus queue so a back-end process can handle it with ordering, locking and dead-lettering.

Event Hubs into Event Grid

When a capture file from a stream lands in storage, a storage event starts a batch analysis job.

Event Grid for the signal, Service Bus for the work

An “order placed” event informs many systems at once, while the actual fulfilment instruction goes through a queue to exactly one processor.

i
Practical Rule

When unsure, ask three questions: Is it a notification or work to be done? How many listeners? Is it a rare happening or a continuous stream? The answers usually point to one of the three.

16Security: Identity, Keys and Network Control

Events can reveal what is going on inside your systems, and the right to publish them can cause actions. Both deserve protection.

Controlling who can publish and who can subscribe

Control

Role-based access

Roles control who can manage topics, create subscriptions, and send events. Grant publishing rights only to the applications that must publish, using a data sender role.

Control

Microsoft Entra authentication

Prefer identity-based publishing to access keys. Identities can be audited and revoked individually and need no shared secret.

Control

Keys and shared access signatures

Possible, but a leaked key lets anyone publish. Rotate regularly, keep in a secret store, and consider disabling key-based access where policy allows.

Control

Managed identity for delivery

Let Event Grid authenticate to handlers and dead-letter storage with a managed identity, so no secrets are stored in the subscription.

flowchart LR
  PUB["Publisher with identity"] -->|Token over TLS| TOP["Topic with role assignment"]
  TOP --> EG["Event Grid"]
  EG -->|Managed identity| H1["Queue or function handler"]
  EG -->|Managed identity| DL["Dead-letter storage"]
  PUB2["Unknown caller"] -.->|Rejected| TOP
        
FIG 11 — Identity-based publishing and delivery with unknown callers rejected

Network protection

By default topics and domains are reachable through public endpoints, protected by authentication and always encrypted in transit. For tighter control you can restrict access to selected address ranges, or use private endpoints so publishers inside your virtual network reach the topic over private addresses and public access is turned off. Delivery to handlers behind private networks needs separate planning: in some cases, trusted-service access or a queue as an intermediate handler can help, and pull delivery lets a private consumer fetch events with outbound connections only.

Protecting the data in events

Events pass through the service, logs, dead-letter storage and handlers. Keep them free of secrets and unnecessary personal data. Where sensitive details are needed, include only an identifier and let authorized handlers fetch the details from the source. Encrypt dead-letter storage, restrict who can read it, and set retention to match policy.

Simple Analogy

Only staff with a badge may post on the notice board, and notices should not display passwords or customers’ home addresses. If a sensitive detail is needed, the notice says “see file 2041”, and only people allowed to open that file can read it.

ANTI-PATTERN-03 Avoid
Problem

A single topic access key is embedded in several applications and shared across teams, and events contain customer personal details in full.

Why It’s Harmful

A leak of the key allows anyone to inject false events that trigger real actions, and personal data spreads to every subscriber, log and dead-letter container.

Correct Approach

Use identity-based publishing with minimal roles, rotate or disable keys, and keep events small with identifiers instead of sensitive content.

!
Common Mistake

Trusting incoming webhook calls just because they look like Event Grid. If you receive events on your own endpoint, validate them using the supported authentication method so that a stranger cannot call your endpoint pretending to be Event Grid.

17Monitoring, Diagnostics and Troubleshooting

Event-driven systems are quiet when they work and puzzling when they do not. Make them observable.

What to watch

Metric

Published events

Counts of events accepted and rejected by the topic. A fall may mean a publisher problem; rejections suggest authentication or format issues.

Metric

Matched and delivered events

How many events matched a subscription and how many were delivered successfully.

Metric

Failed deliveries

Counts of attempts that failed, often broken down by error type. A sustained rise points to a handler or network problem.

Metric

Dropped and dead-lettered events

Events that expired or were stored as undeliverable. These should be near zero and always investigated.

Metric

Delivery latency

How long it takes to deliver. Rising latency suggests throttling or a slow endpoint.

flowchart LR
  EG["Event Grid topics and subscriptions"] --> M["Metrics"]
  EG --> D["Diagnostic logs for delivery failures and publish errors"]
  M --> AL["Alert rules"]
  D --> LA["Log Analytics workspace"]
  LA --> AL
  AL --> AG["Action group"]
  AG --> T["Team channel or on-call tool"]
        
FIG 12 — Metrics and diagnostic logs feeding alerts for event flows

Troubleshooting checklist

SymptomLikely causeWhat to check
Subscription creation failsWebhook validation not answered or blockedConfirm the endpoint is reachable and handles the validation event
No events arriveFilters too narrow, publisher not sending, wrong topicCheck published and matched counts, filter patterns and subject format
Events published but not matchedEvent type or subject differs from the filterCompare a real event with the filter, including case sensitivity
Deliveries failingHandler down, slow or returning errors; authorization problemsRead failure reasons in diagnostics and test the handler directly
Duplicate processingAt-least-once delivery, timeouts causing retriesMake handlers idempotent; respond quickly and process asynchronously
Events in dead-letter storageRetries exhaustedRead the reason, fix the cause, then replay
Publisher gets unauthorized errorsMissing role, expired key or wrong audienceCheck identity, role assignment and endpoint
Works in test but not productionFirewall, private networking or identity differencesCompare network rules and identities between environments
Simple Analogy

If a department says it never got a notice, check in order: was the notice posted, did it match the request slip, was the department reachable, and is it in the undelivered tray. Counters at each stage tell you where the notice stopped.

i
Practical Rule

Put a correlation identifier in each event and log it in every handler. When something goes wrong, you can follow one business happening across publisher, Event Grid and all handlers with a single search.

18Reliability, Ordering and Disaster Recovery

Events are only useful if they survive failures, so plan for the bad days.

What the service gives you

Event Grid is built on regional infrastructure with redundancy within the region, and it can use availability zones in supported regions. Once an event is accepted, it is stored and delivered with retries as described earlier. The service does not guarantee ordering, and it does not keep events forever; its job is to deliver or dead-letter them.

Regional failures

For regional disasters, Event Grid has offered geo-disaster recovery features for custom topics and domains, with options to publish to a paired secondary topic, and to fail over. The details, including which topic types support them and who controls failover, have changed over time, so verify the current model. A common design is to keep a matching topic and subscriptions in a second region, defined as code, and make publishers capable of switching if the primary is unreachable.

flowchart LR
  PUB["Publisher with failover logic"] --> P["Primary region topic"]
  PUB -.->|If primary unreachable| S["Secondary region topic"]
  P --> H1["Handlers in primary region"]
  S --> H2["Handlers in secondary region"]
  REPO["Templates in source control"] --> P
  REPO --> S
        
FIG 13 — A publisher able to switch to a matching topic in another region
Practice

Define everything as code

Topics, subscriptions, filters and dead-letter settings in templates, so a second region can be created and tested quickly.

Practice

Plan for handler failure

Dead-letter and queue buffers protect against handler outages. Test recovery by replaying events.

Practice

Do not rely on order

Design handlers to tolerate out-of-order events using version numbers or timestamps.

Practice

Rehearse failover

Practice switching publishers and measure how many events may be lost or duplicated during the switch.

Simple Analogy

A building with a backup front desk in the building next door can keep announcing notices if the main lobby is closed. But staff must know the backup exists, rehearse using it, and accept that a few notices may be repeated or delayed during the switch.

!
Check Before You Plan

Recovery options differ between topic types and between the classic service and namespaces, and the responsibilities of Microsoft and customers during failover have been changing. Read the current resilience guidance before promising any recovery objective to the business.

19Cost Management

Event Grid is usually inexpensive, but high volumes and extra features add up.

For the classic service, pricing is generally based on the number of operations, counting things like event publishes, delivery attempts, advanced filter evaluations and management calls, with a monthly free allowance and a price per million operations beyond it. Namespace features such as MQTT and pull delivery use their own models, based on throughput units or similar capacity concepts plus per-operation charges. Related services such as storage for dead-lettering, queues, functions and logging add their own costs. Prices change, so confirm on the current pricing page before budgeting.

1

Filter early

Deliver only what handlers need. Fewer deliveries mean fewer operations and less downstream compute.

2

Batch when possible

Publish and deliver events in batches for high-volume flows, where handlers support it.

3

Tune retries and time to live

Endless retries to a dead endpoint waste operations. Disable or fix failing subscriptions quickly.

4

Avoid chatty event design

Do not announce every tiny internal step. Publish meaningful business facts.

5

Watch downstream cost

A function run per event or a workflow action per event can cost more than Event Grid itself. Estimate the whole chain.

6

Clean up unused subscriptions

Review regularly and remove those without owners or purpose.

Simple Analogy

The announcement system charges a tiny fee per announcement and per delivery attempt. The big cost is usually not the announcement itself but the work every department does in response, so the best saving is not announcing things nobody needs.

!
Common Mistake

A feedback loop: a function reacts to a storage event by writing a file to the same storage location, which raises another event, which triggers the function again. Costs and load explode quickly. Separate input and output locations, filter carefully and set alerts on event volume.

20Governance, Naming and Organization

Event-driven systems are easy to start and hard to understand once there are hundreds of subscriptions.

AreaRecommendation
NamingUse consistent names for topics, subscriptions and event types that show domain, environment and purpose
CatalogMaintain a catalog of event types with owner, schema, version, meaning and example
OwnershipEach topic and subscription has an owning team and a contact, recorded in tags
EnvironmentsSeparate topics for development, test and production, with different access
Change managementTreat event schemas as public contracts; announce and version changes
Infrastructure as codeDefine topics and subscriptions in templates under review
PolicyUse Azure Policy to enforce private access, identity-based authentication and diagnostic settings
Simple Analogy

A building with a hundred notice boards and no directory becomes chaos. A directory listing each board, who owns it, what it is for and who reads it keeps the building understandable as it grows.

i
Practical Rule

Before adding a new event type, check the catalog for an existing one. Before changing an event, find out who subscribes. The costliest event bugs are changes that silently break unknown consumers.

ANTI-PATTERN-04 Avoid
Problem

Teams change field names in their event data to suit themselves, without telling anyone, and nobody keeps a list of subscribers.

Why It’s Harmful

Consumers break silently, often discovered by customers, and the cause is hard to trace because publisher and consumer teams never talk.

Correct Approach

Version schemas, add fields instead of renaming, keep a catalog of events and subscribers, and announce changes in advance.

21Patterns and Anti-Patterns

Habits that make event-driven systems dependable, and habits that make them fragile.

Patterns worth adopting

Idempotent handlers everywhere

Assume every event may arrive twice or out of order and design handlers so that this causes no harm.

Small events with identifiers

Announce the fact and where to find details. Avoid carrying large or sensitive content.

Dead-letter and replay discipline

Always configure dead-lettering, alert on it, and keep a tested procedure to replay events after a fix.

Queue in front of fragile or slow handlers

Buffer so that bursts and outages do not lose events or overwhelm the handler.

Identity-based everything

Managed identities for publishers, deliveries and dead-letter storage, with roles limited to what is needed.

Event catalog and schema versioning

Treat event contracts as a product, with owners, documentation and change notices.

Correlation identifiers

Carry a trace identifier in every event so that business flows can be followed across services.

More anti-patterns to avoid

ANTI-PATTERN-05 Avoid
Problem

Event Grid is used as a request-and-response channel, with a service publishing an event and waiting for another service to answer.

Why It’s Harmful

Event Grid offers no ordering, no reply mechanism and no latency promise for a waiting caller. The design is fragile and hard to debug.

Correct Approach

Use direct calls for request and response, or messaging with reply queues, and keep events for announcements.

ANTI-PATTERN-06 Avoid
Problem

Event Grid is used to carry a high-volume continuous stream of telemetry from thousands of devices.

Why It’s Harmful

The service and its pricing are designed for discrete events, not for streaming analytics, and costs and limits become painful.

Correct Approach

Use a streaming service for the flow and Event Grid for the discrete reactions, or use the namespace MQTT features where device messaging is the real need.

ANTI-PATTERN-07 Avoid
Problem

A system depends on events arriving exactly once and in order, for example updating a balance by adding each event’s amount.

Why It’s Harmful

Duplicates or reordering corrupt the result silently.

Correct Approach

Use idempotency keys and version checks, or route the critical flow through a messaging service with ordering and duplicate detection.

“An event is a fact, not a favor. Announce it, let others decide what to do, and never wait at the door for the answer.”

22Best Practices Checklist

A review list to use before going live and at regular intervals afterward.

Do

  • Use events for discrete facts and messages for work that must be done
  • Name events in the past tense with consistent, namespaced types
  • Prefer the CloudEvents standard for new designs where supported
  • Filter in the subscription and give each handler its own subscription
  • Make handlers idempotent and tolerant of disorder
  • Configure dead-lettering and monitor it
  • Put a queue in front of slow, fragile or bursty handlers
  • Use Microsoft Entra identities and managed identities instead of shared keys
  • Use private endpoints and restricted networks when policy demands
  • Keep events small and free of secrets and unnecessary personal data
  • Define resources as code and maintain an event catalog
  • Alert on failed deliveries, dead-letters and unexpected volume

Avoid

  • Using events as commands or as request and response
  • Assuming exactly-once delivery or strict ordering
  • Sharing one subscription between unrelated handlers
  • Embedding keys in applications and sharing them widely
  • Large payloads and sensitive data inside events
  • Feedback loops where a reaction creates the event that triggered it
  • Changing event data shapes without versioning or notice
  • Streaming continuous high-volume telemetry through discrete event topics
  • Leaving failing subscriptions running untouched
i
Practical Rule

Hold a short event review every quarter: which event types and subscriptions are still used, which have no owner, how many events were dead-lettered, what the cost is, and whether any feature you rely on is changing.

23Real-World Scenarios

How organizations put Event Grid to work.

Document processing pipeline

A legal firm receives scanned documents into storage. A storage event, filtered to the incoming folder and the right file types, starts a function that extracts text and stores the result. Another subscription sends a copy of the event to a queue for the archiving system, and a third notifies the case team. Dead-lettering captures any that fail so that nothing is lost.

Retail order flow

An online retailer publishes “order placed” to a custom topic. Payment, inventory, email notification and fraud-checking services each subscribe with their own filters. Later the retailer adds a loyalty points service by creating a new subscription, with no change to the order service.

Cloud governance and compliance

A company subscribes to resource events at subscription level. A function inspects each new resource, applies missing tags, flags insecure settings and raises tickets for exceptions. Auditors see a continuous, evidence-backed process rather than a quarterly spreadsheet.

Software vendor exposing events to customers

A software-as-a-service vendor uses an event domain with one topic per customer. Customers get rights only to their own topic and subscribe their own webhooks, so each customer is told about changes in their own data without the vendor building custom integrations.

Smart building devices

Thousands of sensors and controllers connect to an MQTT broker in an Event Grid namespace. Control applications subscribe to device channels, while selected messages are routed onward to a pulled topic where a processing service, behind a firewall, fetches them at its own pace.

Secret and certificate lifecycle

Key Vault events announce near-expiry certificates. A workflow renews them, updates dependent applications and posts a summary to the team channel, and the whole lifecycle is logged for auditors.

24Frequently Asked Questions

Short answers to common beginner questions.

Q1What is Event Grid in one sentence?

It is a managed Azure service that routes events from sources such as Azure services and your applications to handlers that have subscribed, with filtering, retries and dead-lettering built in.

Q2What is an event?

A small record stating that something happened, with an identifier, a type, a subject, a time and some details.

Q3What is the difference between a topic and a subscription?

A topic is where events are sent. A subscription belongs to a topic and says which events go to which handler and how delivery behaves.

Q4Does Event Grid guarantee that events arrive exactly once, in order?

No. Push delivery is at least once, and order is not guaranteed, so handlers must tolerate duplicates and disorder.

Q5What happens if my handler is down?

Event Grid retries with increasing waits for the configured time. If it still fails, the event is dead-lettered to storage if you configured that, otherwise dropped.

Q6When should I use Event Grid instead of Service Bus?

Use Event Grid to announce that something happened to many listeners. Use Service Bus when a message represents work that must be processed reliably, possibly in order, by one consumer.

Q7Can Event Grid handle streams from thousands of devices?

The classic service is built for discrete events. For continuous streams, Event Hubs is the usual choice. The newer namespace MQTT broker addresses device messaging, but check current limits and features.

Q8What is the difference between push and pull delivery?

In push, Event Grid calls your handler. In pull, your handler connects and fetches events at its own pace, then acknowledges them. Pull suits private or rate-limited consumers.

Q9Why did my webhook subscription fail to create?

Usually because the endpoint did not answer the validation handshake, or the request was blocked by a firewall or gateway.

Q10How do I secure publishing?

Use Microsoft Entra identities with a data sender role, restrict network access, and avoid or rotate access keys. Keep secrets out of event data.

Q11How do I avoid processing the same event twice?

Make handlers idempotent by recording processed event identifiers or using operations that give the same result when repeated.

Q12How much does it cost?

Mainly per operation, with a free monthly allowance for the classic service, and capacity plus operation charges for namespace features. Downstream compute and storage often cost more. Check the current pricing page.

Q13Is the guidance in this article permanent?

The concepts are stable, but features, schemas, limits, supported sources, namespace capabilities and prices change. Confirm details in the current official documentation before finalizing a design.

25Summary and Key Takeaways

Event Grid is the announcement system of your cloud. Sources publish small, factual events to topics; subscriptions filter them and deliver copies to handlers such as functions, workflows, queues and web services. The system retries with backoff, saves undelivered events in a dead-letter location, and scales without servers to manage. Because delivery is at least once and unordered, handlers must be idempotent and tolerant of disorder, and fragile handlers belong behind queues. Security rests on identities, narrow roles, careful network control and small events free of sensitive data. The newer namespace features add an MQTT broker for devices and pull delivery for controlled consumers, while Service Bus and Event Hubs remain the right tools for reliable work messages and high-volume streams. Because capabilities and pricing keep evolving, hold on to the lasting ideas in this guide and verify the details in current documentation. With these habits, your systems stop polling and start listening, and they grow by adding subscribers instead of rewriting senders.

Key Takeaways

  • Announce facts, do not issue commands — events say what happened; use messages and queues when work must be done reliably by one processor.
  • Know the vocabulary — source, topic, subscription, handler and schema explain almost every design, with system, custom, partner and domain topics covering different publishers.
  • Filter early and separate handlers — use event type, subject and advanced filters in the subscription, and give each handler its own subscription.
  • Design for at-least-once, unordered delivery — idempotent handlers, version checks, and queues in front of slow or bursty consumers.
  • Always dead-letter and watch it — configure storage for undeliverable events, alert on them, and rehearse replay.
  • Secure by identity — Entra identities, managed identities, narrow roles, private networking where required, and small events without secrets.
  • Choose the right service and verify the details — Event Grid for discrete notifications, Service Bus for reliable work, Event Hubs for streams, and confirm current features, schemas and prices before building.