Azure IotHub -function Trigger

Chandra Mohan 461 Reputation points
2020-06-01T10:21:35.247+00:00

Hi,
I would like to create a separate Azure function trigger for each of the IoT Hub events listed below:

  1. DeviceLifeCycleEvents
  2. DeviceTwinChanges
  3. DeviceTelemetryMessages

Please note that I would like to trigger using Azure IoT Hub message routing as shown in the attached screenshot and not through event grid subscription. Your suggestions will be greatly appreciated.

Best Regards,
Chandra Mohan
8954-iothubtrigger.png

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,157 questions
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2020-06-01T11:22:48.327+00:00

    Add two more Event Hubs in your custom endpoints for dedicated stream pipelines such as DeviceLifeCycleEvents and DeviceTwinChanges.

    Thanks

    Roman

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. QuantumCache 20,261 Reputation points
    2020-06-01T17:18:26.247+00:00

    Hello @Chandra Mohan
    Chandra Mohan,

    Thanks for reaching out to us!

    IoT Hub currently supports the following Azure services as additional endpoints: Reference Doc link

    • Azure Storage containers
    • Event Hubs
    • Service Bus Queues
    • Service Bus Topics

    For triggering Azure Function Apps with IoT hub messages please refer to the below mentioned sample walk through,

    Processing data from IoT Hub with Azure Functions, I hope this helps you to get started on this integration side.

    Also please refer to Azure IoT Hub bindings for Azure Functions.

    [Update]

    We have to use Intermediate service to trigger Azure Function App. And please note that Device twins are not part of messages, so we have to exclusively make Get calls to get device twins (Example: inside Function App) or make use of the message routing option.

    Option I: IoT Hub-->Message Route to Servicebus/EventHub-->Trigger FunctionApp (Create your own FA) (For Telemetry , Twin ,Life cycle changes)

    Option II: IoT Hub -->Events-->Event Grid subscription--> configure Function App endpoint (For Device created, Deleted, Connected,Disconnected, Telemetry)

    More Info can be read at Azure IoT Hub as an Event Grid source.
    One of the articles to start with is React to IoT Hub events by using Event Grid to trigger actions.

    Steps:

    1)

    9031-3.png

    2)

    8956-2.png

    Please let us know if you need further help.

    2 people found this answer helpful.