Edit

Add Azure IoT Hub as source in Real-Time hub

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

Prerequisites

  • Access to a workspace in the Fabric capacity license mode or trial license mode with Contributor or higher permissions.
  • Appropriate permission to get your IoT hub's access keys. If your IoT hub is within a protected network, connect to it by using a streaming vNet data gateway. Otherwise, ensure that the IoT hub is publicly accessible and not behind a firewall.

Data sources page

  1. Sign in to Microsoft Fabric.

  2. If you see Power BI at the bottom-left of the page, switch to the Fabric workload by selecting Power BI and then by selecting Fabric.

    Screenshot that shows how to switch to the Fabric workload.

  3. Select Real-Time on the left navigation bar.

    Screenshot that shows how to launch Connect to data source experience.

  4. The Streaming data page opens by default. Click on the Add data button to get to the Data sources page.

    Screenshot that shows the Data sources page in the Real-Time hub.

    You can also get to the Data sources page directly by selecting the Add data option in the left navigation bar.

    Screenshot that shows the Connect data source button.

Select Azure IoT Hub as a source

On the Data sources page, select Microsoft sources category at the top, and then select Connect on the Azure IoT Hub tile.

Screenshot that shows the selection of Azure IoT Hub as the source type in the Data sources page.

Now, follow instructions from the Connect to an Azure iot hub section.

Connect to an Azure iot hub

  1. On the Connect page, select New connection.

    Screenshot that shows the Connect page with the link for a new connection highlighted.

    If there's an existing connection to your IoT hub, select that existing connection, and then move on to configuring Data format in the following steps.

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

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

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

  3. In the Connection credentials section, follow these steps:

    1. If there's an existing connection, select it from the dropdown 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 kind, 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.

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

      1. Go to the page for your IoT hub in the Azure portal.
      2. On the left pane, under Security settings, select Shared access policies.
      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 IoT hub.

  4. Select Connect.

    Screenshot that shows the Connect button under connection credentials for an Azure IoT Hub connector.

  5. For Consumer group, enter the name of the consumer group. The default consumer group for the IoT hub is $Default.

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

Stream or source details

  1. On the Connect page, follow one of these steps based on whether you're using Eventstream or Real-Time hub.

    • Eventstream:

      In the Source details pane to the right, follow these steps:

      1. For Source name, select the Pencil button to change the name.

      2. Notice that Eventstream name and Stream name are read-only.

    • Real-Time hub:

      In the Stream details section to the right, follow these steps:

      1. Select the Fabric workspace where you want to create the eventstream.

      2. For Eventstream name, select the Pencil button, and enter a name for the eventstream.

      3. The Stream name value is automatically generated for you by appending -stream to the name of the eventstream. This stream appears on the real-time hub's All data streams page when the wizard finishes.

  2. Select Next at the bottom of the Configure page.

Review and connect

On the Review + connect screen, review the summary, and select Add (Eventstream) or Connect (Real-Time hub).

  1. On the Connect page, for Feature level, select Extended features (Preview).

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

    If there's an existing connection to your Azure IoT Hub, select that existing connection, and then move on to the step to configure Azure IoT Hub data source.

  2. In the Connection settings section, enter the name of your Azure IoT Hub:

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

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

    1. If there's an existing connection, select it from the dropdown 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 Data gateway, select the appropriate option based on your IoT Hub network configuration:

      • If your IoT Hub is public, select none.
      • If your IoT Hub is under a private network and you want to connect through a streaming virtual network data gateway, select the streaming vNet data gateway (prefixed with [Streaming VNet]). You can select the refresh icon to get the newly created gateway listed.

      Note

      If a data gateway is selected, skip the test connection step in this connection creation wizard.

    4. For Authentication kind, the default value is Shared Access Key.

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

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

    7. Select Connect at the bottom of the page.

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

      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 under Security settings 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. 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.

  5. For Starting position, select where in the stream to start reading records.

  6. Then, select Next at the bottom of the page.

    Screenshot that shows the Stream details section for Azure IoT Hub connector.

  7. On the Review + connect page, select Add now.

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

Stream or source details

  1. On the Connect page, follow one of these steps based on whether you're using Eventstream or Real-Time hub.

    • Eventstream:

      In the Source details pane to the right, follow these steps:

      1. For Source name, select the Pencil button to change the name.

      2. Notice that Eventstream name and Stream name are read-only.

    • Real-Time hub:

      In the Stream details section to the right, follow these steps:

      1. Select the Fabric workspace where you want to create the eventstream.

      2. For Eventstream name, select the Pencil button, and enter a name for the eventstream.

      3. The Stream name value is automatically generated for you by appending -stream to the name of the eventstream. This stream appears on the real-time hub's All data streams page when the wizard finishes.

  2. Select Next at the bottom of the Configure page.

View data stream details

  1. On the Review + connect 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 Finish at the bottom of the page.

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

  2. You should see the stream in the Recent streaming data section of the Real-Time hub home page. For detailed steps, see View details of data streams in Fabric Real-Time hub.

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