An event represents something that happens inside an Azure service (called the source) that communicates the event externally and that can be intercepted and managed by another Azure service (called the destination).
An event is composed of a set of information coded in a JSON format with a well-defined schema.
Azure Event Grid supports two different schemas for the events it can manage:
- Azure event schema: This is a schema defined by Azure, and its format is like the following:
[
{
"topic": string,
"subject": string,
"id": string,
"eventType": string,
"eventTime": string,
"data":{
object-unique-to-each-publisher
},
"dataVersion": string,
"metadataVersion": string
}
]
Events have a common set of properties that identify each event and its source:
-
- topic: Identifies the source of the event (the full resource path)—for example, a blob storage event has the following topic:
/subscriptions/{subscription-id}/resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/{storageAccountName}
-
- subject: The full path of the event's subject is defined by the source publisher—for example, a blob storage event can publish a subject like the following:
/blobServices/default/containers/oc2d2817345i200097container/blobs/oc2d2817345i20002296blob
-
- eventType: Describes the event type—for example, blob storage can publish an event with eventType Microsoft.Storage.BlobCreated.
- eventTime: The UTC time when the event was generated.
- id: The event's unique identifier.
- dataVersion: The schema version of the data object. This property allows sources to evolve and change their data schema in the future.
- metadataVersion: The schema version of the event metadata. Event Grid defines the schema of the top-level properties.
- data: Contains the data for the specific events—for example, a blob storage event looks like the following:
"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",
}
- CloudEvents schema: An open specification for describing events in a generic cloud provider. Azure Event Grid supports both Azure event schemas and CloudEvent schemas. An event serialized on CloudEvents schemas looks like the following:
{ "specversion" : "0.3", "type" : "Microsoft.Storage.BlobCreated", "source" : "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}", "subject" : "/blobServices/default/containers/oc2d2817345i200097container/blobs/oc2d2817345i20002296blob", "id" : "173d9985-401e-0075-2497-de268c06ff25", "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { "othervalue": 5 }, "datacontenttype" : "text/json", "data" : "{ 'api': 'PutBlockList',..., 'blobType': 'BlockBlob', 'url': 'https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob' }" }
You can use both Azure events schemas (also known as Event Grid schemas) and CloudEvents for your input and output in Azure Event Grid.
Event sources always send events to Azure Event Grid as an array, even if there is only one event and the maximum size for the array is 1 MB. Each event in the array may have a size of up to 64 KB. If the size of the array is over the limits, you will receive an HTTP error 413 (payload too large) when you try to send the array.