Provision an End-to-End IoT Solution

This IT Pro Challenge virtual lab shows learners how to create and configure an Azure Internet of Things (IoT) Hub that has three IoT devices, create endpoints and consumer groups, provision an Azure Stream Analytics job, provision a function app that sends data to an Azure Cosmos DB, and use Azure Time Series Insights to analyze the data.

Time
1 hour 15 minutes
Difficulty
Advanced
Share
NEED TO TRAIN YOUR TEAM? LEARN MORE
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Overview

In this IT Pro Challenge, learners will understand how to use the Azure portal to create and configure an Azure Internet of Things (IoT) Hub, create connection strings, and provision several IoT devices. Learners will also use IoT endpoints, consumer groups, and Azure Stream Analytics to manage the IoT data. Finally, learners will send data to an Azure Cosmos DB and analyze the data with Azure Time Series Insights. The skills acquired in this lab are important for a career as a network or system administrator.

Overview

The scenario for this lab is that you are a system administrator, and your company is deploying an Internet of Things (IoT) data solution. IoT is a network of interconnected devices that can transfer data over a network without requiring human intervention. The first IoT device was a Coca-Cola vending machine that was able to report its inventory and inventory temperature over the internet.

Your job is to create and configure an Azure IoT Hub to manage three IoT devices. You will manage a device by sending messages to it and updating its twin, and you will use IoT endpoints and consumer groups, as well as Azure Stream Analytics to manage IoT data. Azure Stream Analytics is a tool that can process large data streams from multiple sources in real-time.

Finally, you will analyze data using Azure Cosmos DB (a multi-modal noSQL database with response times in the milliseconds) and Azure Time Series Insights, an analytical and visualization tool that allows you to analyze billions of IoT events from multiple IoT devices at the same time.

Provision an Azure IoT Hub

To begin the lab, you will log in to the Azure portal, create an Azure IoT Hub, and add two custom Connection strings to the Web App (iotHubConnectionString, eventHubConnectionString). One is for the iothubowner connection string, and the other is for the Event compatible endpoint for the Azure IoT Hub.

Provision and manage IoT devices

Now you will provision three IoT devices (Building001, Vehicle002, Equipment003) and send a message to the Building001 IoT device. Then you will add a string setting (sample) to Building001’s device twin.

NOTE: For each IoT device connected to an Azure IoT Hub, there is a device twin for synchronization and querying device configurations.

Before moving on to the next step, you will use a provided Web App to test the Azure IoT Hub by sending messages from all of the IoT devices to the Hub.

Create an endpoint and consumer groups

In this step, you will provision an Azure Storage container endpoint (blobendpoint) that references a container (iothubep) in the provided Azure Storage Account. Then you will create a Route (blobroute) that routes all messages to blobendpoint. Finally, you will provision two consumer groups (primary, secondary) for the Azure IoT Hub.

Provision a Stream Analytics job

Now you will provision a Stream Analytics job, add a Streaming Input (iothub) that references the $Default consumer group of the Azure IoT Hub, add a Table storage Output (averages) that reference a new table (averages) in the provided Azure Storage Account. You will also test the default query for the Stream Analytics job by modifying it to replace the default aliases.

Send data to Cosmos DB

In this step, you will provision a function app (where one or more functions are managed together in one plan) that uses the Consumption Plan. Then you will add a custom function in C# that is triggered by events in the Azure IoT Hub and add an Azure Cosmos DB output that links to a new collection in a new database. Lastly, you will modify code in an existing function (iotxfer) to create a document in Cosmos DB for each event that was registered. As a proof of concept, you will test your function app in a provided web app to make sure that you receive telemetry from the three IoT devices that you created.

Use Azure Time Series Insights to analyze data

Next, you will provision an Azure Time Series Insights environment, verify that a Contributor data access policy exists for a specified user, add an Event Source (iot), analyze the Reading data, and export a JavaScript Object Notation (JSON) file with a sample of source events. Finally, you will upload the JSON file to a new container (analysis) in the provided Azure Storage Account.

Challenge validation

This step is about validating the work you have done in the lab. You will test all of the configurations that you created for the IoT solution using a test web application.

Summary Conclusion

By taking this lab, you learn how to provision an Azure IoT Hub with three IoT devices, create endpoints and consumer groups, create a Stream Analytics Job, provision a function app that sends data to an Azure Cosmos DB, and use Azure time Series Insights to analyze the data from the IoT devices.