Edit

Share via


Add Azure IoT Hub source to an eventstream

This article shows you how to add an Azure IoT Hub source to a Microsoft Fabric eventstream.

Note

Enhanced capabilities are enabled by default when you create eventstreams. If you have eventstreams that you created via standard capabilities, those eventstreams will continue to work. You can still edit and use them as usual. We recommend that you create a new eventstream to replace standard eventstreams so that you can take advantage of additional capabilities and benefits of enhanced eventstreams.

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 managed private endpoint. Otherwise, ensure that the IoT hub is publicly accessible and not behind a firewall.
  • An eventstream. If you don't have an eventstream, create one.

Start the wizard for selecting a data source

If you haven't added any source to your eventstream yet, select the Use external source tile.

Screenshot that shows the selection of the tile for using an external source.

If you're adding the source to an already published eventstream, switch to Edit mode. On the ribbon, select Add source > External sources.

Screenshot that shows selections for adding external sources.

On the Select a data source page, search for Azure IoT Hub. On the Azure IoT Hub tile, select Connect.

Screenshot that shows the selection of Azure IoT Hub as the source type in the wizard for getting events.

Configure an Azure IoT Hub connector

  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.

  7. In the Stream details section on the right, select the pencil icon under Source name, and then enter a name for the source. This step is optional.

  8. Select Next at the bottom of the page.

    Screenshot that shows configuration settings and stream details for an Azure IoT Hub connector.

  9. On the Review and create page, review your settings, and then select Add.

    Screenshot that shows the page for reviewing settings and adding an Azure IoT Hub connector.

Note

An eventstream can support up to 11 combined sources and destinations only when you're using the following types:

  • Source: Custom endpoint.
  • Destinations: Custom endpoint and eventhouse with direct ingestion.

Any sources or destinations not included in the preceding list, and destinations not appended to the default stream, don't count toward this limit.

View an updated eventstream

  1. Confirm that the Azure IoT Hub source is added to your eventstream on the canvas in the Edit mode. To implement this newly added IoT hub, select Publish on the ribbon.

    Screenshot that shows the editor with the Publish button selected.

  2. The IoT hub is available for visualization in the Live view. Select the IoT hub tile in the diagram to display a page similar to the following example.

    Screenshot that shows the editor in the live view.

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. The IoT hub must be publicly accessible and not behind a firewall or secured in a virtual network.

Note

An eventstream can support up to 11 combined sources and destinations only when you're using the following types:

  • Source: Custom endpoint.
  • Destinations: Custom endpoint and eventhouse with direct ingestion.

Any sources or destinations not included in the preceding list, and destinations not appended to the default stream, don't count toward this limit.

Add an IoT hub as a source

Follow these steps to add an IoT hub as your eventstream source:

  1. In the eventstream editor, expand the New source dropdown menu within the node and select Azure IoT Hub.

    Screenshot that shows where to add an Azure IoT Hub source in an eventstream.

  2. On the Azure IoT Hub configuration pane, enter the following details. Then select Add to finish the configuration.

    1. Source name: Enter a name for your IoT hub, such as iothub-source.
    2. Cloud connection: Select an existing cloud connection that links your IoT hub to Microsoft Fabric. If you don't have one, proceed to step 4 to create a new cloud connection.
    3. Consumer group: Choose a consumer group from your IoT hub, or leave it as $Default.
    4. Data format: Choose a data format (Avro, JSON, or CSV) for streaming your IoT hub data into the eventstream.

    Screenshot that shows configuration details for Azure IoT Hub in an eventstream.

  3. Confirm that an Azure IoT Hub source is added to your eventstream in the editor.

    Screenshot that shows an Azure IoT Hub source in the eventstream editor.

  4. To create a new cloud connection for your IoT hub, follow these steps:

    1. On the dropdown menu, select Create new.

      Screenshot that shows the link for creating a new cloud connection.

    2. For IoT Hub, enter the name of the IoT hub in the Azure portal.

    3. For Connection name, enter a name for the new cloud connection, such as iothub-connection.

    4. For Shared access key name and Shared access key, enter the connection credentials for your IoT hub. You can find them under Shared access policies in the Azure portal. You must have appropriate permissions to access any of the Azure IoT Hub endpoints.

      Screenshot that shows where to find a shared access key in the Azure portal.

    5. Select Create.

      Screenshot that shows connection settings and connection credentials for a new cloud connection.

    6. Return to the Azure IoT Hub configuration pane and select Refresh to load the new cloud connection.

      Screenshot that shows the button for refreshing the cloud connection for Azure IoT Hub.

  5. After the IoT hub is added to your eventstream, select Preview data to verify successful configuration. You should be able to preview incoming data to your eventstream.

    Screenshot that shows a preview of Azure IoT Hub data.

To learn how to add other sources to an eventstream, see the following articles: