Implement IoT Hub Endpoints and Consumer Groups
This IT Pro Challenge hands-on lab shows learners how to implement and configure an Azure Internet of Things (IoT) Hub that can support multiple consumer groups. Learners will understand how to add devices to the IoT Hub, define consumer groups, create endpoints, and verify telemetry data as a proof of concept.
In this IT Pro Challenge, learners will understand how an Azure Internet of Things (IoT) Hub works by using the Azure portal and CloudShell to view connection strings, adding devices, defining a secondary endpoint, and then adding routes for the default and secondary endpoints. Learners will create multiple consumer groups, verify telemetry data is written to the endpoint and that the connection strings are configured properly. The skills acquired in this lab are useful for the role of a network or system administrator.
The scenario for this virtual lab is that you are a system administrator, and your company is creating an Internet of Things (IoT) data solution. Your job is to configure an Azure IoT Hub to support multiple consumers that process incoming data at different rates. First, you need to define a secondary endpoint for an Azure IoT Hub and then add routes for the default and secondary endpoints. Then, you will need to add consumer groups to the Azure IoT Hub and verify that multiple consumers can use the same IoT data.
For this lab, you are provided with an Azure resource group with a preconfigured website, an Azure IoT Hub, and a Storage Account.
An IoT is a collection of interrelated devices; a good example of an IoT is smart home technology - the Bluetooth controlled light switches and other wireless devices that manage actions in our homes.
An Azure IoT Hub is a cloud service that acts as a bi-directional communication “nerve center” between an IoT application and the devices managed by that application.
Configure the Azure IoT Hub
To begin the lab, you will sign in to the Azure portal, navigate to the Shared access policies page of the IoT Hub, and copy the Connection string - primary key for the iotowner policy. Then, you will navigate to the Endpoints page and copy the Event hub-compatible endpoint for the events endpoint. Lastly, you need to navigate to the IoT devices page and add three devices (Building01, Vehicle02, and Equipment03) to the Azure IoT Hub.
You will use the connection strings and endpoints that you copied when you test the endpoints in a later step of the lab.
Define the consumer groups
Now in the Azure portal, you need to start a Cloud Shell session using Bash (Linux). Then you will use the az iot hub consumer-group create --resource-group [name] --hub-name [name] --name [name] command line to create two Consumer Groups on the Azure IoT Hub named primary and secondary.
Create a secondary endpoint
Now you need to navigate to the Endpoints page in the IoT Hub blade and add a Blob storage endpoint. Then navigate to the Routes page and add a route that sends all events to the Blob storage endpoint you just created. Finally, you will add one more route that sends all events to the events endpoint; by default, the events endpoint captures all the events not routed to another endpoint. Because you just re-routed all the events to the Blob storage endpoint, you have to add a route so that the events endpoint keeps getting events.
Test the endpoint and consumer groups
Now you will test the endpoint and consumer groups that you created during the lab. To verify the two consumer groups, you will navigate to the homepage of the web app and use each of the connection strings that you copied earlier to verify that IoT telemetry was generated. To verify the endpoint, you will use the Azure portal to navigate to the container for the storage account, open one of the files, and verify that it contains event data (written to it by the endpoint).
By taking this hands-on lab, you will learn how to configure an Azure IoT Hub, define an IoT endpoint and multiple consumer groups, process IoT data through those endpoints/consumer groups and verify that telemetry data is generated for each.