Azure webhook triggers a IoT Hub

649 views Asked by At

I want to make a webhook that can be triggered by either get/post and triggers connected IoT devices to a WebSocket. So, I thought Azure might help to automize this process, instead of writing everything from scratch and run it on a webserver.

I am very new in the Azure world, I found it very complicated to make it working on Azure.

Can you point me to any simple to make it work?

1

There are 1 answers

5
Matthijs van der Veer On

The first thing to do is to decide where you want to connect your devices to. Generally, you'll either use Azure IoT Hub or IoT Central (which uses an IoT Hub anyway). Your question doesn't include any details about your devices, or whether you're developing them yourself, but I'll assume you can connect to either.

If you go for Azure IoT Central, the easiest way to get a webhook going is to create a Logic App and link nodes together to trigger a Command to your device. You can use an HTTP request as the trigger, and use the built-in IoT Central node to trigger your command, example: Execute a device command

If you end up connecting your devices to IoT Hub, you can use Direct Methods, Cloud to Device messages or even Device Twins to communicate with your devices. You can leverage these by creating an Azure Function with an HTTP trigger, and you program the logic to call IoT Hub, which will communicate with your devices. There are a lot of samples on the web that show how to create Functions, or control your device remotely.

There are a lot of ways to go about your scenario, if you need some help from the Microsoft community, you can get a lot of help on Microsoft Q&A.

Update based on the comments: In this case, the devices are connected to IoT Hub. You can use the Service SDK to run a job that fires a Direct Method to all currently connected devices. This doc describes the process.