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

az iot dps enrollment

Note

This reference is part of the azure-iot extension for the Azure CLI (version 2.59.0 or higher). 该扩展将在首次运行 az iot dps enrollment 命令时自动安装。 Learn more about extensions.

管理 Azure IoT 中心设备预配服务中的单个设备注册。

命令

名称 说明 类型 Status
az iot dps enrollment create

在Azure IoT 中心设备预配服务中创建单个设备注册。

Extension GA
az iot dps enrollment delete

删除Azure IoT 中心设备预配服务中的单个设备注册。

Extension GA
az iot dps enrollment list

列出Azure IoT 中心设备预配服务中的单个设备注册。

Extension GA
az iot dps enrollment registration

在Azure IoT 中心设备预配服务中管理单个注册的服务端设备注册。

Extension GA
az iot dps enrollment registration delete

删除Azure IoT 中心设备预配服务中单个注册的设备注册。

Extension GA
az iot dps enrollment registration show

获取Azure IoT 中心设备预配服务中单个注册的设备注册。

Extension GA
az iot dps enrollment show

获取Azure IoT 中心设备预配服务中的单个设备注册详细信息。

Extension GA
az iot dps enrollment update

更新Azure IoT 中心设备预配服务中的单个设备注册。

Extension GA

az iot dps enrollment create

在Azure IoT 中心设备预配服务中创建单个设备注册。

请使用 Base64 ASCII 编码提供证书格式,证书应具有匹配的 BEGIN 和 END 段,例如:以“-----BEGIN CERTIFICATE-----”开头,以“-----END CERTIFICATE-----”结尾。

az iot dps enrollment create --at --attestation-type {symmetricKey, tpm, x509}
                             --eid --enrollment-id
                             [--allocation-policy --ap {custom, geoLatency, hashed, static}]
                             [--api-version --av]
                             [--auth-type {key, login}]
                             [--certificate-path --cp]
                             [--device-id]
                             [--device-information --info]
                             [--dps-name]
                             [--edge-enabled --ee {false, true}]
                             [--ek --endorsement-key]
                             [--ih --iot-hubs]
                             [--initial-twin-properties --props]
                             [--initial-twin-tags --tags]
                             [--login]
                             [--pk --primary-key]
                             [--provisioning-status --ps {disabled, enabled}]
                             [--reprovision-policy --rp {never, reprovisionandmigratedata, reprovisionandresetdata}]
                             [--resource-group]
                             [--scp --secondary-certificate-path]
                             [--secondary-key --sk]
                             [--webhook-url --wh]

示例

