如何通过 Azure 门户管理设备注册How to manage device enrollments with Azure portal

“设备注册”将创建单台设备或一组设备在某一时刻向 Azure IoT 中心设备预配服务进行注册的记录 。A device enrollment creates a record of a single device or a group of devices that may at some point register with the Azure IoT Hub Device Provisioning Service. 注册记录包含注册过程中设备的初始配置。The enrollment record contains the initial configuration for the device(s) as part of that enrollment. 此配置中包含的是 IoT 中心和分配策略,前者是设备分配到的地方,后者可从一组中心中配置该中心。Included in the configuration is the IoT hub a device will be assigned to or an allocation policy that configures the hub from a set of hubs. 本文演示了如何针对预配服务管理设备注册。This article shows you how to manage device enrollments for your provisioning service.

创建设备注册Create a device enrollment

可通过两种方法向预配服务注册设备:There are two ways you can enroll your devices with the provisioning service:

  • 注册组是共享常见证明机制的一组设备的条目。An Enrollment group is an entry for a group of devices that share a common attestation mechanism. 建议对共享初始配置的大量设备,或者全部转到同一租户的设备使用注册组。We recommend using an enrollment group for a large number of devices that share an initial configuration, or for devices all going to the same tenant. 支持使用对称密钥X.509 证书的设备。Devices using symmetric key or X.509 certificates are supported.

    有关使用对称密钥创建和使用注册组的分步说明,请参阅使用对称密钥预配设备教程。For step-by-step instructions on creating and using enrollment groups with symmetric keys, see the Provision devices with symmetric keys tutorial.

    执行以下步骤在门户中为一组设备创建注册组:You create an enrollment group in the portal for a group of devices using the following steps:

    1. 登录 Azure 门户,单击左侧菜单中的“所有资源”。Log in to the Azure portal and click All resources from the left-hand menu.

    2. 从资源列表中单击要向其注册设备的设备预配服务。Click the Device Provisioning service you want to enroll your device to from the list of resources.

    3. 在预配服务中,单击“管理注册”,然后单击顶部的“添加注册组”按钮 。In your provisioning service, click Manage enrollments, then Click the Add enrollment group button at the top.

      门户中的注册组

    4. 当“添加注册组”面板出现时,输入注册信息,然后单击“保存”。When the "Add Enrollment Group" panel appears, enter the information for your enrollment and click Save.

      使用门户添加注册组Add an enrollment group with the portal

      字段Field 描述Description
      组名Group name 设备组所需的名称。Required name for your group of devices.
      证明类型Attestation Type 单击“证书”或“对称密钥”作为证明类型,具体取决于设备将使用的证明方法 。Click Certificate or Symmetric Key for the attestation type depending on the attestation method your devices will use.
      证书类型Certificate Type 如果使用证书证明,则可用。Available if you're using certificate attestation. 根据签署设备证书的证书选择“CA 证书”或“中间” 。select CA Certificate or Intermediate based on what certificate signed your device certificates.
      主要证书Primary Certificate 如果要使用根 CA 证书对设备证书进行签名,则该根 CA 证书必须完成所有权证明If you're signing your device certificates with a root CA certificate, that root CA certificate must have proof of possession completed. 然后,可以将其选择为设备组的主要证书。Then you can select it as the Primary certificate for the group of devices.

      如果要使用中间证书对设备证书进行签名,则可以使用上传按钮来上传中间证书。If you're signing your device certificates with an intermediate certificate, an upload button will be available to allow you to upload your intermediate certificate. 签署中间的证书还必须为其完成所有权证明The certificate that signed the intermediate must also have proof of possession completed for it.
  • 单独注册是可分配给 IoT 中心的单个设备的条目。An Individual enrollment is an entry for a single device that may be assigned to an IoT hub. 支持使用对称密钥X.509 证书TPM 证明的设备。Devices using symmetric key, X.509 certificates, and TPM attestation are supported.

    可通过以下步骤在门户中创建单独注册。You can create an individual enrollment in the portal using the following steps:

    1. 登录 Azure 门户,单击左侧菜单中的“所有资源”。Log in to the Azure portal and click All resources from the left-hand menu.

    2. 从资源列表中单击要向其注册设备的设备预配服务。Click the Device Provisioning service you want to enroll your device to from the list of resources.

    3. 在预配服务中,单击“管理注册”,然后单击顶部的“添加单独注册”按钮 。In your provisioning service, click Manage enrollments, then click the Add individual enrollment button at the top.

      在门户中添加单独注册Add an individual enrollment in the portal

    4. 当“添加注册”面板出现时,输入单个设备注册的信息,然后单击“保存”。When the "Add Enrollment" panel appears, enter the information for the individual device enrollment and click Save.

      门户中的单独注册Individual enrollment in the portal

      字段Field 描述Description
      机制Mechanism 选择“X.509”、“TPM”或“对称密钥”作为要使用的证明机制,具体取决于设备将使用的证明方法 。Select X.509, TPM, or Symmetric Key for the attestation mechanism to use depending on the attestation method your devices will use.
      证明设置Attestation settings 有关使用对称密钥或 X.509 证书创建和使用单独注册的分步说明,请参阅预配对称密钥预配 x.509 证书设备快速入门之一。For step-by-step instructions on creating and using individual enrollments with symmetric keys or X.509 certificates, see one of the Provision a symmetric device or Provision a X.509 certificate device quickstarts.

      有关使用 TPM 证明创建和使用单独注册的分步说明,请参阅预配模拟的 TPM 设备示例。For step-by-step instructions on creating and using individual enrollments using TPM attestation, see one of the Provision a simulated TPM device samples.
      IoT 中心设备 IDIoT Hub Device ID 此 ID 代表你的设备。This ID will represent your device. 它必须遵循设备 ID 的规则。It must follow the rules for a device ID. 有关详细信息,请参阅设备标识属性For more information, see Device identity properties.

      使用 X.509 证书时,此文本必须是你为注册上传的设备证书上的使用者名称。When using X.509 certificates, this text must be the subject name on the device certificate you upload for the enrollment. 使用者名称必须符合设备 ID 规则。That subject name must conform to the rules for a device ID.

