你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az iot ops ns device

Note

此参考是 Azure CLI(版本 2.67.0 或更高版本)的 azure-iot-ops 扩展的一部分。 该扩展将在首次运行 az iot ops ns device 命令时自动安装。 了解更多关于扩展的信息。

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

管理设备注册表命名空间中的设备。

命令

名称 说明 类型 Status
az iot ops ns device create

在设备注册表命名空间中创建设备。

Extension Preview
az iot ops ns device delete

从设备注册表命名空间中删除设备。

Extension Preview
az iot ops ns device endpoint

管理设备注册表命名空间中的设备的终结点。

Extension Preview
az iot ops ns device endpoint inbound

管理设备注册表命名空间中的设备的入站终结点。

Extension Preview
az iot ops ns device endpoint inbound add

将入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound add custom

将自定义入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound add media

将媒体入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound add onvif

将 ONVIF 入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound add opcua

将 OPC UA 入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound add rest

将 Rest 入站终结点添加到设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device endpoint inbound list

列出设备注册表命名空间中的设备的入站终结点。

Extension Preview
az iot ops ns device endpoint inbound remove

从设备注册表命名空间中的设备中删除入站终结点。

Extension Preview
az iot ops ns device endpoint list

列出设备注册表命名空间中设备的所有终结点。

Extension Preview
az iot ops ns device query

查询设备注册表命名空间中的设备。

Extension Preview
az iot ops ns device show

在设备注册表命名空间中显示设备的详细信息。

Extension Preview
az iot ops ns device update

更新设备注册表命名空间中的设备。

Extension Preview

az iot ops ns device create

预览

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

在设备注册表命名空间中创建设备。

设备将链接到 Azure IoT作实例。

az iot ops ns device create --instance
                            --name
                            --resource-group
                            [--attr --custom-attribute]
                            [--disabled {false, true}]
                            [--manufacturer]
                            [--model]
                            [--os]
                            [--os-version --osv]
                            [--tags]

示例

创建配置最少的设备

az iot ops ns device create --name mydevice --instance myInstance -g myInstanceResourceGroup

使用自定义属性创建设备

az iot ops ns device create --name mydevice --instance myInstance -g myInstanceResourceGroup --attr location=building1 floor=3

使用制造商信息和作系统详细信息创建设备

az iot ops ns device create --name mydevice --instance myInstance -g myInstanceResourceGroup --manufacturer "Contoso" --model "Gateway X1" --os "Linux" --os-version "4.15"

使用标记创建禁用的设备

az iot ops ns device create --name mydevice --instance myInstance -g myInstanceResourceGroup --disabled --tags environment=test criticality=low

必需参数

--instance -i

Azure IoT作实例的名称。

--name -n

要创建的设备的名称。

--resource-group -g

Azure IoT作实例的资源组。

可选参数

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

--attr --custom-attribute

与设备的其他自定义属性对应的空格分隔键=值对。 此参数可以多次使用。

--disabled

禁用设备。

属性
Parameter group: Additional Info Arguments
接受的值: false, true
--manufacturer

设备制造商。

属性
Parameter group: Additional Info Arguments
--model

设备型号。

属性
Parameter group: Additional Info Arguments
--os

设备操作系统。

属性
Parameter group: Additional Info Arguments
--os-version --osv

设备作系统版本。

属性
Parameter group: Additional Info Arguments
--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az iot ops ns device delete

预览

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

从设备注册表命名空间中删除设备。

az iot ops ns device delete --instance
                            --name
                            --resource-group
                            [--yes {false, true}]

示例

删除设备

az iot ops ns device delete --name mydevice --instance myInstance -g myInstanceResourceGroup

必需参数

--instance -i

Azure IoT作实例的名称。

--name -n

要创建的设备的名称。

--resource-group -g

Azure IoT作实例的资源组。

可选参数

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

--yes -y

在没有提示的情况下确认 [y]es。 适用于 CI 和自动化方案。

属性
默认值: False
接受的值: false, true
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az iot ops ns device query

预览

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

查询设备注册表命名空间中的设备。

根据各种搜索条件(包括设备名称、制造商、型号等)跨命名空间查询设备。

az iot ops ns device query [--cq --custom-query]
                           [--disabled {false, true}]
                           [--instance]
                           [--manufacturer]
                           [--model]
                           [--name]
                           [--os]
                           [--os-version --osv]
                           [--resource-group]

示例

查询 IoT作实例中的设备

az iot ops ns device query --instance myInstance -g myInstanceResourceGroup

按名称查询特定设备

az iot ops ns device query --name mydevice

从特定制造商查询设备

az iot ops ns device query --manufacturer "Contoso"

使用自定义查询搜索设备

az iot ops ns device query --custom-query "where tags.environment=='production'"

可选参数

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

--cq --custom-query

要使用的自定义查询。 除了实例名称和资源组之外,所有其他查询参数都将被忽略。

--disabled

资产状态。

属性
Parameter group: Additional Info Arguments
接受的值: false, true
--instance -i

Azure IoT作实例的名称。

--manufacturer

设备制造商。

属性
Parameter group: Additional Info Arguments
--model

设备型号。

属性
Parameter group: Additional Info Arguments
--name -n

要创建的设备的名称。

--os

设备操作系统。

属性
Parameter group: Additional Info Arguments
--os-version --osv

设备作系统版本。

属性
Parameter group: Additional Info Arguments
--resource-group -g

Azure IoT作实例的资源组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az iot ops ns device show

预览

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

在设备注册表命名空间中显示设备的详细信息。

az iot ops ns device show --instance
                          --name
                          --resource-group

示例

显示设备的详细信息

az iot ops ns device show --name mydevice --instance myInstance -g myInstanceResourceGroup

必需参数

--instance -i

Azure IoT作实例的名称。

--name -n

要创建的设备的名称。

--resource-group -g

Azure IoT作实例的资源组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az iot ops ns device update

预览

命令组“iot ops ns”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

更新设备注册表命名空间中的设备。

az iot ops ns device update --instance
                            --name
                            --resource-group
                            [--attr --custom-attribute]
                            [--disabled {false, true}]
                            [--os-version --osv]
                            [--tags]

示例

更新设备自定义属性

az iot ops ns device update --name mydevice --instance myInstance -g myInstanceResourceGroup --attr location=building2 floor=5

更新操作系统版本

az iot ops ns device update --name mydevice --instance myInstance -g myInstanceResourceGroup --os-version "4.18"

禁用设备

az iot ops ns device update --name mydevice --instance myInstance -g myInstanceResourceGroup --disabled

更新设备标记

az iot ops ns device update --name mydevice --instance myInstance -g myInstanceResourceGroup --tags environment=production criticality=high

必需参数

--instance -i

Azure IoT作实例的名称。

--name -n

要创建的设备的名称。

--resource-group -g

Azure IoT作实例的资源组。

可选参数

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

--attr --custom-attribute

与设备的其他自定义属性对应的空格分隔键=值对。 此参数可以多次使用。

--disabled

禁用设备。

属性
Parameter group: Additional Info Arguments
接受的值: false, true
--os-version --osv

设备作系统版本。

属性
Parameter group: Additional Info Arguments
--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False