Using the IoT Hub command-line tool
Azure IoT also provides a command-line tool called iothub-explorer
. This tool helps you to manage the device registry from the hosted computer itself. It works for the following management options:
- Device twins
- Direct methods
- Cloud-to-device messages
- Device twin queries
This CLI tool is built using Node.js. In order to use the CLI command, we will need Node.js installed on the machine.
How to do it...
We will use the command-line tool, iothub-explorer
in this recipe:
- Install
iothub-explorer
tool by following the link: https://github.com/azure/iothub-explorer.
- Connect to the IoT Hub using the connection string:
iothub-explorer login ‘<IoTHubConnectionString>
- We will try and send a cloud-to-device message using this command:
iothub-explorer send myFirstDevice "Hello IoT Device"
There's more...
The cross-platform command-line tool is easy to install and is useful for quick troubleshooting or testing of your IoT device. When you run the Help
command, it will list...