Azure Digital Twins CLI command set

Apart from managing your Azure Digital Twins instance in the Azure portal, Azure Digital Twins also has a command set for the Azure CLI that you can use to do most major actions with the service, including:

  • Managing an Azure Digital Twins instance
  • Managing models
  • Managing digital twins
  • Managing twin relationships
  • Configuring endpoints
  • Managing routes
  • Configuring security via Azure role-based access control (Azure RBAC)

The command set is called az dt, and is part of the Azure IoT extension for Azure CLI. You can view the full list of commands and their usage as part of the reference documentation for the az iot command set: az dt command reference.

Uses (deploy and validate)

Apart from generally managing your instance, the CLI is also a useful tool for deployment and validation.

  • The control plane commands can be used to make the deployment of a new instance repeatable or automated.
  • The data plane commands can be used to quickly check values in your instance, and verify that operations completed as expected.

Get the command set

The Azure Digital Twins commands are part of the Azure IoT extension for Azure CLI (azure-iot), so follow these steps to make sure you have the latest azure-iot extension with the az dt commands.

CLI version requirements

If you're using the Azure CLI with PowerShell, your Azure CLI version should be 2.3.1 or above as a requirement of the extension package.

You can check the version of your Azure CLI with this CLI command:

az --version

For instructions on how to install or update the Azure CLI to a newer version, see Install the Azure CLI.

Get the extension

The Azure CLI will automatically prompt you to install the extension on the first use of a command that requires it.

Otherwise, you can use the following command to install the extension yourself at any time (or update it if it turns out that you already have an older version). The command can be run in either the Azure Cloud Shell or a local Azure CLI.

az extension add --upgrade --name azure-iot

Next steps

Explore the CLI and its full set of commands through the reference docs: