Storing the device sensor data that is sent to the IoT Hub can be stored either into a Blob or into a Storage Table. Saving in a Table is more easy to comprehend. The process is as follows:
- Create an Azure Function App named esm-device-msgs2table-appattached to an Azure Storage account named esmiotstorage.
- Then created an Event Hub Namespace named esm-event-hub-ns.
- In this namespace created an Event Hub named esm-event-hub.
- Then created Azure Function code as follows:
- Go to the function app created earlier.
- Click on Add New Function.
- Selected Custom Function link (at the bottom of the page)
- Then select the tile named Event Hub Trigger - C#.
- Set the name of the function as StoreDeviceMsgs2Table.
- Set the other parameters and click Create.
This function is supposed to pick the all messages and store in a table. But it was not doing that. This also need to be debugged. If this picks up all the messages and stores in the table, then this table can be read through a .NET app and displayed as historical data.