Following are the steps
- Create an Event Hubs namespace in your azure account.
- After creating namespace Create an event hub. Use this link to create Event Hubs Namespace and Event Hub. https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create
- Create IOT hub in your azure account . Use this link https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-create-through-portal for creating IOT HUB
- Create a Message Routing for IOT Hub. For that go to your IOT Hub
- Select Message Routing
- You will get the following screen. Click on add
- You will get following screen
- Enter the Name of route
- For EndPoint click on Add endpoint and select
Event hubs
- You will get the following screen
- Enter the name of End Point name
- Click on Choose an existing event hub
- After that select your IOT hub name space and IOT hub instance
- After that click on create
- Write a C# code that will create device and send telemetry message to your device.(refer Create IOT Device and send Telemetry Message to IOT Device using c#)
- Create a http trigger azure function. (refer How to create HttpTrigger Function using .Net)
- After that Create a logic app for that go to azure portal
- Select logic Apps. You will get the following
screen click on Add
- You will get the following screen
- Fill all the necessary details and click on create
- After that you will get the following screen
- Click on Go to resource. You will get the
following screen
- Click on blank Logic app
- You will get the following screen and search for
event hub and select event hub trigger
- You will get the following screen
- Fill all the necessary details. You can change the connection of event hub by clicking on Change Connection
- After that click on New Step
- Search for azure function and select the function that you have created
- You will get the following screen
- In Request Body select the body
- Add new parameter for header
- In header enter the header of the function like key x-function-key and value will be your function key
- After that save your logic app
- When you send telemetry data to device this logic app will be triggered
- You can see that in run history of your logic app
No comments:
Post a Comment