Query & Visualize IoT Tracing
Start course

This course will focus on the skills needed to integrate Azure Monitor and its corresponding features within IoT solutions. Each service within a given IoT solution has the ability to produce metrics, logging, and alerting data. How are you going to gather all of that information and make it available to users that are managing and maintaining your solutions? This course will provide the answers to that question!

Learning Objectives

  • Understand the different metrics and diagnostics that can be retrieved from the Azure IoT Hub
  • Learn how to configure the IoT Hub for scaling programmatically
  • Learn how to query and visualize the data that is stored in Azure Monitor
  • Define specific Azure policies for your IoT Hub so that the hub meets your requirements
  • Learn how to gather metrics and diagnostics from IoT Edge

Intended Audience

  • Developers
  • Operational engineers
  • Cloud architects
  • Anyone responsible for deploying IoT solutions on Azure


To get the most out of this course, you should have a strong understanding of the available IoT services that Microsoft provides, as well as a strong understanding of Azure Monitor and the different types of data that can be retrieved through all of its features and services.


Hi there. Welcome back. In this video, we're going to focus on all of that data that we've been collecting: the diagnostics, the metrics, and take a look at how can we query and visualize some of that data. Now, in addition to that data, Microsoft also provides access to other tracing data, diagnostic data around your IoT Hubs. We want to take a look at that as well. And how are we gonna do that? Well, there are numerous different ways that Microsoft provides out of the box, hence the OotB, that you can leverage inside of the Azure portal.

Metric dashboard blades where you can actually take a specific metric from your IoT Hub and make it available in a dashboard. The Azure Health Service, Azure Log Analytics as well as third-party solutions. Now, there are also some optional options such as Power BI integrations using Azure Stream Analytics, but we're gonna focus on the top three because they are the out of the box possibilities inside of the Azure portal. So let's go ahead and jump on into the Azure portal and take a look at those top three and see what's possible.

To start things off, we're gonna go back and take a look at the metrics that are possible inside of Azure IoT Hub. And we're back here on the overview dashboard for my course IoT Hub. In this particular page, we have four different metrics that we're currently showing, including the number of IoT devices, the number of messages being sent and so on. And as I talked about during the metrics portion, we can absolutely add these blades to a dashboard. And all we have to do is take a look at this pin here. If we click on this pin, it's going to offer us the opportunity to create a dashboard or to add this blade to a dashboard. In addition, we can actually create a completely new dashboard, one that's only available to us or one that we actually want to share and make available to other people who are gonna be operating and maintaining the IoT Hub.

So once you've figured out what metrics are gonna be important for your IoT Hub, this is gonna be one way that you're gonna be able to continually visualize the data that's being processed inside of your IoT solution, either you individually or you as a group. The second thing that we wanna take a look at is Azure Service Health. Now, there's two different ways to get this information. The first is from within your IoT Hub directly. If you scroll all the way down to the bottom of the navigation, there is a "resource health" item that you can click on. We click on that and we get information about IoT Hubs within the region that Azure IoT Hub is currently sitting. And in this particular case, you can see that you get events that are showing over the last five days. As of right now, everything was available on the 27th of August, but there was a health event on the next four days. Unfortunately, that's all that you're gonna get. You can get information about the actual resource health event itself, what might have caused it, things along those lines. You can even download the PDF report. However, this is only specific to the region that this IoT Hub is in. If you need more information, then you're gonna wanna go to And this is where you can get information about every service inside of Azure and find out it's health for every region inside of Azure.

So we can actually, first of all, choose what area of the world we're currently in. I am based in the America, so I'm gonna stay there. And then I'm gonna scroll down to IoT or internet of things which is right here. And we can take a look right here at Azure IoT Hub and see check marks all the way across for today. Now, this is a in time type of status health, meaning we're only looking at it for this second. If you want to dive in and look at past events, that's where you're gonna use the service health capability inside of each individual IoT Hub for the specific regions.

So up until now, we've been looking at visualizations that are pretty much out of the box. They're based off of either one piece of data, or they are a visualization that Microsoft themselves are putting together. Well, what happens when you wanna create your own visualizations? You know that you wanna put two or three pieces of data or even more together and create your own reports or your own charts and graphs. Well, that's where Azure Log Analytics is gonna come into play.

If you'll remember from the diagnostics video, we actually talked about Azure Log Analytics as being a target for all of those diagnostic logs. I am currently sitting in the logs location of Azure Monitor, as you can see here, and this is what a query screen will actually look like. Now, I've already put together a simple query for us to use for demonstration purposes. I'm gonna go ahead and run this. And this is a custom query. It is from AzureDiagnostics. I'm using the Microsoft.devices resource provider and using IoT hubs as my resource type. And then I wanna pull all connection data related to this IoT Hub.

Now, I was just recently running a simulated device against this IoT Hub. That's what these connections are showing. Now, this is a simple table view, but you can actually make this available on your dashboard as well. So just like we did with the metrics, we can actually take this table data and make sure that it's available on your dashboard to view on a daily basis. And you can refresh it and make sure that you've got the most up-to-date data. And then, of course, we can also create new dashboards. At the same time, if this data were something that was easily chartable, it had numerical data points somewhere inside of it, we could create charts right here and then have the charts show up as dashboard items as well.

We can then also take these queries and use them as alerts to help feed some automated, maybe scaling items, things along those lines. So Azure Log Analytics is gonna be a very, very powerful tool from a custom query perspective and provides you a lot of different options for visualizing the data coming from your IoT Hub, as well as your edge devices.

About the Author

Brian has been working in the Cloud space for more than a decade as both a Cloud Architect and Cloud Engineer. He has experience building Application Development, Infrastructure, and AI-based architectures using many different OSS and Non-OSS based technologies. In addition to his work at Cloud Academy, he is always trying to educate customers about how to get started in the cloud with his many blogs and videos. He is currently working as a Lead Azure Engineer in the Public Sector space.