az iot du device class

Note

This reference is part of the azure-iot extension for the Azure CLI (version 2.37.0 or higher). The extension will automatically install the first time you run an az iot du device class command. Learn more about extensions.

Device class and device class subgroup management.

A device class describes a set of devices which share a common set of attributes across groups while a device class subgroup is a subset of devices in a group that share the same device class id. Device classes are created automatically when Device Update-enabled devices are connected to the hub.

Commands

Name Description Type Status
az iot du device class delete

Delete a device class or device class subgroup.

Extension GA
az iot du device class list

List device classes or device class subgroups.

Extension GA
az iot du device class show

Show details about a device class or device class subgroup including installable updates, the best update and update compliance.

Extension GA
az iot du device class update

Update a device class.

Extension GA

az iot du device class delete

Delete a device class or device class subgroup.

Device classes are automatically created when Device Update-enabled devices are connected to the hub but are not automatically cleaned up since they are referenced by device class subgroups. If all device class subgroups for a target device class are deleted then the device class itself can also be deleted to remove the records from the system and to stop checking the compatibility of the device class with new updates. If a device is ever reconnected its device class will be re-created if it does not exist.

az iot du device class delete --account
                              --cid
                              --instance
                              [--gid]
                              [--resource-group]
                              [--yes {false, true}]

Examples

Delete a device class.

az iot du device class delete -n {account_name} -i {instance_name} --class-id {device_class_id}

Delete a device class and skip the confirmation prompt.

az iot du device class delete -n {account_name} -i {instance_name} --class-id {device_class_id} -y

Delete a device class subgroup.

az iot du device class delete -n {account_name} -i {instance_name} --class-id {device_class_id} --group-id {device_group_id}

Required Parameters

--account -n

Device Update account name. You can configure the default account name using az config set defaults.adu_account=<name>.

--cid --class-id

Device class Id. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash.

--instance -i

Device Update instance name. You can configure the default instance name using az config set defaults.adu_instance=<name>.

Optional Parameters

--gid --group-id

Device group Id. This is created from the value of the ADUGroup tag in the connected IoT Hub's device/module twin or $default for devices with no tag.

--resource-group -g

Device Update account resource group name. You can configure the default group using az config set defaults.adu_group=<name>.

--yes -y

Skip user prompts. Indicates acceptance of action. Used primarily for automation scenarios. Default: false.

accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot du device class list

List device classes or device class subgroups.

az iot du device class list --account
                            --instance
                            [--filter]
                            [--gid]
                            [--resource-group]

Examples

List device classes within an instance.

az iot du device class list -n {account_name} -i {instance_name}

List instance device classes filtered by friendly name.

az iot du device class list -n {account_name} -i {instance_name} --filter "friendlyName eq 'my-favorite-class'"

List device class subgroups for the group.

az iot du device class list -n {account_name} -i {instance_name} --group-id {device_group_id}

List device class subgroups for the group, filtered by compatProperties/manufacturer.

az iot du device class list -n {account_name} -i {instance_name} --group-id {device_group_id} --filter "compatProperties/manufacturer eq 'Contoso'"

Required Parameters

--account -n

Device Update account name. You can configure the default account name using az config set defaults.adu_account=<name>.

--instance -i

Device Update instance name. You can configure the default instance name using az config set defaults.adu_instance=<name>.

Optional Parameters

--filter

If provided with --group-id, supports filtering based on device class compat property names and values. For example "compatProperties/manufacturer eq 'Contoso'". Otherwise supports filtering by class friendly name.

--gid --group-id

Device group Id. This is created from the value of the ADUGroup tag in the connected IoT Hub's device/module twin or $default for devices with no tag.

--resource-group -g

Device Update account resource group name. You can configure the default group using az config set defaults.adu_group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot du device class show

Show details about a device class or device class subgroup including installable updates, the best update and update compliance.

az iot du device class show --account
                            --cid
                            --instance
                            [--best-update {false, true}]
                            [--gid]
                            [--installable-updates {false, true}]
                            [--resource-group]
                            [--update-compliance {false, true}]

Examples

Show a device class.

az iot du device class show -n {account_name} -i {instance_name} --class-id {device_class_id}

Show installable updates for the device class. This flag modifies the command to returns a list.

az iot du device class show -n {account_name} -i {instance_name} --class-id {device_class_id} --installable-updates

Show a device class subgroup.

az iot du device class show -n {account_name} -i {instance_name} --class-id {device_class_id} --group-id {device_group_id}

Show the best update available for a device class subgroup.

az iot du device class show -n {account_name} -i {instance_name} --class-id {device_class_id} --group-id {device_group_id} --best-update

Show update compliance for a device class subgroup.

az iot du device class show -n {account_name} -i {instance_name} --class-id {device_class_id} --group-id {device_group_id} --update-compliance

Required Parameters

--account -n

Device Update account name. You can configure the default account name using az config set defaults.adu_account=<name>.

--cid --class-id

Device class Id. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash.

--instance -i

Device Update instance name. You can configure the default instance name using az config set defaults.adu_instance=<name>.

Optional Parameters

--best-update

Flag indicating the command should fetch the best available update for the device class subgroup including a count of how many devices need the update. Group Id is required for this flag. A best update is the latest update that meets all compatibility specifications of a device class.

accepted values: false, true
--gid --group-id

Device group Id. This is created from the value of the ADUGroup tag in the connected IoT Hub's device/module twin or $default for devices with no tag.

--installable-updates

Flag indicating the command should fetch installable updates for the device class.

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

Device Update account resource group name. You can configure the default group using az config set defaults.adu_group=<name>.

--update-compliance

Flag indicating the command should fetch device class subgroup update compliance information, such as how many devices are on their latest update, how many need new updates, and how many are in progress on receiving a new update. Group Id is required for this flag.

accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot du device class update

Update a device class.

az iot du device class update --account
                              --cid
                              --instance
                              [--friendly-name]
                              [--resource-group]

Examples

Update the device class friendly name.

az iot du device class update -n {account_name} -i {instance_name} --class-id {device_class_id} --friendly-name "EU-region"

Required Parameters

--account -n

Device Update account name. You can configure the default account name using az config set defaults.adu_account=<name>.

--cid --class-id

Device class Id. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash.

--instance -i

Device Update instance name. You can configure the default instance name using az config set defaults.adu_instance=<name>.

Optional Parameters

--friendly-name

The device class friendly name. The friendly name must be 1 - 100 characters and supports alphanumeric, dot and dash values.

--resource-group -g

Device Update account resource group name. You can configure the default group using az config set defaults.adu_group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.