Building event-driven IoT platforms has always been a challenge. That was until Azure Event Grid integration was recently added to Azure IoT Hub. Azure Event Grid allows you to configure applications to listen for IoT Hub events in a reliable and scalable manner.
We’re now building an IoT application that needs to react and update an internal database every time a new IoT device is registered/un-registered to our IoT Hubs.
Luckily, configuring the publication of IoT Hub events via the portal is very simple and intuitive. Simply navigate to your IoT Hub and click on Events to start the wizard to configure Event Grid integration.
A detailed walk-through can be found at this link: https://docs.microsoft.com/en-us/azure/event-grid/publish-iot-hub-events-to-logic-apps , this walk-through will guide you through the process of sending email notifications when IoT Hub events occur.
One important point to mention is that currently only subscription to device life-cycle events are supported. The supported events are listed below.
Automate all the things!
The IoT platform we’re building is provisioned in an automated way through ARM Templates and we found it pretty challenging to add the Event Grid integration from the IoT Hub.
Digging through the automation scripts generated via the Azure Portal and via resources.azure.com did not provide a reasonable solution either.
Based on the Azure Resource Manager templates for Event Grid for other services exposing events we managed to create following ARM template that will configure Azure IoT Hub events for Event Grid.
This template isn’t rocket science as it was generated based on existing examples with some assumptions and changes necessary to get this to work with Azure IoT Hub.
We couldn’t find any documentation on this subject, hence the blog post. Hope you find it helpful!
Subscribe to our RSS feed