Email alert using Event Grid & LogicApp with filters on telemetry fields

Sagar Epari 130 Reputation points
2023-06-01T11:35:47.1433333+00:00

Hello,

I am trying to use EventGrid and LogicApp for the first time. I have a few fundamental questions (might be trivial),

  • Is this the best approach to instrument telemetry and trigger email?
  • To add filters in EventGrid, I wanted to check the exact format of telemetry the IoTHub receives and sends it to EventGrid. If I look into activity logs, I dont see that. With some random try, I was able to set the filter. Example, data.body.temperature is greater than 50.
  • Also for LogicApp schema, I would like to get the exact payload format the EventGrid receives so that I can attach the sample to generate schema.

I added a storage blob and redirect all my telemetry messages to the blob. (This is just for my learning) and I see the below format for each entry. So should I use this 'as is' to create the schema for LogicApp (Http Request)?

{
  "EnqueuedTimeUtc": "2023-06-01T11:54:44.3100000Z",
  "Properties": {},
  "SystemProperties": {
    "connectionDeviceId": "sagarlaptopvscode",
    "connectionAuthMethod": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
    "connectionDeviceGenerationId": "638212049258571423",
    "contentType": "application/json",
    "contentEncoding": "utf-8",
    "enqueuedTime": "2023-06-01T11:54:44.3100000Z"
  },
  "Body": {
    "status": "fine",
    "temperature": 39
  }
}

Thanks

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,990 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,157 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
351 questions
{count} votes

Accepted answer
  1. Dom 1,631 Reputation points Microsoft Employee
    2023-06-05T09:22:05.67+00:00

    You can find the details of the schema of the messages that EventGrid receives here: https://learn.microsoft.com/azure/event-grid/event-schema-iot-hub?tabs=event-grid-event-schema

    IoT Hub can route telemetry to other services in various ways. For an overview and comparison, see https://learn.microsoft.com/zure/iot-hub/iot-hub-devguide-messages-d2c


0 additional answers

Sort by: Most helpful