Skip to content
Azure IoT extension for Azure CLI
Branch: dev
Clone or download
digimaun Improvements for 0.8.7 (#123)
- Add user agent for MQTT
- Improve user agent pattern for HTTP
- Adds QoS arg to send-d2c-message
- Fix and improve help content. Lots related to ADM.
Latest commit 52e491e Dec 2, 2019

Microsoft Azure IoT extension for Azure CLI

Python Build Status

The Azure IoT extension for Azure CLI aims to accelerate the development, management and automation of Azure IoT solutions. It does this via addition of rich features and functionality to the official Azure CLI.


Please refer to the official az iot page on Microsoft Docs for a complete list of supported commands. You can also find IoT CLI usage tips on the wiki.


  1. Install the Azure CLI
    • You must have at least v2.0.24, which you can verify with az --version
  2. Add, Update or Remove the IoT extension with the following commands:
    • Add: az extension add --name azure-cli-iot-ext
    • Update: az extension update --name azure-cli-iot-ext
    • Remove: az extension remove --name azure-cli-iot-ext

Please refer to the Installation Troubleshooting Guide if you run into any issues or the Alternative Installation Methods if you'd like to install from a GitHub release or local source.


After installing the Azure IoT extension your CLI environment is augmented with the addition of central, device, dps, dt, edge, hub and pnp commands.

For usage and help content for any command or command group, pass in the -h parameter, for example:

$ az iot hub -h
    az iot hub : Manage entities in an Azure IoT Hub.

    certificate                   : Manage IoT Hub certificates.
    configuration                 : Manage IoT device configurations at scale.
    consumer-group                : Manage the event hub consumer groups of an IoT hub.
    device-identity               : Manage IoT devices.
    device-twin                   : Manage IoT device twin configuration.
    devicestream                  : Manage device streams of an IoT hub.
    distributed-tracing [Preview] : Manage distributed settings per-device.
    job                           : Manage jobs in an IoT hub.
    message-enrichment            : Manage message enrichments for endpoints of an IoT Hub.
    module-identity               : Manage IoT device modules.
    module-twin                   : Manage IoT device module twin configuration.
    policy                        : Manage shared access policies of an IoT hub.
    route                         : Manage routes of an IoT hub.
    routing-endpoint              : Manage custom endpoints of an IoT hub.

    create                        : Create an Azure IoT hub.
    delete                        : Delete an IoT hub.
    generate-sas-token            : Generate a SAS token for a target IoT Hub, device or module.
    invoke-device-method          : Invoke a device method.
    invoke-module-method          : Invoke an Edge module method.
    list                          : List IoT hubs.
    list-skus                     : List available pricing tiers.
    manual-failover               : Initiate a manual failover for the IoT Hub to the geo-paired
                                    disaster recovery region.
    monitor-events                : Monitor device telemetry & messages sent to an IoT Hub.
    monitor-feedback              : Monitor feedback sent by devices to acknowledge cloud-to-device
                                    (C2D) messages.
    query                         : Query an IoT Hub using a powerful SQL-like language.
    show                          : Get the details of an IoT hub.
    show-connection-string        : Show the connection strings for an IoT hub.
    show-quota-metrics            : Get the quota metrics for an IoT hub.
    show-stats                    : Get the statistics for an IoT hub.
    update                        : Update metadata for an IoT hub.

Scenario Automation

Please refer to the Scenario Automation page for examples of how to use the IoT extension in scripts.


Please refer to the Contributing page for developer setup instructions and contribution guidelines.


We are constantly improving and are always open to new functionality or enhancement ideas. Submit your feedback in the project issues.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

You can’t perform that action at this time.