Azure Event Grid event schema - Azure Event Grid (2024)

  • Article

This article describes the Event Grid schema, which is a proprietary, nonextensible, yet fully functional event format. Event Grid still supports this event format and will continue to support it. However, CloudEvents is the recommended event format to use. If you're using applications that use the Event Grid format, you may find useful the information in the [CloudEvents] section that describes the transformations between the Event Grid and CloudEvents format supported by Event Grid.

This article describes in detail the properties and schema for the Event Grid format. Events consist of a set of four required string properties. The properties are common to all events from any publisher. The data object has properties that are specific to each publisher. For system topics, these properties are specific to the resource provider, such as Azure Storage or Azure Event Hubs.

Event sources send events to Azure Event Grid in an array, which can have several event objects. When posting events to an Event Grid topic, the array can have a total size of up to 1 MB. Each event in the array is limited to 1 MB. If an event or the array is greater than the size limits, you receive the response 413 Payload Too Large. Operations are charged in 64 KB increments though. So, events over 64 KB incur operations charges as though they were multiple events. For example, an event that is 130 KB would incur operations as though it were three separate events.

Event Grid sends the events to subscribers in an array that has a single event. This behavior may change in the future.

You can find the JSON schema for the Event Grid event and each Azure publisher's data payload in the Event Schema store.

Event schema

The following example shows the properties that are used by all event publishers:

[ { "topic": string, "subject": string, "id": string, "eventType": string, "eventTime": string, "data":{ object-unique-to-each-publisher }, "dataVersion": string, "metadataVersion": string }]

For example, the schema published for an Azure Blob storage event is:

[ { "topic": "/subscriptions/{subscription-id}/resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/xstoretestaccount", "subject": "/blobServices/default/containers/oc2d2817345i200097container/blobs/oc2d2817345i20002296blob", "eventType": "Microsoft.Storage.BlobCreated", "eventTime": "2017-06-26T18:41:00.9584103Z", "id": "831e1650-001e-001b-66ab-eeb76e069631", "data": { "api": "PutBlockList", "clientRequestId": "6d79dbfb-0e37-4fc4-981f-442c9ca65760", "requestId": "831e1650-001e-001b-66ab-eeb76e000000", "eTag": "0x8D4BCC2E4835CD0", "contentType": "application/octet-stream", "contentLength": 524288, "blobType": "BlockBlob", "url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", "sequencer": "00000000000004420000000000028963", "storageDiagnostics": { "batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0" } }, "dataVersion": "", "metadataVersion": "1" }]

Event properties

All events have the same following top-level data:

PropertyTypeRequiredDescription
topicstringNo, but if included, must match the Event Grid topic Azure Resource Manager ID exactly. If not included, Event Grid stamps onto the event.Full resource path to the event source. This field isn't writeable. Event Grid provides this value.
subjectstringYesPublisher-defined path to the event subject.
eventTypestringYesOne of the registered event types for this event source.
eventTimestringYesThe time the event is generated based on the provider's UTC time.
idstringYesUnique identifier for the event.
dataobjectYesEvent data specific to the resource provider.
dataVersionstringNo, but will be stamped with an empty value.The schema version of the data object. The publisher defines the schema version.
metadataVersionstringNot required, but if included, must match the Event Grid Schema metadataVersion exactly (currently, only 1). If not included, Event Grid stamps onto the event.The schema version of the event metadata. Event Grid defines the schema of the top-level properties. Event Grid provides this value.

To learn about the properties in the data object, see the event source:

  • Azure Policy
  • Azure subscriptions (management operations)
  • Container Registry
  • Blob storage
  • Event Hubs
  • IoT Hub
  • Media Services
  • Resource groups (management operations)
  • Service Bus
  • Azure SignalR
  • Azure Machine Learning

For custom topics, the event publisher determines the data object. The top-level data should have the same fields as standard resource-defined events.

When publishing events to custom topics, create subjects for your events that make it easy for subscribers to know whether they're interested in the event. Subscribers use the subject to filter and route events. Consider providing the path for where the event happened, so subscribers can filter by segments of that path. The path enables subscribers to narrowly or broadly filter events. For example, if you provide a three segment path like /A/B/C in the subject, subscribers can filter by the first segment /A to get a broad set of events. Those subscribers get events with subjects like /A/B/C or /A/D/E. Other subscribers can filter by /A/B to get a narrower set of events.

Sometimes your subject needs more detail about what happened. For example, the Storage Accounts publisher provides the subject /blobServices/default/containers/<container-name>/blobs/<file> when a file is added to a container. A subscriber could filter by the path /blobServices/default/containers/testcontainer to get all events for that container but not other containers in the storage account. A subscriber could also filter or route by the suffix .txt to only work with text files.

CloudEvents

CloudEvents is the recommended event format to use. Azure Event Grid continues investing in features related to at least CloudEvents JSON format. Given the fact that some event sources like Azure services use the Event Grid format, the following table is provided to help you understand the transformation supported when using CloudEvents and Event Grid formats as an input schema in topics and as an output schema in event subscriptions. An Event Grid output schema can't be used when using CloudEvents as an input schema because CloudEvents supports extension attributes that aren't supported by the Event Grid schema.

