Power Automate and Azure Iot Hub Integration
We recently ran in to a situation where we wanted to get Event information from the Azure IoT Hub and use Power Automate to notify users about various thresholds etc.
Automate has the Event Hub Connector and IoT Hub provides an Event Hub Compatible Endpoint, so using those two was the obvious choice.
We ran in to two issues while using the compatible endpoint
-
The endpoint the IoT Hub provides looks like this
. To create a connection that the connector can use, you have to remove the EntityPath portion so that it looks like thisEndpoint=sb://abcd1234namespace.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=keykeykeykeykeykey=;EntityPath=iothub-ehub-abcd-1234-123456
Endpoint=sb://abcd1234namespace.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=keykeykeykeykeykey=;
-
As you build the Flow and are asked to pick the name of the Event Hub that you want to work with, Flow throws the following error
In our case we had the proper claims and we were able to connect to the endpoint using a simple python script. Turns out the solution was to simply type in the name of the EventHub that IoT Hub provides.Could not retrive values. The remote server returned an error(401) Unauthorized. claim is empty
You should now be able to now get events from Azure IoT Hub in to Power Automate using the Event Hub Compatible Endpoint.