Device ID and Subject Not Being Enriched in Azure IoT Hub Messages

Rakesh kumar 21 Reputation points
2024-12-15T07:55:22.0166667+00:00

I am trying to perform transformations on telemetry messages flowing through Azure IoT Hub to Event Hub and then being received by Stream Analytics. The goal is to transform these messages based on device ID and subject, but I am unable to retrieve the deviceId and subject fields despite using the suggested terms in the message enrichment.

In the message enrichment section of the Azure portal, I am attempting to add the following key-value pairs:

device:$connectionDeviceId  
subject:$dt-subject

However, neither $connectionDeviceId nor $dt-subject are being translated to their respective fields for device ID and subject. Here are some details about my IoT Hub:

  • Hostname: ymsl6wiothub.azure-devices.net
  • Tier: Standard
  • Location: Central US
  • Service region: Central US
Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
405 questions
{count} votes

Accepted answer
  1. Sander van de Velde | MVP 33,951 Reputation points MVP
    2024-12-15T12:44:14.91+00:00

    Hello @Rakesh kumar,

    welcome to this moderated Azure community forum.

    I tried it myself and the enrichment of putting a system properties failed:

    User's image

    According to the documentation, adding systemproperties is not supported:

    User's image

    I also observed the original IoT hub system proerties are not outputted by the eventhub. These seems to 'get lost in translation'.

    There are a couple of ways to solve this:

    1. if you connect the azure stream analytics directly to the iot hub (eventhub compatible endpoint) you can directly read the system properties. Keep in mind the iot hub eventhub compatible endpoint needs its own iot hub route if other routes are created

    User's image

    1. add the devicename and subject as static enrichments
    2. add the devicename and subject as tags to the devicetwin

    If possible I would go for option 1. And, give every consumer of the default compatible endpoint its own consumer group!


    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.