az iot dt

Manage digital twin of an IoT Plug and Play device.

Commands

az iot dt invoke-command

Executes a command on an IoT Plug and Play device.

az iot dt list-commands

List commands of an IoT Plug and Play devices interface(s).

az iot dt list-interfaces

List interfaces of a target IoT Plug and Play device.

az iot dt list-properties

List properties of a target IoT Plug and Play device interface(s).

az iot dt monitor-events

Monitor Digital Twin events.

az iot dt update-property

Update an IoT Plug and Play device interfaces writable property.

az iot dt invoke-command

Executes a command on an IoT Plug and Play device.

You can leverage az login and provide --hub-name instead of --login for every command.

az iot dt invoke-command --cn
                         --device-id
                         --interface
                         [--command-payload]
                         [--hub-name]
                         [--login]
                         [--resource-group]
                         [--timeout]

Examples

Execute a command on device .

az iot dt invoke-command --login {iothub_cs} --interface {plug_and_play_interface} --device-id {device_id} --command-name {command_name} --command-payload {payload}

Execute a command on device within current session.

az iot dt invoke-command --hub-name {iothub_name} --interface {plug_and_play_interface} --device-id {device_id} --command-name {command_name} --command-payload {payload}

Required Parameters

--cn --command-name

IoT Plug and Play interface command name.

--device-id -d

Target Device.

--interface -i

Target interface name. This should be the name of the interface not the urn-id.

Optional Parameters

--command-payload --cp --cv

IoT Plug and Play interface command payload. Content can be directly input or extracted from a file path.

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--timeout --to

Maximum number of seconds to wait for device method result.

default value: 10

az iot dt list-commands

List commands of an IoT Plug and Play devices interface(s).

You can leverage az login and provide --hub-name instead of --login for every command.

az iot dt list-commands --device-id
                        --source {device, private, public}
                        [--endpoint]
                        [--hub-name]
                        [--interface]
                        [--login]
                        [--repo-id]
                        [--repo-login]
                        [--resource-group]
                        [--schema]

Examples

List all commands of all private interfaces on an IoT Plug and Play device.

az iot dt list-commands --login {iothub_cs} --source private --device-id {device_id} --repo-id {plug_and_play_model_repository_id}

List all commands of a private interface on an IoT Plug and Play device.

az iot dt list-commands --login {iothub_cs} --source private --device-id {device_id} --repo-id {plug_and_play_model_repository_id} --interface {plug_and_play_interface}

List all commands of all public interfaces on an IoT Plug and Play device.

az iot dt list-commands --login {iothub_cs} --source public --device-id {device_id}

List all commands of device's interface on an IoT Plug and Play device.

az iot dt list-commands --login {iothub_cs} --source device --device-id {device_id} --interface {plug_and_play_interface}

Required Parameters

--device-id -d

Target Device.

--source -s

Choose your option to get model definition from specified source.

accepted values: device, private, public

Optional Parameters

--endpoint -e

IoT Plug and Play endpoint.

default value: <a href="https://provider.azureiotrepository.com">https://provider.azureiotrepository.com</a>
--hub-name -n

IoT Hub name.

--interface -i

Target interface name. This should be the name of the interface not the urn-id.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--repo-id -r

IoT Plug and Play repository Id.

--repo-login --rl

This command supports an entity connection string with rights to perform action. Use to avoid PnP endpoint and repository name if repository is private. If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--schema

Show interface with entity schema.

az iot dt list-interfaces

List interfaces of a target IoT Plug and Play device.

You can leverage az login and provide --hub-name instead of --login for every command.

az iot dt list-interfaces --device-id
                          [--hub-name]
                          [--login]
                          [--resource-group]

Examples

List all IoT Plug and Play interfaces on a device.

az iot dt list-interfaces --login {iothub_cs} --device-id {device_id}

List all IoT Plug and Play interfaces on a device within current session.

az iot dt list-interfaces --hub-name {iothub_name} --device-id {device_id}

Required Parameters

--device-id -d

Target Device.

Optional Parameters

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az iot dt list-properties

List properties of a target IoT Plug and Play device interface(s).

You can leverage az login and provide --hub-name instead of --login for every command.

az iot dt list-properties --device-id
                          --source {device, private, public}
                          [--endpoint]
                          [--hub-name]
                          [--interface]
                          [--login]
                          [--repo-id]
                          [--repo-login]
                          [--resource-group]
                          [--schema]

