Monitor device connectivity using Azure CLI
Use the Azure CLI IoT extension to see messages your devices are sending to IoT Central and observe changes in the device twin. You can use this tool to debug and observe device connectivity and diagnose issues of device messages not reaching the cloud or devices not responding to twin changes.
A work or school account in Azure, added as a user in an IoT Central application.
Prepare your environment for the Azure CLI
Use the Bash environment in Azure Cloud Shell.
If you prefer, install the Azure CLI to run CLI reference commands.
If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For additional sign-in options, see Sign in with the Azure CLI.
When you're prompted, install Azure CLI extensions on first use. For more information about extensions, see Use extensions with the Azure CLI.
Install the IoT Central extension
Run the following command from your command line to install:
az extension add --name azure-iot
Check the version of the extension by running:
You should see the azure-iot extension is 0.9.9 or higher. If it is not, run:
az extension update --name azure-iot
Using the extension
The following sections describe common commands and options that you can use when you run
az iot central. To view the full set of commands and options, pass
az iot central or any of its subcommands.
Start by signing into the Azure CLI.
Get the Application ID of your IoT Central app
In Administration/Application Settings, copy the Application ID. You use this value in later steps.
Monitor the messages that are being sent to your IoT Central app from your devices. The output includes all headers and annotations.
az iot central diagnostics monitor-events --app-id <app-id> --properties all
View device properties
View the current read and read/write device properties for a given device.
az iot central device twin show --app-id <app-id> --device-id <device-id>
A suggested next step is to read about Device connectivity in Azure IoT Central.