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

az iot ops asset

注意

此参考是 Azure CLI(版本 2.46.0 或更高版本)的 azure-iot-ops 扩展的一部分。 该扩展将在首次运行 az iot ops asset 命令时自动安装。 详细了解扩展。

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

管理资产。

命令

名称 说明 类型 状态
az iot ops asset create

创建资源。

扩展 预览
az iot ops asset data-point

管理资产中的数据点。

扩展 预览
az iot ops asset data-point add

向资产添加数据点。

扩展 预览
az iot ops asset data-point export

导出资产中的数据点。

扩展 预览
az iot ops asset data-point import

导入资产中的数据点。

扩展 预览
az iot ops asset data-point list

列出资产中的数据点。

扩展 预览
az iot ops asset data-point remove

删除资产中的数据点。

扩展 预览
az iot ops asset delete

删除资产。

扩展 预览
az iot ops asset endpoint

管理资产终结点配置文件。

扩展 预览
az iot ops asset endpoint certificate

管理资产终结点中拥有的证书。

扩展 预览
az iot ops asset endpoint certificate add

将拥有的证书添加到资产终结点。

扩展 预览
az iot ops asset endpoint certificate list

列出资产终结点中拥有的证书。

扩展 预览
az iot ops asset endpoint certificate remove

删除资产终结点中拥有的证书。

扩展 预览
az iot ops asset endpoint create

创建资产终结点。

扩展 预览
az iot ops asset endpoint delete

删除资产终结点。

扩展 预览
az iot ops asset endpoint query

查询资源图中的资产终结点。

扩展 预览
az iot ops asset endpoint show

显示资产终结点。

扩展 预览
az iot ops asset endpoint update

更新资产终结点。

扩展 预览
az iot ops asset event

管理资产中的事件。

扩展 预览
az iot ops asset event add

将事件添加到资产。

扩展 预览
az iot ops asset event export

导出资产中的事件。

扩展 预览
az iot ops asset event import

导入资产中的事件。

扩展 预览
az iot ops asset event list

列出资产中的事件。

扩展 预览
az iot ops asset event remove

删除资产中的事件。

扩展 预览
az iot ops asset query

查询资源图中的资产。

扩展 预览
az iot ops asset show

显示资产。

扩展 预览
az iot ops asset update

更新资产。

扩展 预览

az iot ops asset create

预览

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

创建资源。

必须提供自定义位置或群集名称。 此命令将检查关联的自定义位置和群集的存在,并确保两者都使用 microsoft.deviceregistry.assets 扩展正确设置。

必须在创建资产期间定义至少一个数据点或事件。

az iot ops asset create --endpoint
                        --name
                        --resource-group
                        [--asset-type]
                        [--cl]
                        [--clrg]
                        [--cls]
                        [--cluster]
                        [--cluster-resource-group]
                        [--cluster-subscription]
                        [--data]
                        [--data-publish-int]
                        [--data-queue-size]
                        [--data-sample-int]
                        [--description]
                        [--disable {false, true}]
                        [--display-name]
                        [--documentation-uri]
                        [--eai]
                        [--epi]
                        [--eqs]
                        [--esi]
                        [--event]
                        [--hardware-revision]
                        [--location]
                        [--manufacturer]
                        [--manufacturer-uri]
                        [--model]
                        [--pc]
                        [--serial-number]
                        [--software-revision]
                        [--tags]

示例

使用给定的自定义位置创建资产。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --endpoint {endpoint} --data data_source={data_source}

使用自定义位置的给定自定义位置和资源组创建资产。 如果订阅中有多个具有相同名称的自定义位置,则必须包含资源组。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --custom-location-resource-group {custom_location_resource_group} --endpoint {endpoint} --data data_source={data_source}

使用给定的群集名称创建资产。 如果订阅中有多个具有相同名称的群集,则必须包含资源组。

az iot ops asset create --name {asset_name} -g {resource_group} --cluster {cluster} --cluster-resource-group {cluster_resource_group} --endpoint {endpoint} --event event_notifier={event_notifier}

使用给定的群集名称和自定义位置创建资产。

az iot ops asset create --name {asset_name} -g {resource_group} --cluster {cluster} --custom-location {custom_location} --endpoint {endpoint} --event event_notifier={event_notifier}

使用自定义数据点和事件默认值创建资产。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --endpoint {endpoint} --data-publish-int {data_point_publishing_interval} --data-queue-size {data_point_queue_size} --data-sample-int {data_point_sampling_interval} --event-publish-int {event_publishing_interval} --event-queue-size {event_queue_size} --event-sample-int {event_sampling_interval} --event event_notifier={event_notifier}

