Trigger Azure Functions using webhooks in Azure IoT Central
This topic applies to builders and administrators.
You're currently viewing the original IoT Central documentation. To view the updated preview features documentation go to What is Azure IoT Central (preview features)?.
Use Azure Functions to run serverless code on the webhook output from IoT Central rules. You don't have to provision a VM or publish a web app to use Azure Functions, but instead you can run this code serverless. Use Azure Functions to transform the webhook payload before sending it to its final destination such as a SQL database or Event Grid.
If you don't have an Azure subscription, create a free account before you begin.
How to connect Azure Functions
Expand your function app and select the + button next to Functions. If this function is the first one in your function app, select In portal as development environment and select Continue.
Choose Webhook + API template and select Create. This topic uses .NET based Azure function.
In your new function, select </> Get function URL, then copy and save the value. You use this value to configure the webhook.
In IoT Central, navigate to the rule that you want to connect to your function app.
Add a webhook action. Enter a Display name and paste in the function URL you copied earlier into Callback URL.
Save the rule. Now when the rule is triggered, the webhook invokes the function app to run. In your function app, you can select Monitor to see the function's invocation history. You can use App Insights or the classic view to look at the history.
For more information, visit the Azure Functions article about creating a function triggered by a generic webhook.
Now that you have learned how to set up and use webhooks, the suggested next step is to explore building workflows in Microsoft Flow.