Send telemetry message to IOT hub through message routing and consume message by logic app - Microsoft Technologies, Azure and .net Tutorials

Latest

Sunday, July 19, 2020

Send telemetry message to IOT hub through message routing and consume message by logic app


Following are the steps

  1. Create an Event Hubs namespace  in your azure account.
  2. 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
  3. 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
  4. Create a Message Routing for IOT Hub. For that go to your IOT Hub
  5. Select Message Routing





  6. You will get the following screen. Click on add





  7. You will get following screen




  8. Enter the Name of route
  9. For EndPoint click on Add endpoint and select Event hubs




  10. You will get the following screen




  11. Enter the name of End Point name
  12. Click on Choose an existing event hub
  13. After that select your IOT hub name space and IOT hub instance
  14. After that click on create
  15. 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#)
  16. Create a http trigger azure function. (refer How to create HttpTrigger Function using .Net)
  17. After that Create a logic app for that go to azure portal
  18. Select logic Apps. You will get the following screen click on Add




  19. You will get the following screen



  20. Fill all the necessary details and click on create
  21. After that you will get the following screen




  22. Click on Go to resource. You will get the following screen



  23. Click on blank Logic app
  24. You will get the following screen and search for event hub and select event hub trigger



  25. You will get the following screen



  26. Fill all the necessary details. You can change the connection of event hub by clicking on Change Connection
  27. After that click on New Step
  28. Search for azure function and select the function that you have created
  29. You will get the following screen



  30. In Request Body select the body
  31. Add new parameter for header
  32. In header enter the header of the function like key x-function-key   and value will be your function key
  33. After that save your logic app
  34. When you send telemetry data to device this logic app will be triggered
  35. You can see that in run history of your logic app


No comments:

Post a Comment

Metadata in BoxDicom

  Metadata in BoxDicom In BoxDICOM, metadata refers to additional information that can be associated with a file or folder. Metadata in Bo...