使用自定义资产类型、说明、文档 URI、外部资产 ID、硬件修订、代码示例和软件修订版创建资产。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --endpoint {endpoint} --asset-type {asset_type} --description {description} --documentation-uri {documentation_uri} --external-asset-id {external_asset_id} --hardware-revision {hardware_revision} --product-code {product_code} --software-revision {software_revision} --data data_source={data_source}

创建包含两个事件的资产,制造商、制造商 URI、型号、序列号。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --endpoint {endpoint} --event capability_id={capability_id} event_notifier={event_notifier} name={name} observability_mode={observability_mode} sampling_interval={sampling_interval} queue_size={queue_size} --event event_notifier={event_notifier} --manufacturer {manufacturer} --manufacturer-uri {manufacturer_uri} --model {model} --serial-number {serial_number}

创建具有两个数据点的已禁用资产。

az iot ops asset create --name {asset_name} -g {resource_group} --custom-location {custom_location} --endpoint {endpoint} --disable --data capability_id={capability_id} data_source={data_source} name={name} observability_mode={observability_mode} sampling_interval={sampling_interval} queue_size={queue_size} --data data_source={data_source}

使用给定的预填充值创建资产。

az iot ops asset create --name MyAsset -g MyRg --custom-location MyLocation --endpoint example.com --data capability_id=myTagId data_source=NodeID1 name=myTagName1 observability_mode=counter sampling_interval=10 queue_size=2 --data data_source=NodeID2 --data-publish-int 1000 --data-queue-size 1 --data-sample-int 30 --asset-type customAsset --description 'Description for a test asset.' --documentation-uri www.help.com --external-asset-id 000-000-0000 --hardware-revision 10.0 --product-code XXX100 --software-revision 0.1 --manufacturer Contoso --manufacturer-uri constoso.com --model AssetModel --serial-number 000-000-ABC10

必需参数

--endpoint

资产终结点名称。

--name -n

资产名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

可选参数

--asset-type --at

资产类型。

--cl --custom-location

用于将资产与群集关联的自定义位置。

--clrg --custom-location-resource-group

自定义位置的资源组。

--cls --custom-location-subscription

自定义位置的订阅 ID。 如果未提供,将使用资产订阅 ID。

--cluster -c

要与之关联的资产的群集。

--cluster-resource-group --crg

群集的资源组。

--cluster-subscription --cs

群集的订阅 ID。 如果未提供,将使用资产订阅 ID。

--data

与要创建的数据点的属性对应的空格分隔键=值对。 支持以下键值:capability_iddata_source (必需)、 observability_modename(无、仪表、计数器、直方图或日志)、 sampling_interval (int)、 queue_size (int)。 --data 可以使用 1 次或多次。 查看有关完整参数用法的帮助示例。

--data-publish-int --dpi

数据点的默认发布间隔。

默认值: 1000
--data-queue-size --dqs

数据点的默认队列大小。

默认值: 1
--data-sample-int --dsi

数据点的默认采样间隔(以毫秒为单位)。

默认值: 500
--description -d

描述。

--disable

禁用资产。

接受的值: false, true
默认值: False
--display-name --dn

显示名称。

--documentation-uri --du

文档 URI。

--eai --external-asset-id

外部资产 ID。

--epi --event-publish-int

事件的默认发布间隔。

默认值: 1000
--eqs --event-queue-size

事件的默认队列大小。

默认值: 1
--esi --event-sample-int

事件的默认采样间隔(以毫秒为单位)。

默认值: 500
--event

与要创建的事件的属性对应的空格分隔键=值对。 支持以下键值:capability_idevent_notifier (必需)、 observability_modename(无、仪表、计数器、直方图或日志)、 sampling_interval (int)、 queue_size (int)。 --event 可以使用 1 次或多次。 查看有关完整参数用法的帮助示例。

--hardware-revision --hr

硬件修订。

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--manufacturer

制造商。

--manufacturer-uri --mu

制造商 URI。

--model

模型。

--pc --product-code

产品代码。

--serial-number --sn

序列号。

--software-revision --sr

软件修订。

--tags

资产资源标记。 采用以下格式的键值对中的属性包:a=b c=d。

全局参数
--debug

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

--help -h

显示此帮助消息并退出。

--only-show-errors

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

--output -o

输出格式。

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

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

--subscription

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

--verbose

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

az iot ops asset delete

预览

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

删除资产。

az iot ops asset delete --name
                        --resource-group

示例

删除资产。

az iot ops asset delete --name {asset_name} -g {resource_group}

必需参数

--name -n

资产名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

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

--help -h

显示此帮助消息并退出。

--only-show-errors

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

--output -o

输出格式。

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

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

--subscription

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

--verbose

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

az iot ops asset query

预览

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

查询资源图中的资产。

