az iot adr ns device

Note

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

Manage Device Registry namespace devices.

Commands

Name Description Type Status
az iot adr ns device list

List devices in a Device Registry namespace.

Extension GA
az iot adr ns device revoke

Revoke credentials for a device in a Device Registry namespace.

Extension GA
az iot adr ns device show

Show a device in a Device Registry namespace.

Extension GA
az iot adr ns device update

Update a device in a Device Registry namespace.

Extension GA

az iot adr ns device list

List devices in a Device Registry namespace.

az iot adr ns device list --namespace --ns
                          --resource-group

Examples

List all devices in a namespace

az iot adr ns device list --ns myNamespace -g myResourceGroup

Required Parameters

--namespace --ns

Name of the Device Registry namespace.

--resource-group -g

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

az iot adr ns device revoke

Revoke credentials for a device in a Device Registry namespace.

This command revokes all active credentials for the specified device. The device will need to re-authenticate and obtain new credentials.

Use --disable to also prevent the device from obtaining new credentials.

az iot adr ns device revoke --device-name --dn --name
                            --namespace --ns
                            --resource-group
                            [--acquire-policy-token]
                            [--change-reference]
                            [--disable]
                            [--yes {false, true}]

Examples

Revoke device credentials

az iot adr ns device revoke -n myDevice --ns myNamespace -g myResourceGroup

Revoke credentials and disable the device

az iot adr ns device revoke -n myDevice --ns myNamespace -g myResourceGroup --disable

Required Parameters

--device-name --dn --name -n

Name of the device.

--namespace --ns

Name of the Device Registry namespace.

--resource-group -g

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

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--disable

Disable the device after revoking credentials. Prevents new credentials from being issued.

Property Value
Default value: False
--yes -y

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

Property Value
Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

az iot adr ns device show

Show a device in a Device Registry namespace.

az iot adr ns device show --device-name --dn --name
                          --namespace --ns
                          --resource-group

Examples

Show device details

az iot adr ns device show -n myDevice --ns myNamespace -g myResourceGroup

Required Parameters

--device-name --dn --name -n

Name of the device.

--namespace --ns

Name of the Device Registry namespace.

--resource-group -g

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

az iot adr ns device update

Update a device in a Device Registry namespace.

az iot adr ns device update --device-name --dn --name
                            --namespace --ns
                            --resource-group
                            [--acquire-policy-token]
                            [--attributes]
                            [--change-reference]
                            [--enabled {false, true}]
                            [--os-version]
                            [--policy-resource-id]
                            [--tags]

Examples

Disable a device

az iot adr ns device update -n myDevice --ns myNamespace -g myResourceGroup --enabled false

Update device OS version

az iot adr ns device update -n myDevice --ns myNamespace -g myResourceGroup --os-version "2.0.1"

Required Parameters

--device-name --dn --name -n

Name of the device.

--namespace --ns

Name of the Device Registry namespace.

--resource-group -g

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

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--attributes

Device attributes in JSON format.

--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--enabled

Enable or disable the device. A disabled device cannot authenticate with Microsoft Entra ID.

Property Value
Accepted values: false, true
--os-version

Operating system version of the device.

--policy-resource-id

Resource ID of the credential policy to associate with the device.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False