In this hour's lab, participants apply their knowledge about Microsoft's Azure's cloud services and scripting to set-up and connect an Internet of Things (IoT) Hub with an IoT device emulator. After verifying both hub and emulator creation, learners send a message to the IoT device, while updating its digital twin. Using a web app to test the devices, users verify that the IoT Hub works.
The challenge provides users with a resource group, app service plan, web app, and storage account. The lab can take over five minutes to provision, a good time to familiarize yourself with the lab environment and instructions.
System Administrators and Network Engineers use Azure cloud services and Shell to provide and work with the Azure IoT Hub. The hub acts as a message server between the cloud and the devices. You send commands from the hub, and the web app acts as a test to verify device settings and responses.
Understanding the Scenario:
You are a system administrator for a company that is rolling out an Internet of Things data solution. You need to set up an Azure IoT Hub to manage IoT devices. You create an Azure IoT Hub resource with three IoT devices. You manage a device by sending messages to it and updating the device's twin.
Provision an Azure IoT Hub:
In this lab section, you create a new Azure IoT hub. When creating the IoT hub, you need to allow Azure services appropriate access. Then you use the connection string values, found in the iotHubowner and the event-hub compatible end-point to talk with the web app service, securely—the web app links from and to the IoT hub where you can test your device. You can scale up or down the number of devices and traffic capabilities, in the IoT hub, to cover just the devices in use.
Provision the IoT devices:
You set up three devices from the IoT Hub resource and then test results through the web app. Then you simulate sending signals from the devices by emulating devices. The emulated devices use the same code as a manually hooked up IoT device that would interact with the IoT Hub. To create this IoT virtual representation, you need to use the terminal window, which the IoT Hub makes available. You need to connect to the storage account provided for you at the start of the lab to use the shell. You then check your work.
Manage the IoT devices:
You send a message to one of the emulated devices connected to the IoT hub. Then you add a string to update the device's twin. You send the messages from the cloud shell.
An IoT digital twin allows you to configure and test a device, virtually before making the changes. Anytime you wish to check that messages transmitted correctly, you need to send a new message. The messages do not persist in the hub. Likewise, after testing the twin, you need to reset the sample attribute (save it as null and recreate it).
An IoT device and its twin streams data to and from the hub, and changes, unlike the values in a batch script.
Upon successful completion of this advanced challenge, you show your capability to set-up an Internet of Things solution using Azure. You know how to create an IoT Hub, provision, and test devices. Finally, you know how to initiate messages to the device and changes to its twin through the cloud shell.