How to send data from multiple sensors to IoT hub on Azure?

Amber Bhanarkar 0 Reputation points
2023-02-09T06:31:02.5566667+00:00

I have a use case from Customer where I need to send data from 5000 sensors to Azure IoT hub. Is there any dynamic way of sending this data at once without the need to configure each device everytime?Also, what information is needed to the customer to connect to Azure IoT hub? Is it connection string, primary key or more?

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,235 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. QuantumCache 20,346 Reputation points
    2023-02-09T17:36:12.5966667+00:00

    Hello Amber Bhanarkar,

    In order to connect the devices to the IoT hub, the minimum requirement is the device connection string, which can be obtained from the Azure portal. The device connection string includes the hostname, device ID, and shared access key. which are used to authenticate the device and establish a secure connection to the IoT hub.

    User's image

    Question: Is there any dynamic way of sending this data at once without the need to configure each device everytime?

                By using the [Device Provisioning Service (DPS)](https://learn.microsoft.com/en-us/azure/iot-dps/quick-setup-auto-provision), you can dynamically add new devices to the IoT hub without the need to manually configure each device every time. This makes it easier to scale your IoT solution as your needs change.
    

    Many of the manual steps traditionally involved in provisioning are automated with DPS to reduce the time to deploy IoT devices and lower the risk of manual error. The following diagram describes what goes on behind the scenes to get a device provisioned. The first step is manual, all of the following steps are automated.

    Diagram that shows how the device, Device Provisioning Service, and IoT Hub work together.

    *Before the device provisioning flow begins, **there are two manual steps to prepare. **

    • On the device side, the device manufacturer prepares the device for provisioning by preconfiguring it with its authentication credentials and assigned Device Provisioning Service ID and endpoint.
    • On the cloud side, you or the device manufacturer prepares the Device Provisioning Service instance with individual enrollments and enrollments groups that identify valid devices and define how they should be provisioned.*

    Question: Also, what information is needed to the customer to connect to Azure IoT hub? Is it connection string, primary key or more?

     To connect to Azure IoT Hub, you will need to provide the customer with the following information: 
    
    • IoT Hub hostname: The hostname of the IoT hub that the device will connect to. This is in the format "iothubname.azure-devices.net".
    • Device ID: A unique identifier for the device that is being connected. The device ID is used to authenticate the device and establish a secure connection to the IoT hub.
    • Authentication information: Depending on the authentication mechanism being used, the customer will need either a connection string or a primary key.
    • Connection string: A connection string that combines the IoT hub hostname, device ID, and authentication information into a single string. This string can be used to connect the device to the IoT hub.
    • Primary key: A shared secret that is used to authenticate the device when it connects to the IoT hub. The primary key is used in conjunction with the device ID to establish a secure connection.

    In the case of Azure IoT Hub Device Provisioning Service (DPS), the device ID and authentication information are automatically provisioned and managed by the service, so the customer does not need to manually configure each device. Instead, the customer can simply provide the device with the required information to securely connect to the IoT hub through the DPS.

    Send a telemetry message

    Please leave a comment in the below section for further help in this matter, happy to help!

    1 person found this answer helpful.
    0 comments No comments

  2. Sander van de Velde | MVP 34,766 Reputation points MVP
    2023-02-09T13:16:02.6233333+00:00

    Hello @Amber Bhanarkar ,

    There are several ways to have the data ingested into the Azure cloud using the Azure IoT Hub.

    What are the capabilities of your sensors? Are these connected to the internet? Can you program logic next to it to connect it to the IoT Hub? Or do they provide logic to enter IoT Hub credentials?

    If you want and are able to connect every single sensor to the IoT Hub, you need to register each device so unique credentials are created.

    With credentials, I mean a connection string (for DEV and TEST situation) or the more secure (X509) certificates.

    Using the Azure Device Provisioning Service, registration at scale can be achieved (this service is highly recommended).

    That is why you need that extra logic to connect.

    If this is not possible, eg. the sensors only communicate on the local network or these cannot connect to the IoT Hub themselves, check out Azure IoT Edge.

    Here, an Industrial PC or VM on the edge of your local network has a secure cloud connection to the cloud. Only this edge device is registered.

    On the Edge device, an open-source runtime connects with local (docker container) logic to ingest data from the sensors and sends it to the Azure cloud:

    Diagram of how IoT Edge runtime sends insights and reporting to IoT Hub.

    I use this a lot in customer solution because it scales well and give a lot of flexibility (next to zero-touch maintenance).


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.