更新注册条目Update an enrollment entry

可通过以下步骤在门户中更新现有注册条目。You can update an existing enrollment entry in the portal using the following steps:

  1. 在 Azure 门户中打开设备预配服务,然后单击“管理注册”。Open your Device Provisioning service in the Azure portal and click Manage Enrollments.

  2. 导航到要修改的注册条目。Navigate to the enrollment entry you want to modify. 单击该条目会打开设备注册的摘要信息。Click the entry, which opens a summary information about your device enrollment.

  3. 在此页上,可以修改安全类型和凭据以外的项,例如设备应链接到的 IoT 中心和设备 ID。On this page, you can modify items other than the security type and credentials, such as the IoT hub the device should be linked to, and the device ID. 还可以修改初始的设备孪生状态。You may also modify the initial device twin state.

  4. 完成后,单击“保存”更新设备注册。Once completed, click Save to update your device enrollment.

    在门户中更新注册

删除设备注册Remove a device enrollment

如果不需要将设备预配到任何 IoT 中心,可以通过以下步骤删除门户中的相关注册条目。In cases where your device(s) do not need to be provisioned to any IoT hub, you can remove the related enrollment entry in the portal using the following steps:

  1. 在 Azure 门户中打开设备预配服务,然后单击“管理注册”。Open your Device Provisioning service in the Azure portal and click Manage Enrollments.

  2. 导航到要删除的注册条目并选中。Navigate to and select the enrollment entry you want to remove.

  3. 单击顶部的“删除”按钮,然后在出现确认提示时选择“是”。Click the Delete button at the top and then select Yes when prompted to confirm.

  4. 完成操作后,会看到条目已从设备注册列表中删除。Once the action is completed, you'll see your entry removed from the list of device enrollments.

    在门户中删除注册