title | description | ms.topic | ms.custom | ms.date | zone_pivot_groups |
---|---|---|---|---|---|
Azure IoT Hub trigger for Azure Functions |
Learn to respond to events sent to an IoT hub event stream in Azure Functions. |
reference |
devx-track-extended-java, devx-track-js, devx-track-python |
03/04/2022 |
programming-languages-set-functions-lang-workers |
This article explains how to work with Azure Functions bindings for IoT Hub. The IoT Hub support is based on the Azure Event Hubs Binding.
For information on setup and configuration details, see the overview.
Important
While the following code samples use the Event Hub API, the given syntax is applicable for IoT Hub functions.
[!INCLUDE functions-bindings-event-hubs]
The connection
property is a reference to environment configuration that contains name of an application setting containing a connection string. You can get this connection string by selecting the Connection Information button for the namespace. The connection string must be for an Event Hubs namespace, not the event hub itself.
The connection string must have at least "read" permissions to activate the function.
This connection string should be stored in an application setting with a name matching the value specified by the connection
property of the binding configuration.
Note
Identity-based connections aren't supported by the IoT Hub trigger. If you need to use managed identities end-to-end, you can instead use IoT Hub Routing to send data to an event hub you control. In that way, outbound routing can be authenticated with managed identity the event can be read from that event hub using managed identity.
The host.json file contains settings that control Event Hub trigger behavior. See the host.json settings section for details regarding available settings.