Publish IoT Hub Data to Power BI via Stream Analytics

Azure IoT is a managed service that enables secure bi-directional communication between IoT Applications and devices. It is capable of receiving and processing millions of events per second. Developers can leverage its capabilities to build scalable, full-featured IoT solutions such as managing industrial equipment used in manufacturing, tracking valuable assets in healthcare, and monitoring office building usage.

In this article, we will publish IoT Hub events hub data to Power BI Dashboard. Power BI helps analysts to visualize the data and share insights within teams or organization.

So Let’s begin.

Pre-requisites

  • IoT Hub Should be up and running.
  • Events Data received by IoT Hub should have below Schema:
{
   "MachineName":"AB01",
   "ServerName":"XXXYYZZZZ01",
   "Process":"CNC",
   "LastStatus":3,
   "Status":"Connect",
   "Time":"2020-05-30T16:18:31.7058659Z"
}

Create Stream Analytics Account

  • Search for Stream Analytics
  • Click on Add
  • Provide details and click on Create.

Create Input Dataset

  • Go to Resource
  • Click on Inputs > Add stream input > IoT Hub
  • Provide details and click on Save

Create Output Dataset

  • Click on Output > Add > Power BI
  • Authorize with Power BI Subscription Account
  • Select Power BI Workspace, provide rest of the details and Click on Save

Create Query

  • Click on Query
  • Type Below sample query and Click on Save Query
SELECT MachineName, ServerName, Status
INTO [IoTOutput]
FROM  [IoTIn]
  • Start the Stream Analytics Job

Create Power BI Dashboard

  • Login to Power BI.
  • Select Workspace. Now the Dataset published from the Stream Analytics job is available.
  • Click New > Dashboard
  • Provide Dashboard name and click on Create.
  • Portal redirects to the new dashboard.
  • Click on Edit > + Add a tile
  • Under Add a tile, select Custom Streaming Data.
  • Select the dataset published from Stream Analytics Job and click on Next.
  • Select Card type, Add Values to Axis and Legend and click on Next
  • Provide Details and Click Apply
  • Now the report is ready

Power BI can be an efficient way to use real-time data to monitor the IoT Infrastructure and device. Any prompt and proactive measures can be taken to minimize the downtime of the critical devices.



Categories: Azure, Azure IoT, Azure Stream Analytics, Power BI

2 replies

  1. Is it possible to store the stream data to a storage like table to have historical data?

    • Yes , you can store your stream data as json text. However streamed data can incur huge costs, hence you would need to define proper data retention policy for your storage

Leave a Reply

Discover more from Cloud Wizard Inc.

Subscribe now to keep reading and get access to the full archive.

Continue reading