How do I setup and configure an IoTHubTrigger correctly to trigger an Azure Function (C#) for my IoTHub messages? Where and how do I plug in my IoTHub's connection string?
相关问题
- Debugging two Azure Functions projects locally
- How to Append a Text File in an Azure Blob with a
- Cannot use JpegBitmapEncoder in Azure Function
- How to deploy multiple Microsoft azure functions f
- Azure Function - Portal Code Deployment feature is
相关文章
- Azure Function App - Publish failed
- How to authenticate to an Azure Function using fun
- How do I write an azure function to trigger a azur
- No job functions found in Azure Functions project
- “Wake up” time of Azure Function triggered by Serv
- Azure functions - How to read form data
- Azure Functions - Import Custom Node Module
- Azure Function Docker not working with http trigge
Steps using Visual Studio 2017:
Go to File->New->Project->Azure Functions and select "IoT Hub Trigger"
Select Functions V1 or V2 (learn about there differences here). And enter an arbitrary name that will serve as key for your connection string configuration.
Open local.settings.json and enter a key/value pair for your connection string:
IMPORTANT
If using Functions V1, use your IoTHub connection string obtained in the portal from here:
If using Functions V2, use your IoTHub's EventHub compatible endpoint obtained in the portal from here:
Steps using the Azure Portal
Create a new Function App resource and select the EventHub Trigger template
Hit "New" for EventHub Connection and select IotHub and your desired hub
Edit and save your function code - you are now up and running!
Switch to "Monitor" see your events flowing in
More options to create IoTHub Trigger Azure Functions
a) Using VS Code with the Azure Functions Extension
b) From the command line using Azure Functions Core Tools