az iot ops asset

注意

此參考是 Azure CLI 的 azure-iot-ops 延伸模組的一部分(2.46.0 版或更高版本)。 擴充功能會在您第一次執行 az iot ops asset 命令時自動安裝。 深入了解擴充功能。

命令群組 'iot ops' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

管理資產。

命令

名稱 Description 類型 狀態
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

查詢資產端點的 Resource Graph。

副檔名 預覽​​
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

查詢 Resource Graph 中的資產。

副檔名 預覽​​
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、外部資產識別碼、硬體修訂、產品名稱和軟體修訂的資產。

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

自訂位置的訂用帳戶標識碼。 如果未提供,則會使用資產訂用帳戶標識碼。

--cluster -c

要與資產建立關聯的叢集。

--cluster-resource-group --crg

叢集的資源群組。

--cluster-subscription --cs

叢集的訂用帳戶標識碼。 如果未提供,則會使用資產訂用帳戶標識碼。

--data

與要建立之數據點屬性對應的空格分隔索引鍵=值組。 支援下列索引鍵值:capability_iddata_source (必要)、 nameobservability_mode 、(無、量測計、計數器、直方圖或記錄)、 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

外部資產標識碼。

--epi --event-publish-int

事件的預設發佈間隔。

預設值: 1000
--eqs --event-queue-size

事件的預設佇列大小。

預設值: 1
--esi --event-sample-int

事件的預設取樣間隔(以毫秒為單位)。

預設值: 500
--event

與要建立之事件屬性對應的空格分隔索引鍵=值組。 支援下列索引鍵值:capability_idevent_notifier (必要)、 nameobservability_mode 、(無、量測計、計數器、直方圖或記錄)、 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az iot ops asset query

預覽

命令群組 'iot ops' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

查詢 Resource Graph 中的資產。

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

外部資產標識碼。

--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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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、外部資產識別碼、硬體修訂、產品代碼和軟體修訂。

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

外部資產標識碼。

--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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。