az iot ops asset query [--asset-type]
                       [--cl]
                       [--description]
                       [--disabled {false, true}]
                       [--display-name]
                       [--documentation-uri]
                       [--eai]
                       [--endpoint]
                       [--hardware-revision]
                       [--location]
                       [--manufacturer]
                       [--manufacturer-uri]
                       [--model]
                       [--pc]
                       [--resource-group]
                       [--serial-number]
                       [--software-revision]

示例

查询在给定资源组中禁用的资产。

az iot ops asset query -g {resource_group} --disabled

查询具有给定型号、制造商和序列号的资产。

az iot ops asset query --model {model} --manufacturer {manufacturer} --serial-number {serial_number}

可选参数

--asset-type --at

资产类型。

--cl --custom-location

用于将资产与群集关联的自定义位置。

--description -d

描述。

--disabled

资产状态。

接受的值: false, true
--display-name --dn

显示名称。

--documentation-uri --du

文档 URI。

--eai --external-asset-id

外部资产 ID。

--endpoint

资产终结点名称。

--hardware-revision --hr

硬件修订。

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--manufacturer

制造商。

--manufacturer-uri --mu

制造商 URI。

--model

模型。

--pc --product-code

产品代码。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--serial-number --sn

序列号。

--software-revision --sr

软件修订。

全局参数
--debug

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

--help -h

显示此帮助消息并退出。

--only-show-errors

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

--output -o

输出格式。

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

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

--subscription

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

--verbose

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

az iot ops asset show

预览

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

显示资产。

az iot ops asset show --name
                      --resource-group

示例

显示资产的详细信息。

az iot ops asset show --name {asset_name} -g {resource_group}

必需参数

--name -n

资产名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

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

--help -h

显示此帮助消息并退出。

--only-show-errors

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

--output -o

输出格式。

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

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

--subscription

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

--verbose

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

az iot ops asset update

预览

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

更新资产。

若要更新数据点和事件,请分别使用命令组az iot ops asset data-pointaz iot ops asset events

az iot ops asset update --name
                        --resource-group
                        [--asset-type]
                        [--data-publish-int]
                        [--data-queue-size]
                        [--data-sample-int]
                        [--description]
                        [--disable {false, true}]
                        [--display-name]
                        [--documentation-uri]
                        [--eai]
                        [--epi]
                        [--eqs]
                        [--esi]
                        [--hardware-revision]
                        [--manufacturer]
                        [--manufacturer-uri]
                        [--model]
                        [--pc]
                        [--serial-number]
                        [--software-revision]
                        [--tags]

示例

更新资产的数据点和事件默认值。

az iot ops asset update --name {asset_name} -g {resource_group} --data-publish-int {data_point_publishing_interval} --data-queue-size {data_point_queue_size} --data-sample-int {data_point_sampling_interval} --event-publish-int {event_publishing_interval} --event-queue-size {event_queue_size} --event-sample-int {event_sampling_interval}

更新资产的资产类型、说明、文档 URI、外部资产 ID、硬件修订、代码示例和软件修订。

az iot ops asset update --name {asset_name} -g {resource_group} --asset-type {asset_type} --description {description} --documentation-uri {documentation_uri} --external-asset-id {external_asset_id} --hardware-revision {hardware_revision} --product-code {product_code} --software-revision {software_revision}

更新资产的制造商、制造商 URI、型号、序列号。

az iot ops asset update --name {asset_name} -g {resource_group} --manufacturer {manufacturer} --manufacturer-uri {manufacturer_uri} --model {model} --serial-number {serial_number}

禁用资产。

az iot ops asset update --name {asset_name} -g {resource_group} --disable

必需参数

--name -n

资产名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

可选参数

--asset-type --at

资产类型。

--data-publish-int --dpi

数据点的默认发布间隔。

--data-queue-size --dqs

数据点的默认队列大小。

--data-sample-int --dsi

数据点的默认采样间隔(以毫秒为单位)。

--description -d

描述。

--disable

禁用资产。

接受的值: false, true
--display-name --dn

显示名称。

--documentation-uri --du

文档 URI。

--eai --external-asset-id

外部资产 ID。

--epi --event-publish-int

事件的默认发布间隔。

--eqs --event-queue-size

事件的默认队列大小。

--esi --event-sample-int

事件的默认采样间隔(以毫秒为单位)。

--hardware-revision --hr

硬件修订。

--manufacturer

制造商。

--manufacturer-uri --mu

制造商 URI。

--model

模型。

--pc --product-code

产品代码。

--serial-number --sn

序列号。

--software-revision --sr

软件修订。

--tags

资产资源标记。 采用以下格式的键值对中的属性包:a=b c=d。

全局参数
--debug

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

--help -h

显示此帮助消息并退出。

--only-show-errors

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

--output -o

输出格式。

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

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

--subscription

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

--verbose

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