I need to enrich the device life cycle events[Created, Deleted, Connected, Disconnected] received on Event Grid. The event flow in my solution is like below:-
Device send registration request to IoT Hub -> Event grid triggers device life cycle event -> Event grid routes device life cycle event to Event Hub.
Since my application i.e. consumer to Event hub only that is the reason I'm routing all events to Event Hub from Event Grid. Now, I need to enrich the event received on Event hub. For example, the device connected event should look like below:
{
"body": [
{
"id": "58b1872d-1388-8043-dacc-6322ca65d2bf",
"topic": "SOME_TOPIC",
"subject": "devices/diablo-central-park-1",
"eventType": "Microsoft.Devices.DeviceConnected",
"data": {
"deviceConnectionStateEventInfo": {
"sequenceNumber": "SOME_SEQ_NUMBER"
},
"hubName": "IOT_HUBNAME",
"deviceId": "DEVICE_ID"
},
"dataVersion": "",
"metadataVersion": "1",
"eventTime": "2020-10-16T06:33:42.2418032Z"
}
],
"properties": {
"aeg-output-event-id": "SOME_ID",
"aeg-subscription-name": "SOME_NAME,
"aeg-delivery-count": "0",
"aeg-data-version": "",
"aeg-metadata-version": "1",
"aeg-event-type": "Notification",
"enrichedProperty": "enrichedValue"
},
"offset": "25769816448",
"sequenceNumber": 2197,
"enqueuedTimeUtc": "2020-10-16T06:33:49.321Z",
""systemProperties": {}
}
So, In above event JSON, I should get the enrichedProperty in the properties field. I have done message enrichment for twin change events, telemetry through Message routing(Enrich Messages)in IoT hub blade on the portal. But for device life cycle events I could not find a way.