question

Rayaprol avatar image
0 Votes"
Rayaprol asked ·

Azure IotHub -function Trigger

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
iothubtrigger.png (122.2 KiB)
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Rayaprol Just Checking back! Please review the below responses and let us know if you need further help!.

0 Votes 0 · ·
rkiss avatar image
1 Vote"
rkiss answered ·

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

Thanks

Roman

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks Roman. I will try your suggested solution.

0 Votes 0 · ·
SatishBoddu-MSFT avatar image
2 Votes"
SatishBoddu-MSFT answered ·

Hello @Rayaprol
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.png (124.8 KiB)
3.png (131.1 KiB)
· 4 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for sharing the relevant documentation. I would like to trigger an Azure function when a reported property is updated in the device twin and access both previous and new values of the property. Could you please suggest any technique to achieve this?

0 Votes 0 · ·

Hello Chandra, I have updated my response, please have a look and let us know if you need more help in this matter.

1 Vote 1 · ·
Rayaprol avatar image Rayaprol SatishBoddu-MSFT ·

Thanks. I am working on it and will get back to you for any queries.

0 Votes 0 · ·
Show more comments