try the following in your query:
GetMetadataPropertyValue(iothub, '[User]') as userprops
your enrichment data will be in the userprops.
Example:
device telemetry data:
{"counter":29,"time":"2019-08-08T13:42:26.1517415Z","deviceId":"device1","windSpeed":8.2023,"temperature":16.06,"humidity":79.46}
publishing on topic:
devices/device1/messages/events/$.ct=application%2Fjson&$.ce=utf-8&abcd=1234567
IoT Hub Enrich messages:
ASA job:
select
*,
GetMetadataPropertyValue(iothub, '[User]') as userprops
into
outAF
from
iothub
Output on the Azure Function (outAF):
[
{
"counter": 29,
"time": "2019-08-08T13:42:26.1517415Z",
"deviceId": "device1",
"windSpeed": 8.2023,
"temperature": 16.06,
"humidity": 79.46,
"EventProcessedUtcTime": "2019-08-08T13:42:25.7495769Z",
"PartitionId": 1,
"EventEnqueuedUtcTime": "2019-08-08T13:42:25.568Z",
"IoTHub": {
"MessageId": null,
"CorrelationId": null,
"ConnectionDeviceId": "device1",
"ConnectionDeviceGenerationId": "636842046144267242",
"EnqueuedTime": "2019-08-08T13:42:25.363Z",
"StreamId": null
},
"User": {
"abcd": "1234567",
"status": "inprocess",
"version": "42"
},
"userprops": {
"abcd": "1234567",
"status": "inprocess",
"version": "42"
}
}
]
The following screen snippet shows an event message from a second custom endpoint for enrich messages such as the EventGrid:
{
"id": "b983e8bf-88b5-cac3-9370-2c64037b2f1c",
"topic": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/myRG/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/myIOT",
"subject": "devices/device1",
"eventType": "Microsoft.Devices.DeviceTelemetry",
"eventTime": "2019-08-08T13:42:25.363Z",
"data": {
"properties": {
"abcd": "1234567",
"status": "inprocess",
"version": "42"
},
"systemProperties": {
"iothub-content-type": "application/json",
"iothub-content-encoding": "utf-8",
"iothub-connection-device-id": "device1",
"iothub-connection-auth-method": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
"iothub-connection-auth-generation-id": "636842046144267242",
"iothub-enqueuedtime": "2019-08-08T13:42:25.363Z",
"iothub-message-source": "Telemetry"
},
"body": {
"counter": 29,
"time": "2019-08-08T13:42:26.1517415Z",
"deviceId": "device1",
"windSpeed": 8.2023,
"temperature": 16.06,
"humidity": 79.46
}
},
"dataVersion": "",
"metadataVersion": "1"
}