Integrating with Schema Registry in Azure Stream Analytics (Public Preview)
Azure Event Hubs hosts a Schema Registry that acts as a centralized repository for schema. With the integration with the Schema Registry, Azure Stream Analytics can retrieve schema from the Schema Registry and deserialize data from Event Hubs input. By moving schema metadata into the Schema Registry, you can reduce per-message overhead and enables efficient schema validation to ensure the integrity of the data.
This article shows you how to add the Schema Registry to your Stream Analytics job, and connect with the Event Hubs input.
Prerequisites
Before you start, make sure you have the following:
- An Event Hubs namespace.
- A Schema Group with schemas in a Schema Registry hosted by Azure Event Hubs. Create an Azure Event Hubs Schema Registry if you don't have one.
- An Azure Stream Analytics job with managed identity enabled.
Manage the job access to the Schema Registry
To access the Event Hubs Schema Registry, you need to assign Schema Registry Reader role to your Stream Analytics job using security principal.
Sign in to the Azure portal and go to your Stream Analytics job page.
Select Managed Identity page, and save the Principal name for later use. See Managed Identities for more details.
Go to your Event Hubs namespace page that the Schema Registry is hosted. Select Access Control and Add role assignment.
Search for Schema Registry Reader and click Next.
At Members page, select the Principal name you saved from step 1 and click on Review + assign.
Add Schema Registry to the Stream Analytics job
- On the Stream Analytics job portal, select Schema Registry under Settings on the left menu.
- Select Add Schema Registry
- On the New Schema Registry page, follow the steps below:
For Name, enter the alias name for this Schema Registry,
For Subscription, select the subscription that has the Event Hubs namespace, hosting the Schema Registry.
For Event Hubs namespace, select the namespace that the Schema Registry is under.
If you don't have access to the subscription, you can also use manual entry.
Configure the Event Hubs input
Important
Schema formats are used to determine the manner in which a schema is structured and defined. Only AVRO format is supported now.
Navigate to the Inputs page. Add a new Event Hubs input or choose an existing Event Hubs input.
To connect the Schema Registry to the selected Event Hubs, scroll down to the bottom of the configuration page.
Select AVRO for Event Serialization format.
Select the Schema Registry from the drop-down menu and Save.
Preview the input data
Azure Stream Analytics automatically fetches events from the streaming inputs. It provides a convenient way to test the Schema Registry integration without starting or stopping your job.
On the Stream Analytics job page, select Job Topology -> Query to open the Query editor window.
Select the configured Event Hubs input. Make sure there's a file icon next to the selected input.
The sample events will automatically appear in the input preview.
See Test an Azure Stream Analytics job with sample data for more information about query testing.
Limitations
- The authentication method of the Schema Registry only supports Managed Identity. The authentication method of the Event Hubs input must be Managed Identity when the Schema Registry is selected.
- Test connection feature isn't yet available for Schema Registry. The best way to verify the connection built with the Schema Registry is through input preview on query testing page.
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for