Hello @Nathan Sommer ,
welcome to this moderated Azure community forum.
The obvious way would be enriching the messages in the IoT Hubs while being routed to the EventHub.
You can add the device identifier as enrichment if you repeat it eg. in the tags of a device.
When messages are enriched, the key/value pairs are added to the application settings, outside the body.
In the past, the Azure Data Explorer data connection did not understand/support application settings. Azure Stream Analytics could fix this but that is out of scope.
I noticed this line in the documentation regarding application properties:
- In Event Hubs, when creating the event data object, embed the custom properties as part of the data in the
body
section of the object.
I am not sure what this means... I think it references the EventData class and askes you to reprogram the logic to discard application properties...
Another solution is ingesting the IoT Hub streaming events directly in Azure Data Explorer via the Database data connection for IoT Hub.
Then you have access to the system properties where the 'iothub-connection-device-id' is available.
These can be referenced in the mapping and added to the table.
As an alternative, you could check the system properties of the Database data connection for EventHub. This one could supports the 'iothub-connection-device-id' to.
Please let us know which solution works for you.
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.