Lab – setting up and monitoring IoT devices
After completing this lab, you will be able to do the following:
- Set up a virtual device using VS Code and the IoT SDKs
- Create a direct method on a device and call it from IoT Hub
- Monitor a device using the CLI
To do this, you will need to perform the following steps:
- Open VS Code and using Control + Shift + P, open the Command Palette.
- Enter the
Azure IoT Hub: Create Device
command in the Command Palette. - Enter the device ID as
Device02
. - Once the device has been created, you should see the connection string for the device. Copy this for later.
- Press the Ctrl + ~ keys to open the terminal.
- Run the following code in the terminal to create a new project and install the SDK:
mkdir Device02 Cd Device02 dotnet new console dotnet add package Microsoft.Azure.Devices.Client
- Open the
Device02
folder in VS Code and open theProgram.cs
file. - Replace the code inside that file with the following...