Share via


az iot device registration

注意

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

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

管理 IoT 裝置布建服務的 IoT 裝置註冊。

使用 az iot dps enrollment registrationaz iot dps enrollment-group registration 來檢視及刪除註冊。

命令

名稱 Description 類型 狀態
az iot device registration create

向 IoT 裝置布建服務註冊 IoT 裝置。

擴充 預覽版

az iot device registration create

預覽

命令群組 「iot 裝置註冊」處於預覽狀態,目前正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

向 IoT 裝置布建服務註冊 IoT 裝置。

支援下列證明機制:

  • 對稱金鑰
  • x509 憑證 如果使用 x509 驗證方法,則必須提供必要的憑證和金鑰檔案(以及複雜密碼)。
az iot device registration create --registration-id
                                  [--auth-type {key, login}]
                                  [--certificate-file-path]
                                  [--ck]
                                  [--dps-name]
                                  [--enrollment-group-id]
                                  [--host]
                                  [--id-scope]
                                  [--key]
                                  [--key-file-path]
                                  [--login]
                                  [--pass]
                                  [--payload]
                                  [--resource-group]

範例

使用個別註冊註冊 IoT 裝置。

az iot device registration create -n {dps_name} --rid {registration_id}

使用群組註冊註冊 IoT 裝置。

az iot device registration create -n {dps_name} --rid {registration_id} --gid {group_enrollment_id}

使用個別註冊、裝置布建服務識別碼範圍和指定的對稱金鑰註冊 IoT 裝置。 這會略過擷取識別碼範圍和個別註冊對稱金鑰。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --key {symmetric_key}

使用群組註冊、裝置布建服務識別碼範圍,以及指定的註冊群組對稱金鑰來註冊 IoT 裝置。 這會略過擷取識別碼範圍和註冊群組對稱金鑰。 用於裝置註冊的對稱金鑰將會從指定的對稱金鑰計算。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --gid {group_enrollment_id} --key {symmetric_key} --ck

使用群組註冊、裝置布建服務識別碼範圍,以及指定的對稱金鑰註冊 IoT 裝置。 這會略過擷取識別碼範圍。 請注意,由於對稱金鑰應該是計算裝置金鑰,因此不需要註冊群組識別碼。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --key {symmetric_key}

使用個別註冊、裝置布建服務識別碼範圍,以及指定的憑證和金鑰檔案註冊 IoT 裝置。 這會略過擷取識別碼範圍。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --cp {certificate_file} --kp {key_file}

使用個別註冊、裝置布建服務識別碼範圍,以及金鑰檔案的憑證和金鑰檔案和複雜密碼來註冊 IoT 裝置。 這會略過擷取識別碼範圍。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --cp {certificate_file} --kp {key_file} --pass {passphrase}

使用群組註冊、裝置布建服務識別碼範圍,以及指定的憑證和金鑰檔案註冊 IoT 裝置。 這會略過擷取識別碼範圍。 請注意,x509 證明不需要群組註冊識別碼,而且憑證檔案的主體是註冊識別碼。

az iot device registration create --id-scope {id_scope} --rid {registration_id} --cp {certificate_file} --kp {key_file}

必要參數

--registration-id --rid

裝置註冊識別碼或個別註冊識別碼。

選擇性參數

--auth-type

指出作業是否應該自動衍生原則金鑰,或使用目前的 Azure AD 會話。 如果驗證類型是登入,而且會提供資源主機名稱,除非需要,否則將會略過資源查閱。您可以使用 來設定預設值 az configure --defaults iothub-data-auth-type=<auth-type-value>

接受的值: key, login
預設值: key
--certificate-file-path --cp

憑證 PEM 檔案的路徑。 x509 註冊的必要專案。

--ck --compute-key

旗標,表示應該使用 --symmetric-key 從指定的金鑰計算裝置註冊的對稱金鑰。

預設值: False
--dps-name -n

Azure IoT 中樞裝置布建服務的名稱。 如果未提供 --login 或未提供 authenticaton 引數,則為必要專案,且未提供 --id-scope。

--enrollment-group-id --gid --group-id

註冊群組識別碼。 只需要擷取驗證引數。

--host --provisioning-host

指向要使用的布建主機的端點。

預設值: global.azure-devices-provisioning.net
--id-scope --scope

Azure IoT 中樞裝置布建服務的識別碼範圍。 如果提供驗證引數,將會避免會話登入。

--key --symmetric-key

裝置註冊的對稱共用存取金鑰。

--key-file-path --kp

金鑰 PEM 檔案的路徑。 x509 註冊的必要專案。

--login -l

此命令支援具有執行動作許可權的實體連接字串。 使用 來避免透過 「az login」 的會話登入。 如果提供實體連接字串和名稱,則連接字串優先。 如果未提供 --dps-name,或未提供 authenticaton 引數和 --id-scope,則為必要專案。

--pass --passphrase

憑證的複雜密碼。

--payload

自訂配置承載為 JSON。 特別是用於使用 Azure Functions 的自訂配置原則。

--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 來取得完整偵錯記錄。