Create an Event Grid data connection for Azure Data Explorer
In this article, you learn how to ingest blobs from your storage account into Azure Data Explorer using an Event Grid data connection. You'll create an Event Grid data connection that sets an Azure Event Grid subscription. The Event Grid subscription routes events from your storage account to Azure Data Explorer via an Azure Event Hubs.
For general information about ingesting into Azure Data Explorer from Event Grid, see Connect to Event Grid.
Note
To achieve the best performance with the Event Grid connection, set the rawSizeBytes
ingestion property via the blob metadata. For more information, see ingestion properties.
Prerequisites
- An Azure subscription. Create a free Azure account.
- An Azure Data Explorer cluster and database. Create a cluster and database.
- A destination table. Create a table or use an existing table.
- An ingestion mapping for the table.
- A storage account. An Event Grid notification subscription can be set on Azure Storage accounts for
BlobStorage
,StorageV2
, or Data Lake Storage Gen2.
Create an Event Grid data connection
In this section, you'll establish a connection between Event Grid and your Azure Data Explorer table.
Under the cluster you created, select Databases > TestDatabase.
Select Data ingestion > Add data connection.
Under Basics, select the connection type: Blob storage and then fill out the form with the following information:
Setting Suggested value Field description Data connection name test-grid-connection The name of the connection that you want to create in Azure Data Explorer. Storage account subscription Your subscription ID The subscription ID where your storage account is. Storage account gridteststorage1 The name of the storage account that you created previously. Event type Blob created or Blob renamed The type of event that triggers ingestion. Blob renamed is supported only for ADLSv2 storage. To rename a blob, navigate to the blob in Azure portal, right-click on the blob and select Rename. Supported types are: Microsoft.Storage.BlobCreated or Microsoft.Storage.BlobRenamed. Resources creation Automatic Define whether you want Azure Data Explorer to create an Event Grid Subscription, an Event Hubs namespace, and an Event Hubs for you. To create resources manually, see Manually create resources for Event Grid ingestion Select Filter settings if you want to track specific subjects. Set the filters for the notifications as follows:
- Prefix field is the literal prefix of the subject. As the pattern applied is startswith, it can span multiple containers, folders, or blobs. No wildcards are allowed.
- To define a filter on the blob container, the field must be set as follows:
/blobServices/default/containers/[container prefix]
. - To define a filter on a blob prefix (or a folder in Azure Data Lake Gen2), the field must be set as follows:
/blobServices/default/containers/[container name]/blobs/[folder/blob prefix]
.
- To define a filter on the blob container, the field must be set as follows:
- Suffix field is the literal suffix of the blob. No wildcards are allowed.
- Case-Sensitive field indicates whether the prefix and suffix filters are case-sensitive
- For more information about filtering events, see Blob storage events.
- Prefix field is the literal prefix of the subject. As the pattern applied is startswith, it can span multiple containers, folders, or blobs. No wildcards are allowed.
Select Next: Ingest properties.
Fill out the form with the following information. Table and mapping names are case-sensitive:
Ingest properties:
Setting Suggested value Field description Allow routing the data to other databases (Multi database data connection) Don't allow Turn on this option if you want to override the default target database associated with the data connection. For more information about database routing, see Events routing. Table name TestTable The table you created in TestDatabase. Data format JSON Supported formats are Avro, CSV, JSON, MULTILINE JSON, ORC, PARQUET, PSV, SCSV, SOHSV, TSV, TXT, TSVE, APACHEAVRO, RAW, and W3CLOG. Supported compression options are Zip and Gzip. Mapping TestMapping The mapping you created in TestDatabase, which maps incoming data to the column names and data types of TestTable. If not specified, an identity data mapping derived from the table's schema is used. Advanced settings My data has headers Ignores headers. Supported for *SV type files. Note
You don't have to specify all Default routing settings. Partial settings are also accepted.
Select Next: Review + create
Under *Review + create.
Review the resources that were auto created for you and select Create.
Wait until the deployment is completed. If your deployment failed, select Operation details next to the failed stage to get more information for the failure reason. Select Redeploy to try to deploy the resources again. You can alter the parameters before deployment.
Remove an Event Grid data connection
To remove the Event Grid connection from the Azure portal, do the following:
- Go to your cluster. From the left menu, select Databases. Then, select the database that contains the target table.
- From the left menu, select Data connections. Then, select the checkbox next to the relevant Event Grid data connection.
- From the top menu bar, select Delete.