在资源组“{enrollment_id resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中创建具有证明类型“x509”的注册“{resource_group_name}”,其预配状态为“disabled”, 设备 ID'{device_id}',初始孪生属性'{“location”:{“region”:“US”}}',初始孪生标记'{“version”:“1”}“,以及设备信息'{”color“:”red“}”。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type x509 --certificate-path /certificates/Certificate.pem --provisioning-status disabled --initial-twin-properties "{'location':{'region':'US'}}" --initial-twin-tags "{'version':'1'}" --device-info "{'color':'red'}" --device-id {device_id}

在资源组“{resource_group_name}”的 Azure IoT 设备预配服务“{dps_name}”中创建具有证明类型“tpm”的注册“MyEnrollment”。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type tpm --endorsement-key 14963E8F3BA5B3984110B3C1CA8E8B89

在资源组“{resource_group_name}”的 Azure IoT 设备预配服务“{dps_name}”中创建具有证明类型“symmetrickey”的注册“MyEnrollment”。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type symmetrickey --primary-key {primary_key} --secondary-key {secondary_key}

在资源组“{resource_group_name}”的 Azure IoT 设备预配服务“{dps_name}”中创建注册“MyEnrollment”。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type tpm --reprovision-policy {reprovision_type} --endorsement-key 14963E8F3BA5B3984110B3C1CA8E8B89

在资源组“{resource_group_name}”的 Azure IoT 设备预配服务“{dps_name}”中创建具有静态分配策略的注册“MyEnrollment”。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type tpm --allocation-policy static --endorsement-key 14963E8F3BA5B3984110B3C1CA8E8B89 --iot-hubs {iot_hub_host_name}

在资源组“{resource_group_name}”中创建具有哈希分配策略的注册“MyEnrollment”,并在 Azure IoT 设备预配服务“{dps_name}”中创建多个中心。

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type tpm --allocation-policy hashed --endorsement-key 14963E8F3BA5B3984110B3C1CA8E8B89 --iot-hubs {iot_hub_host_name1} {iot_hub_host_name2}

使用自定义分配策略创建注册“MyEnrollment”

az iot dps enrollment create -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --attestation-type symmetrickey --allocation-policy custom --webhook-url {webhook_url} --api-version {api_version}

必需参数

--at --attestation-type

用于对 DPS 进行身份验证的证明机制。

属性
Parameter group: Authentication Arguments
接受的值: symmetricKey, tpm, x509
--eid --enrollment-id

单个设备注册 ID。

可选参数

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

--allocation-policy --ap

分配策略的类型,用于确定如何将设备分配到 IoT 中心。 如果未提供,则分配策略将是设备预配服务实例的当前分配策略默认设置。

属性
Parameter group: Allocation Policy Arguments
接受的值: custom, geoLatency, hashed, static
--api-version --av

自定义分配请求中发送的预配服务类型的 API 版本。 支持的最低版本:2018-09-01-preview。

属性
Parameter group: Allocation Policy Arguments
--auth-type

指示操作是应自动派生策略密钥还是使用当前的 Azure AD 会话。 如果身份验证类型为登录,并且提供资源主机名,则除非需要,否则将跳过资源查找。可以使用 < a0/a0> 配置默认值 az configure --defaults iotdps-data-auth-type={auth-type-value}

属性
Parameter group: Access Control Arguments
默认值: key
接受的值: key, login
--certificate-path --cp

包含主证书的文件的路径。 选择 x509 作为证明类型且未提供辅助证书路径时必需。

属性
Parameter group: Authentication Arguments
--device-id -d

在 IoT 中心注册的设备 ID。

--device-information --info

可选设备信息。

--dps-name -n

Azure IoT 中心设备预配服务的名称或主机名。 如果未提供 --login,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--edge-enabled --ee

指示边缘启用的标志。

属性
默认值: False
接受的值: false, true
--ek --endorsement-key

TPM 设备的 TPM 认可密钥。 选择 tpm 作为证明类型时,需要认可密钥。

属性
Parameter group: Authentication Arguments
--ih --iot-hubs

与分配策略关联的目标 IoT 中心的主机名。 对多个 IoT 中心使用空格分隔的列表。

属性
Parameter group: Allocation Policy Arguments
--initial-twin-properties --props

初始设备孪生属性。

--initial-twin-tags --tags

初始设备孪生标记。

--login -l

此命令支持具有执行操作权限的实体连接字符串。 用于避免通过“az login”进行会话登录。 如果同时提供实体连接字符串和名称,则连接字符串优先。 如果未提供 --dps-name,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--pk --primary-key

以 base64 格式存储的主对称共享访问密钥。

属性
Parameter group: Authentication Arguments
--provisioning-status --ps

启用或禁用注册条目。

属性
接受的值: disabled, enabled
--reprovision-policy --rp

用于确定在重新预配到其他 IoT 中心时应如何处理设备数据的策略。

属性
接受的值: never, reprovisionandmigratedata, reprovisionandresetdata
--resource-group -g

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

--scp --secondary-certificate-path

包含辅助证书的文件的路径。 选择 x509 作为证明类型且未提供主证书路径时是必需的。

属性
Parameter group: Authentication Arguments
--secondary-key --sk

以 base64 格式存储的辅助对称共享访问密钥。

属性
Parameter group: Authentication Arguments
--webhook-url --wh

用于自定义分配请求的 Azure Function Webhook URL。

属性
Parameter group: Allocation Policy Arguments
全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

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

Output format.

属性
默认值: 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 dps enrollment delete

删除Azure IoT 中心设备预配服务中的单个设备注册。

az iot dps enrollment delete --eid --enrollment-id
                             [--auth-type {key, login}]
                             [--dps-name]
                             [--etag]
                             [--login]
                             [--resource-group]

必需参数

--eid --enrollment-id

单个设备注册 ID。

可选参数

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

--auth-type

指示操作是应自动派生策略密钥还是使用当前的 Azure AD 会话。 如果身份验证类型为登录,并且提供资源主机名,则除非需要,否则将跳过资源查找。可以使用 < a0/a0> 配置默认值 az configure --defaults iotdps-data-auth-type={auth-type-value}

属性
Parameter group: Access Control Arguments
默认值: key
接受的值: key, login
--dps-name -n

Azure IoT 中心设备预配服务的名称或主机名。 如果未提供 --login,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--etag -e

对应于资源最后状态的 Etag 或实体标记。 如果未提供 etag,则使用值“*”。

--login -l

此命令支持具有执行操作权限的实体连接字符串。 用于避免通过“az login”进行会话登录。 如果同时提供实体连接字符串和名称,则连接字符串优先。 如果未提供 --dps-name,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--resource-group -g

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

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

Output format.

属性
默认值: 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 dps enrollment list

列出Azure IoT 中心设备预配服务中的单个设备注册。

az iot dps enrollment list [--auth-type {key, login}]
                           [--dps-name]
                           [--login]
                           [--resource-group]
                           [--top]

可选参数

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

--auth-type

指示操作是应自动派生策略密钥还是使用当前的 Azure AD 会话。 如果身份验证类型为登录,并且提供资源主机名,则除非需要,否则将跳过资源查找。可以使用 < a0/a0> 配置默认值 az configure --defaults iotdps-data-auth-type={auth-type-value}

属性
Parameter group: Access Control Arguments
默认值: key
接受的值: key, login
--dps-name -n

Azure IoT 中心设备预配服务的名称或主机名。 如果未提供 --login,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--login -l

此命令支持具有执行操作权限的实体连接字符串。 用于避免通过“az login”进行会话登录。 如果同时提供实体连接字符串和名称,则连接字符串优先。 如果未提供 --dps-name,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--resource-group -g

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

--top

要返回的最大元素数。 将 -1 用于无限制。

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

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

Output format.

属性
默认值: 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 dps enrollment show

获取Azure IoT 中心设备预配服务中的单个设备注册详细信息。

az iot dps enrollment show --eid --enrollment-id
                           [--auth-type {key, login}]
                           [--dps-name]
                           [--keys --show-keys {false, true}]
                           [--login]
                           [--resource-group]

示例

Basic usage

az iot dps enrollment show --dps-name {dps_name} -g {resource_group} --enrollment-id {enrollment_id}

在对称密钥注册的结果中包含完整的证明信息

az iot dps enrollment show --dps-name {dps_name} -g {resource_group} --enrollment-id {symmetric_key_enrollment_id} --show-keys

必需参数

--eid --enrollment-id

单个设备注册 ID。

可选参数

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

--auth-type

指示操作是应自动派生策略密钥还是使用当前的 Azure AD 会话。 如果身份验证类型为登录,并且提供资源主机名,则除非需要,否则将跳过资源查找。可以使用 < a0/a0> 配置默认值 az configure --defaults iotdps-data-auth-type={auth-type-value}

属性
Parameter group: Access Control Arguments
默认值: key
接受的值: key, login
--dps-name -n

Azure IoT 中心设备预配服务的名称或主机名。 如果未提供 --login,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--keys --show-keys

在注册结果中包含证明密钥和信息。

属性
接受的值: false, true
--login -l

此命令支持具有执行操作权限的实体连接字符串。 用于避免通过“az login”进行会话登录。 如果同时提供实体连接字符串和名称,则连接字符串优先。 如果未提供 --dps-name,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--resource-group -g

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

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

Output format.

属性
默认值: 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 dps enrollment update

更新Azure IoT 中心设备预配服务中的单个设备注册。

请使用 Base64 ASCII 编码提供证书格式,证书应具有匹配的 BEGIN 和 END 段,例如:以“-----BEGIN CERTIFICATE-----”开头,以“-----END CERTIFICATE-----”结尾。

az iot dps enrollment update --eid --enrollment-id
                             [--allocation-policy --ap {custom, geoLatency, hashed, static}]
                             [--api-version --av]
                             [--auth-type {key, login}]
                             [--certificate-path --cp]
                             [--device-id]
                             [--device-information --info]
                             [--dps-name]
                             [--edge-enabled --ee {false, true}]
                             [--ek --endorsement-key]
                             [--etag]
                             [--ih --iot-hubs]
                             [--initial-twin-properties --props]
                             [--initial-twin-tags --tags]
                             [--login]
                             [--pk --primary-key]
                             [--provisioning-status --ps {disabled, enabled}]
                             [--rc --remove-certificate {false, true}]
                             [--remove-secondary-certificate --rsc {false, true}]
                             [--reprovision-policy --rp {never, reprovisionandmigratedata, reprovisionandresetdata}]
                             [--resource-group]
                             [--scp --secondary-certificate-path]
                             [--secondary-key --sk]
                             [--webhook-url --wh]

示例

使用资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的新 x509 证书更新注册“{enrollment_id}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --certificate-path /certificates/NewCertificate.pem --etag AAAAAAAAAAA=

使用资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的新认可密钥更新注册“{enrollment_id}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --endorsement-key 14963E8F3BA5B3984110B3C1CA8E8B89 --etag AAAAAAAAAAA=

使用资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的新主密钥更新注册“{enrollment_id}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --primary-key {new_primary_key} --etag AAAAAAAAAAA=

使用资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的新重新预配类型更新注册“{enrollment_id}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --reprovision-policy {reprovision_type} --etag AAAAAAAAAAA=

使用资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的新分配策略更新注册“{enrollment_id}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --allocation-policy geolatency --etag AAAAAAAAAAA= --iot-hubs {iot_hub_host_name1} {iot_hub_host_name2} {iot_hub_host_name3}

将资源组“{resource_group_name}”中的 Azure IoT 设备预配服务“{dps_name}”中的注册“{enrollment_id}”更新为初始孪生属性“{”location“:{”region“:”USA“}}”,初始孪生标记“{”version“:”2“}”,以及设备信息“{”color“:”red“}”。

az iot dps enrollment update -g {resource_group_name} --dps-name {dps_name} --enrollment-id {enrollment_id} --initial-twin-properties "{'location':{'region':'USA'}}" --initial-twin-tags "{'version1':'2'}" --device-info "{'color':'red'}"

必需参数

--eid --enrollment-id

单个设备注册 ID。

可选参数

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

--allocation-policy --ap

分配策略的类型,用于确定如何将设备分配到 IoT 中心。 如果未提供,则分配策略将是设备预配服务实例的当前分配策略默认设置。

属性
Parameter group: Allocation Policy Arguments
接受的值: custom, geoLatency, hashed, static
--api-version --av

自定义分配请求中发送的预配服务类型的 API 版本。 支持的最低版本:2018-09-01-preview。

属性
Parameter group: Allocation Policy Arguments
--auth-type

指示操作是应自动派生策略密钥还是使用当前的 Azure AD 会话。 如果身份验证类型为登录,并且提供资源主机名,则除非需要,否则将跳过资源查找。可以使用 < a0/a0> 配置默认值 az configure --defaults iotdps-data-auth-type={auth-type-value}

属性
Parameter group: Access Control Arguments
默认值: key
接受的值: key, login
--certificate-path --cp

包含主证书的文件的路径。

属性
Parameter group: Authentication Arguments
--device-id -d

在 IoT 中心注册的设备 ID。

--device-information --info

可选设备信息。

--dps-name -n

Azure IoT 中心设备预配服务的名称或主机名。 如果未提供 --login,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--edge-enabled --ee

指示边缘启用的标志。

属性
接受的值: false, true
--ek --endorsement-key

TPM 设备的 TPM 认可密钥。

--etag -e

对应于资源最后状态的 Etag 或实体标记。 如果未提供 etag,则使用值“*”。

--ih --iot-hubs

与分配策略关联的目标 IoT 中心的主机名。 对多个 IoT 中心使用空格分隔的列表。

属性
Parameter group: Allocation Policy Arguments
--initial-twin-properties --props

初始设备孪生属性。

--initial-twin-tags --tags

初始设备孪生标记。

--login -l

此命令支持具有执行操作权限的实体连接字符串。 用于避免通过“az login”进行会话登录。 如果同时提供实体连接字符串和名称,则连接字符串优先。 如果未提供 --dps-name,则为必需。

属性
Parameter group: Device Provisioning Service Identifier Arguments
--pk --primary-key

以 base64 格式存储的主对称共享访问密钥。

属性
Parameter group: Authentication Arguments
--provisioning-status --ps

启用或禁用注册条目。

属性
接受的值: disabled, enabled
--rc --remove-certificate

用于删除当前主证书的标志。

属性
Parameter group: Authentication Arguments
接受的值: false, true
--remove-secondary-certificate --rsc

用于删除当前辅助证书的标志。

属性
Parameter group: Authentication Arguments
接受的值: false, true
--reprovision-policy --rp

用于确定在重新预配到其他 IoT 中心时应如何处理设备数据的策略。

属性
接受的值: never, reprovisionandmigratedata, reprovisionandresetdata
--resource-group -g

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

--scp --secondary-certificate-path

包含辅助证书的文件的路径。

属性
Parameter group: Authentication Arguments
--secondary-key --sk

以 base64 格式存储的辅助对称共享访问密钥。

属性
Parameter group: Authentication Arguments
--webhook-url --wh

用于自定义分配请求的 Azure Function Webhook URL。

属性
Parameter group: Allocation Policy Arguments
全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

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

Output format.

属性
默认值: 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