Add an IoT hub event source to your Azure Time Series Insight environment
The Time Series Insights (TSI) service will no longer be supported after March 2025. Consider migrating existing TSI environments to alternative solutions as soon as possible. For more information on the deprecation and migration, visit our documentation.
This article describes how to use the Azure portal to add an event source that reads data from Azure IoT Hub to your Azure Time Series Insights environment.
The instructions in this article apply both to Azure Time Series Insights Gen 1 and to Azure Time Series Insight Gen 2 environments.
- Create an Azure Time Series Insights environment.
- Create an IoT hub by using the Azure portal.
- The IoT hub must have active message events being sent in.
- Create a dedicated consumer group in the IoT hub for the Azure Time Series Insight environment to consume from. Each Azure Time Series Insight event source must have its own dedicated consumer group that isn't shared with any other consumer. If multiple readers consume events from the same consumer group, all readers are likely to exhibit failures. For details, read the Azure IoT Hub developer guide.
Add a consumer group to your IoT hub
Applications use consumer groups to pull data from Azure IoT Hub. To reliably read data from your IoT hub, provide a dedicated consumer group that's used only by this Azure Time Series Insight environment.
To add a new consumer group to your IoT hub:
In the Azure portal, find and open your IoT hub.
Under Settings, select Built-in Endpoints, and then select the Events endpoint.
Under Consumer groups, enter a unique name for the consumer group. Use this same name in your Azure Time Series Insight environment when you create a new event source.
Add a new event source
Sign in to the Azure portal.
In the left menu, select All resources. Select your Azure Time Series Insight environment.
Under Settings, select Event Sources, and then select Add.
In the New event source pane, for Event source name, enter a name that's unique to this Azure Time Series Insight environment. For example, enter event-stream.
For Source, select IoT Hub.
Select a value for Import option:
If you already have an IoT hub in one of your subscriptions, select Use IoT Hub from available subscriptions. This option is the easiest approach.
The following table describes the properties that are required for the Use IoT Hub from available subscriptions option:
Property Description Subscription The subscription the desired iot hub belongs to. IoT hub name The name of the selected iot hub. IoT hub policy name Select the shared access policy. You can find the shared access policy on the IoT hub settings tab. Each shared access policy has a name, permissions that you set, and access keys. The shared access policy for your event source must have service connect permissions. IoT hub policy key The key is prepopulated.
If the IoT hub is external to your subscriptions, or if you want to choose advanced options, select Provide IoT Hub settings manually.
The following table describes the required properties for the Provide IoT Hub settings manually:
Property Description Subscription ID The subscription the desired iot hub belongs to. Resource group The resource group name in which the IoT hub was created. IoT hub name The name of your IoT hub. When you created your IoT hub, you entered a name for the IoT hub. IoT hub policy name The shared access policy. You can create the shared access policy on the IoT hub settings tab. Each shared access policy has a name, permissions that you set, and access keys. The shared access policy for your event source must have service connect permissions. IoT hub policy key The shared access key that's used to authenticate access to the Azure Service Bus namespace. Enter the primary or secondary key here.
Both options share the following configuration options:
Property Description IoT hub consumer group The consumer group that reads events from the IoT hub. We highly recommend that you use a dedicated consumer group for your event source. Event serialization format Currently, JSON is the only available serialization format. The event messages must be in this format or no data can be read. Timestamp property name To determine this value, you need to understand the message format of the message data that's sent to the IoT hub. This value is the name of the specific event property in the message data that you want to use as the event timestamp. The value is case-sensitive. If left blank, the event enqueue time in the event source is used as the event timestamp.
Add the dedicated Azure Time Series Insight consumer group name that you added to your IoT hub.
After you create the event source, Azure Time Series Insight automatically starts streaming data to your environment.