"Device ID": How can I include it on the msgs sent from IoT Hub to Event Hub ?

Omar Cruz 26 Reputation points
2025-03-10T21:33:14.8966667+00:00

Hello Community.

On an IoT Hub I am receiving the msgs from the devices... Msgs that then are passed from the IoT Hub to the Event Hub. If I check in event hub (using the nice functionality: Data Explorer) I see indeed the event body (which in fact the telemetry sent by the device), but I see nowhere how to retrieve the actual DEVICE ID from IoT Hub.

User's image

I have checked everywhere and so far the only alternative that I see is including the DEVICE IS as a string inside the telemetry. Honestly I find that a bit strange because the device id is metadata, so why should I make it part of the body ?

I would appreciate your feedback, in case I am missing something, please tell me.

Thanks and ... greetings from Belgium 🇧🇪
Omar C.

Ps.
Maybe you @SANDER VAN DER VELDE , by chance would you have some ideas?
Thanks :)

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

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 35,411 Reputation points MVP
    2025-03-11T06:42:03.1566667+00:00

    Hello @Omar Cruz,

    welcome to this moderated Azure community forum.

    Message flowing through the Azure IoT Hub have a message body and optionally (user) properties which are nice as a context.

    The IoT Hub adds system properties like the iothub identification, the device ID and even the Module id is applicable.

    So technically, it's the device ID you are looking for.

    In that data explorer page, select 'Event properties' at the bottom. There you see the (user) properties and system properties.

    I'm not sure but maybe the IoT Hub message enrichment can be used to push the deviceid in the user properties too.

    It depends on your tooling if you can read these properties.

    Azure Stream Analytics can touch both user and system properties.

    Azure Data Explorer only knows about the system properties.


    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.