Add Azure IoT Hub as source in Real-Time hub (preview)

This article describes how to get events from an Azure IoT hub into Real-Time hub.

Note

Real-Time hub is currently in preview.

Prerequisites

  • Get access to the Fabric premium workspace with Contributor or above permissions.
  • Create an Azure IoT hub if you don't have one.
  • You need to have appropriate permission to get IoT hub's access keys. The IoT hub must be publicly accessible and not behind a firewall or secured in a virtual network.

Get events from an Azure IoT hub

You can get events from an Azure IoT hub into Real-Time hub in one of the ways:

Launch Add source experience

  1. Sign in to Microsoft Fabric.

  2. Select Real-Time hub on the left navigation bar.

  3. On the Real-Time hub page, select + Add source in the top-right corner of the page.

    Screenshot that shows how to launch Real-Time hub In Microsoft Fabric.

Use instructions from the Add an Azure IoT hub as a source section.

Microsoft sources page

  1. In Real-Time hub, select Microsoft sources.

  2. In the Source drop-down list, select Azure IoT Hub.

  3. For Subscription, select an Azure subscription that has the resource group with your IoT hub.

  4. For Resource group, select a resource group that has your IoT hub.

  5. For Region, select a location where your IoT hub is located.

  6. Now, move the mouse over the name of the IoT hub that you want to connect to Real-Time hub in the list of IoT hubs, and select the Connect button, or select ... (ellipsis), and then select the Connect button.

    Screenshot that shows the Microsoft sources page with filters to show IoT hubs and the connect button for an IoT hub.

    To configure connection information, use steps from the Add an Azure IoT hub as a source section. Skip the first step of selecting Azure IoT Hub as a source type in the Add source wizard.

Add an Azure IoT hub as a source

  1. On the Select a data source page, select Azure IoT Hub.

    Screenshot that shows the selection of Azure IoT Hub as the source type in the Add source wizard.

  2. If there's an existing connection to your Azure IoT hub, select that existing connection as shown in the following image, and then move on to the step to configure Data format in the following steps.

    Screenshot that shows the Connect page with an existing connection to an Azure IoT hub.

  3. On the Connect page, select Go to resource to navigate to the Azure IoT hub. Take a note of the access key name and its value.

    Screenshot that shows the Connect page with Go to resource link highlighted.

    To get the access key name and value, follow these steps:

    1. Navigate to the IoT Hub page for your Azure IoT hub in the Azure portal.

    2. On the IoT Hub page, select Shared access policies on the left navigation menu.

    3. Select a policy name from the list. Note down the policy name.

    4. Select the copy button next to the Primary key.

      Screenshot that shows the access key for an Azure IoT Hub.

  4. On the Connect page, select New connection.

    Screenshot that shows the Connect page the New connection link highlighted.

  5. In the Connection settings section, for IoT Hub, specify the name of your Azure IoT hub.

    Screenshot that shows the connection settings for the IoT hub with the name of the IoT hub.

  6. In the Connection credentials section, do these steps:

    1. If there's an existing connection, select it from the drop-down list. If not, confirm that Create new connection is selected for this option.

    2. For Connection name, enter a name for the connection to the IoT hub.

    3. For Authentication method, confirm that Shared Access Key is selected.

    4. For Shared Access Key Name, enter the name of the shared access key.

    5. For Shared Access Key, enter the value of the shared access key.

    6. Select Connect at the bottom of the page.

      Screenshot that shows the Connect page one for Azure IoT Hub connector.

  7. Now, on the Connect page of wizard, for Consumer group, enter the name of the consumer group. By default, $Default is selected, which is the default consumer group for the IoT hub.

  8. For Data format, select a data format of the incoming real-time events that you want to get from your Azure IoT hub. You can select from JSON, Avro, and CSV data formats, and then select Connect.

  9. In the Stream details section to the right, select the Fabric workspace where you want to save the eventstream that the Wizard is going to create.

  10. For eventstream name, enter a name for the eventstream. The wizard creates an eventstream with the selected Azure IoT hub as a source.

  11. The Stream name is automatically generated for you by appending -stream to the name of the eventstream. You can see this stream on the Real-time hub All data streams page when the wizard finishes.

  12. Select Next at the bottom of the page.

    Screenshot that shows the Connect page two for Azure IoT Hub connector.

  13. On the Review and create page, review settings, and select Create source.

    Screenshot that shows the Review and create page for Azure IoT Hub connector.

View data stream details

  1. On the Review and create page, if you select Open eventstream, the wizard opens the eventstream with the selected Azure IoT hub as a source. To close the wizard, select Close at the bottom of the page.

    Screenshot that shows the Review and create page with links to open eventstream and close the wizard.

  2. In Real-Time hub, select All data streams. To see the new data stream, refresh the All data streams page.

    Screenshot that shows the Real-Time hub All data streams page with the stream you just created.

    For detailed steps, see View details of data streams in Fabric Real-Time hub.

To learn about consuming data streams, see the following articles: