Add Azure IoT Hub source to an eventstream

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

Note

Enhanced capabilities are enabled by default when you create eventstreams now. If you have eventstreams that were created using 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

Before you start, you must complete the following prerequisites:

  • Access to a workspace in the Fabric capacity license mode (or) the Trial license mode with Contributor or higher permissions.
  • 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.
  • If you don't have an eventstream, create an eventstream.

Launch the Select a data source wizard

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

Screenshot that shows the selection of Use external source tile.

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

Screenshot that shows the selection of Add source to External sources menu.

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

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

Configure Azure IoT Hub connector

  1. On the Connect page, select New connection.

    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 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.

  2. 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.

  3. 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.

      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 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.

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

  7. Select Next at the bottom of the page.

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

  8. On the Review and create page, review settings, and select Add.

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

Note

The maximum number of sources and destinations for one eventstream is 11.

View updated eventstream

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

    Screenshot that shows the editor with Publish button selected.

  2. After you complete these steps, the Azure IoT hub is available for visualization in the Live view. Select the IoT hub tile in the diagram to see the page similar to the following one.

    Screenshot that shows the editor in the live view.

For a list of supported sources, see Add an event source in an eventstream

Prerequisites

Before you start, you must complete the following prerequisites:

  • Access to a workspace in the Fabric capacity license mode (or) the Trial license mode with Contributor or higher permissions.
  • 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.

Note

The maximum number of sources and destinations for one eventstream is 11.

Add an Azure IoT hub as a source

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

  1. In the Eventstream editor, expand the New source drop-down menu within the node and choose Azure IoT Hub.

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

  2. On the Azure IoT Hub configuration pane, enter the following details:

    Screenshot that shows where to configure Azure IoT Hub in the eventstream.

    1. Source name: Enter a name for your Azure IoT Hub, such as iothub-source.

    2. Cloud connection: Select an existing cloud connection that links your Azure IoT Hub to Microsoft Fabric. If you don't have one, proceed to step 3 to create a new cloud connection.

    3. Data format. Choose a data format (AVRO, JSON, or CSV) for streaming your IoT Hub data into the eventstream.

    4. Consumer group. Choose a consumer group from your Azure IoT Hub, or leave it as $Default. Then select Add to finish the Azure IoT Hub configuration.

    5. Once it's added successfully, you can see an Azure IoT Hub source added to your eventstream in the editor.

      Screenshot that shows the Azure IoT Hub source in the Eventstream editor.

  3. To create a new cloud connection for your Azure IoT Hub, follow these steps:

    Screenshot that shows where to create a new cloud connection.

    1. Select Create new connection from the drop-down menu, fill in the Connection settings and Connection credentials of your Azure IoT Hub, and then select Create.

      Screenshot that shows where to configure a new cloud connection.

    2. IoT Hub. Enter the name of the IoT Hub in the Azure portal.

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

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

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

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

      Screenshot that shows where to refresh the cloud connection for Azure IoT Hub.

Once the Azure 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 where to preview IoT Hub data.

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