I have an Azure function that is triggered by IOThub. So in the Azure function, I have
public static async Task Run(EventData myIoTHubMessage1, TraceWriter log)
How do I get the device id from the Event Data.
I tried
log.Info("devid="+myIoTHubMessage1.SystemProperties["ConnectionDeviceId"]);
It gave an error saying
The given key was not present in the dictionary.
the following document says that https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-construct
ConnectionDeviceId contains the deviceId. Would anybody know how to retrieve the deviceid from EventData or should I use some other class.