Examples

List all properties of all device's interfaces on an IoT Plug and Play device.

az iot dt list-properties --login {iothub_cs} --source device --device-id {device_id}

List all properties of all public interfaces on an IoT Plug and Play device within current session.

az iot dt list-properties --hub-name {iothub_name} --device-id {device_id} --source public

List all properties of device's interface on an IoT Plug and Play device.

az iot dt list-properties --login {iothub_cs} --source device --device-id {device_id} --interface {plug_and_play_interface}

Required Parameters

--device-id -d

Target Device.

--source -s

Choose your option to get model definition from specified source.

accepted values: device, private, public

Optional Parameters

--endpoint -e

IoT Plug and Play endpoint.

default value: <a href="https://provider.azureiotrepository.com">https://provider.azureiotrepository.com</a>
--hub-name -n

IoT Hub name.

--interface -i

Target interface name. This should be the name of the interface not the urn-id.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--repo-id -r

IoT Plug and Play repository Id.

--repo-login --rl

This command supports an entity connection string with rights to perform action. Use to avoid PnP endpoint and repository name if repository is private. If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--schema

Show interface with entity schema.

az iot dt monitor-events

Monitor Digital Twin events.

You can leverage az login and provide --hub-name instead of --login for every command.

az iot dt monitor-events [--cg]
                         [--content-type]
                         [--device-id]
                         [--device-query]
                         [--enqueued-time]
                         [--hub-name]
                         [--interface]
                         [--login]
                         [--properties {all, anno, app, sys}]
                         [--repair {false, true}]
                         [--resource-group]
                         [--timeout]
                         [--yes {false, true}]

Examples

Basic usage monitoring events of all devices and all interfaces using the logged in session.

az iot dt monitor-events -n {iothub_name}

Basic usage monitoring events of all devices and all interfaces using an IotHub connection string.

az iot dt monitor-events --login {iothub_cs}

Basic usage when filtering on specific interface events while targeting devices with a wildcard in the ID.

az iot dt monitor-events -n {iothub_name} -d Device* -i {plug_and_play_interface}

Filter Digital Twin events of a subset of devices using IoT Hub query language.

az iot dt monitor-events -n {iothub_name} -q "select * from devices where tags.location.region = 'US'"

Filter events on a device with a particular interface. Use a custom consumer group when binding and see all message properties.

az iot dt monitor-events --login {iothub_cs} --device-id {device_id} --interface {plug_and_play_interface} --consumer-group {consumer_group_name} --properties all

Optional Parameters

--cg --consumer-group -c

Specify the consumer group to use when connecting to event hub endpoint.

default value: $Default
--content-type --ct

Specify the Content-Type of the message payload to automatically format the output to that type.

--device-id -d

Target Device.

--device-query -q

Specify a custom query to filter devices.

--enqueued-time --et -e

Indicates the time that should be used as a starting point to read messages from the partitions. Units are milliseconds since unix epoch. If no time is indicated "now" is used.

--hub-name -n

IoT Hub name.

--interface -i

Target interface name. This should be the name of the interface not the urn-id.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--properties --props -p

Indicate key message properties to output. sys = system properties, app = application properties, anno = annotations.

accepted values: all, anno, app, sys
--repair -r

Reinstall uamqp dependency compatible with extension version. Default: false.

accepted values: false, true
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--timeout --to -t

Maximum seconds to maintain connection without receiving message. Use 0 for infinity.

default value: 300
--yes -y

Skip user prompts. Indicates acceptance of dependency installation (if required). Used primarily for automation scenarios. Default: false.

accepted values: false, true

az iot dt update-property

Update an IoT Plug and Play device interfaces writable property.

az iot dt update-property --device-id
                          --interface-payload
                          [--hub-name]
                          [--login]
                          [--resource-group]

Examples

Update an IoT Plug and Play device interfaces read-write property.

az iot dt update-property --login {iothub_cs} --device-id {device_id} --interface-payload {payload}

Update an IoT Plug and Play device interfaces read-write property within current session.

az iot dt update-property --hub-name {iothub_name} --device-id {device_id} --interface-payload {payload}

Required Parameters

--device-id -d

Target Device.

--interface-payload --ip --iv

IoT Plug and Play interface payload. Content can be directly input or extracted from a file path.

Optional Parameters

--hub-name -n

IoT Hub name.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.