Monitor and Troubleshoot an IoT Solution

1.5 hours
  • 3 Learning Objectives

About this Hands-on Lab

In this lab, you start out with a predeployed IoT solution based on Azure IoT Hub. Unfortunately, the solution includes several incorrect configurations and bugs that not only prevent you from accessing key components, but also prevent telemetry from flowing properly from your IoT device to the desired destinations in the solution. In order to complete this lab, you will need to conduct root-cause analysis and apply changes to the hub infrastructure in order to create a working IoT solution. All work takes place in the Azure portal and assumes you know the basics of portal navigation.

### Prerequisites

Before taking on this lab, you should have a pretty solid understanding of Azure IoT Hub infrastructure and device management, as well as familiarity with telemetry routing and Event Grid.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create and Connect a Simulated Device to Azure IoT Hub
  1. Log in to the Azure portal using the lab credentials in an InPrivate or incognito window.
  2. Navigate to the only IoT Hub already deployed in the lab subscription.
  3. Attempt to create a new device. You will be blocked from the device explorer, and you will need to identify the source of the problem. There will be a pop-up message on the screen providing you with a hint of what needs to be fixed before you can access the device registry. If you missed the pop-up, select "Retry" to view it. Your first troubleshooting task is to resolve this problem.
  4. Once you have applied the fix, create a new device, and copy the Primary Connection String.
  5. Use this link to open the device simulator in a new browser tab or window.
  6. In the code pane, find and modify the connection string using the Primary Connection String you copied from the new device registration.
  7. Run the code and confirm that the device is sending telemetry data.
  8. Let the code continue to run, and return to the Azure portal to verify that data is flowing to the hub.
Identify and Fix Problem with Data Flow to the Storage Queue
  1. Once you have verified that data is flowing to the hub, confirm that an Event Grid topic and subscription are integrated with the hub.
  2. Navigate to the storage queue to check the flow of data. You should confirm that no data is flowing through the Event Grid subscription to the queue. This is your next troubleshooting challenge.
  3. Identify the root cause(s) of this problem and apply the fixes.
  4. Verify that data is flowing to the storage queue. You may need to wait a few minutes and refresh to see data arriving.
Identify and Fix Problem with Data Flow to the Blob Container
  1. Once you have verified that data is flowing to the hub, confirm that a custom route, with a storage endpoint, is defined on the hub. (Ignore the other route created by Event Grid.)
  2. Navigate to the Blob Storage container called iot-device-telemetry to check the flow of data. You should confirm that no data is flowing through the hub message route to the blob container. This is your final troubleshooting challenge.
  3. Identify the root cause(s) of this problem and apply the fixes.
  4. Verify that data is flowing to the storage queue. You may need to wait a few minutes and refresh to see data arriving.

Additional Resources

Imagine you are working on a demonstration of Azure IoT capabilities for your team. Someone on the team found a handy ARM template to help quickly spin up Azure IoT Hub environments. However, the template appears to have some bugs in it, and sample data is not flowing as expected. You and the colleague team up to troubleshoot the solution, together.

In this lab, you start out with a predeployed Azure IoT Hub, with a device telemetry route already defined, as well as an Event Grid subscription set up to receive device telemetry. You start the lab by connecting a simulated IoT device to the hub. Unfortunately, in its current state, you won’t even be able to add a device to the device registry, let alone connect the simulated device to send data. Once you address that problem, you will find that data is still not flowing down the hub route, nor to the Event Grid subscription. You will need to conduct additional root-cause analysis and apply changes to the hub infrastructure in order to successfully complete this troubleshooting exercise. All work takes place in the Azure portal.

Hint: You will need to make 4-5 changes to the predeployed IoT Hub solution in order to address the 3 problems described in the lab objectives. One change is optional is will only be required if you have certain failed "experiments" in the course of your troubleshooting.

Accessing the Device Simulator

Use the following link to access the device simulator.

WARNING: Be Prepared for UI Changes

Given the fluid nature of Microsoft cloud tools and open-source projects, you may experience user interface (UI) changes that were made following the development of this hands-on lab that do not match up with lab instructions. When any such changes are brought to our attention, we will attempt to update the content accordingly. However, if changes occur, students will have to adapt to the changes and work through them in the hands-on labs as needed.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?