Search code examples
iotazure-iot-hub

Can not find Device Id in Azure IoTHub events


I am trying to use Azure IoTHub to receive some sensor data. I manage to receive the messages from devices using EventProcessorClient. But, my problem is that I have lots of devices and I want to know which one is sending the message. I can't find it in ProcessEventArgs properties.


Solution

  • I found my answer here. The device id is in system properties:{eventArgs}.Data.SystemProperties["iothub-connection-device-id"]

    Also, you can find some other properties.