Input schemaOutput schema
CloudEvents formatCloudEvents format
Event Grid formatCloudEvents format
Event Grid formatEvent Grid format

Next steps

  • For an introduction to Azure Event Grid, see What is Event Grid?
  • For more information about creating an Azure Event Grid subscription, see Event Grid subscription schema.
Azure Event Grid event schema - Azure Event Grid (2024)

FAQs

What is the difference between Azure Eventhub and Eventgrid? ›

Another difference is the delivery mechanism that they use. Azure Event Grid uses push delivery, which means that it pushes the events to the subscribers as soon as they are available. Azure Event Hub uses pull delivery, which means that the subscribers have to pull the events from the service at their own pace.

What is an event grid How does the event grid work? ›

Event Grid connects your app with other services. For example, create a topic to send your app's event data to Event Grid, and get reliable delivery and advanced routing on Azure and on Kubernetes. Use Event Grid with Azure Logic Apps to process data anywhere, without writing code.

What is the event header value for CloudEvents schema and the event grid schema? ›

For the CloudEvents schema, that header value is "content-type":"application/cloudevents+json; charset=utf-8" . For the Event Grid schema, that header value is "content-type":"application/json; charset=utf-8" .

What is the maximum size of event grid event? ›

When posting events to an Event Grid topic, the array can have a total size of up to 1 MB. Each event in the array is limited to 1 MB. If an event or the array is greater than the size limits, you receive the response 413 Payload Too Large.

Is Azure event grid like Kafka? ›

Kafka is a data ingestion tool that can ingest data from various sources, such as databases, applications, and IoT devices. It supports multiple data formats, including JSON, Avro, and XML. Azure Event Grid supports data ingestion from various sources, including Azure services and third-party applications.

How does Azure event grid work? ›

Azure Event Grid is a highly scalable, fully managed Pub Sub message distribution service that offers flexible message consumption patterns using the MQTT and HTTP protocols. With Azure Event Grid, you can build data pipelines with device data, integrate applications, and build event-driven serverless architectures.

What are two characteristics of Azure event grid? ›

Event Grid provides reliable message delivery at massive scale and can be used as a fully managed service on Azure or on your own Kubernetes clusters. Use Event Grid to build reactive, event-driven apps in a modern, serverless or on-prem compute architecture—eliminating polling and its associated cost and latency.

How do I view events in Azure event grid? ›

Sign in to Azure portal. In the search bar at the topic, type Event Grid Topics, and then select Event Grid Topics from the drop-down list. Select your custom topic from the list of topics. View the metrics for the custom event topic on the Event Grid Topic page.

What is the size of event grid event in Azure? ›

The maximum allowed size for an event is 1 MB. Events over 64 KB are charged in 64-KB increments.

How do you define event schema? ›

An event schema defines the structure, data format, and data types of the events that are produced and consumed by the different components of the system. This schema allows each component to understand the format and meaning of the events, and to process them in a consistent way.

How do you create an event schema? ›

Here's a step-by-step guide to get you started:
  1. Choose a Structured Data Markup Format. There are several ways to implement Event Schema, including using JSON-LD, Microdata, or RDFa. ...
  2. Identify Event Schema Properties. ...
  3. Create Structured Data Code. ...
  4. Embed Structured Data Code. ...
  5. Test and Validate.
Nov 16, 2023

What is a event schema? ›

An event schema, also known as a cognitive script, is a set of behaviors that can feel like a routine.

How do you create an event in event grid? ›

Create an event subscription

On the Event Grid System Topic page, select + Event Subscription from the toolbar. Confirm that the Topic Type, Source Resource, and Topic Name are automatically populated. Enter a name, select an Endpoint Type, and specify the endpoint. Then, select Create to create the event subscription.

What is the maximum size of Azure event? ›

The maximum message size allowed for Event Hubs is 1 MB.

What is the purpose of Azure event hub? ›

Azure Event Hubs is a cloud native data streaming service that can stream millions of events per second, with low latency, from any source to any destination. Event Hubs is compatible with Apache Kafka, and it enables you to run existing Kafka workloads without any code changes.

When to use Azure EventHub? ›

When to use Azure Event Hubs? Event Hubs is the component to use for real-time and/or streaming data use cases: Real-time reporting. Capture streaming data into files for further processing and analysis – e.g. capturing data from micro-service applications or a mobile app.

Why use Azure event grid? ›

Event Grid provides reliable message delivery at massive scale and can be used as a fully managed service on Azure or on your own Kubernetes clusters. Use Event Grid to build reactive, event-driven apps in a modern, serverless or on-prem compute architecture—eliminating polling and its associated cost and latency.

What is the difference between Azure Eventgrid and Service Bus? ›

Azure Event Grid provides a range of developer tools, including SDKs, REST APIs, and Azure CLI, to help developers build event-driven applications quickly and easily. Azure Service Bus offers integration with popular development tools and platforms, including Visual Studio, Eclipse, and GitHub.

Top Articles
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 6472

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.