Respond to IoT Hub Events - Azure Event Grid
    • Dark
      Light
    • PDF

    Respond to IoT Hub Events - Azure Event Grid

    • Dark
      Light
    • PDF

    Article Summary

    Azure Event Grid is a central smart routing service for events. The concepts of this service is straight forward, there are event producers such as Event Hub and Storage pushing events to Event Grid that manages subscription to the events and push them to event handlers like Logic Apps and Azure Functions.

    One of the event producers is the Azure IoT Hub as it can emit any of the following four events:

    • DeviceCreated - when a device is registered to an IoT hub.

    • DeviceDeleted - when a device is deleted from an IoT hub.

    • DeviceConnected - when a device is connected to an IoT hub.

    • DeviceDisconnected - when a device is disconnected from an IoT hub.

    Event Grid allows filtering on, for instance, Device ID or other elements defined in the schemas for IoT Hub events.

    Next, you can tie the subscription to, for instance, an Azure Service like Logic App or an Azure Function to handle the event using a Webhook mechanism.

    Note that for the device connected and disconnected events, you must open the Device to Cloud (D2C) link or C2D link for your device. In case your device is using the MQTT protocol, then the IoT Hub will keep the Cloud to Device (C2D) link open. Furthermore, in case you are using AMQP, you can open the C2D link by calling the Receive Async API (See also limitations of device connected and disconnected events).

    Event-grid-2.png


    Was this article helpful?