all Technical posts

Automatically Emit Azure IoT Hub Events to Azure Event Grid via ARM

Azure IoT Hub integrates with Azure Event Grid seamlessly, but how do you enable this via Azure Resource Manager? Let's have a look.

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.

  • DeviceCreated
  • DeviceDeleted
  • DeviceConnected
  • DeviceDisconnected

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!

Cheers,

Glenn

Subscribe to our RSS feed

Hi there,
how can we help?

Got a project in mind?

Connect with us

Let's talk

Let's talk

Thanks, we'll be in touch soon!

Call us

Thanks, we've sent the link to your inbox

Invalid email address

Submit

Your download should start shortly!

Stay in Touch - Subscribe to Our Newsletter

Keep up to date with industry trends, events and the latest customer stories

Invalid email address

Submit

Great you’re on the list!