title: Manage IoT Hub Device Provisioning Service using Azure CLI & IoT extension description: Learn how to use Azure CLI and the IoT extension to manage the IoT Hub Device Provisioning Service (DPS) author: chrissie926 ms.author: menchi ms.date: 01/17/2018 ms.topic: conceptual ms.service: iot-dps services: iot-dps
Azure CLI is an open-source cross platform command-line tool for managing Azure resources such as IoT Edge. Azure CLI is available on Windows, Linux, and MacOS. Azure CLI enables you to manage Azure IoT Hub resources, Device Provisioning service instances, and linked-hubs out of the box.
The IoT extension enriches Azure CLI with features such as device management and full IoT Edge capability.
In this tutorial, you first complete the steps to setup Azure CLI and the IoT extension. Then you learn how to run CLI commands to perform basic Device Provisioning Service operations.
[!INCLUDE iot-hub-cli-version-info]
Python 2.7x or Python 3.x is required.
Follow the installation instruction to setup Azure CLI in your environment. At a minimum, your Azure CLI version must be 2.0.70 or above. Use az –version
to validate. This version supports az extension commands and introduces the Knack command framework. One simple way to install on Windows is to download and install the MSI.
The IoT extension readme describes several ways to install the extension. The simplest way is to run az extension add --name azure-iot
. After installation, you can use az extension list
to validate the currently installed extensions or az extension show --name azure-iot
to see details about the IoT extension. To remove the extension, you can use az extension remove --name azure-iot
.
The example shows you how to log in to your Azure account, create an Azure Resource Group (a container that holds related resources for an Azure solution), create an IoT Hub, create a Device Provisioning service, list the existing Device Provisioning services and create a linked IoT hub with CLI commands.
Complete the installation steps described previously before you begin. If you don't have an Azure account yet, you can create a free account today.
az login
az group create -l eastus -n IoTHubBlogDemo
az iot dps create --resource-group IoTHubBlogDemo --name demodps
az iot dps create --resource-group IoTHubBlogDemo --name demodps2
az iot dps list --resource-group IoTHubBlogDemo
az iot hub create --name blogDemoHub --resource-group IoTHubBlogDemo
az iot dps linked-hub create --resource-group IoTHubBlogDemo --dps-name demodps --connection-string <connection string> -l westus
In this tutorial, you learned how to:
[!div class="checklist"]
- Enroll the device
- Start the device
- Verify the device is registered
Advance to the next tutorial to learn how to provision multiple devices across load-balanced hubs.
[!div class="nextstepaction"] Provision devices across load-balanced IoT hubs