如何通过 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. 注册记录包含注册过程中设备所需的初始配置及所需的 IoT 中心。The enrollment record contains the initial desired configuration for the device(s) as part of that enrollment, including the desired IoT hub. 本文演示了如何针对预配服务管理设备注册。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:

  • “注册组”是共享 X.509 证书共同认证机制的一组设备,由同一个签名证书(可以是根证书,也可以是中间证书)签名,并用于在物理设备上生成设备证书。An Enrollment group is an entry for a group of devices that share a common attestation mechanism of X.509 certificates, signed by the same signing certificate, which can be the root certificate or the intermediate certificate, used to produce device certificate on physical device. 对于共享所需初始配置的大量设备,或者全部转到同一租户的设备,建议使用注册组。We recommend using an enrollment group for a large number of devices which share a desired initial configuration, or for devices all going to the same tenant. 请注意,只能注册使用 X.509 证明机制作为“注册组”的设备 。Note that you can only enroll devices that use the X.509 attestation mechanism as enrollment groups.

    执行以下步骤可在门户中为一组设备创建注册组。You can 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:
      a.a. 单击“管理注册”,然后选择“注册组”选项卡 。Click Manage enrollments, then select the Enrollment Groups tab.
      b.b. 单击顶部的“添加”按钮 。Click the Add button at the top.
      c.c. 当“添加注册组”面板出现时,输入注册列表项的信息。When the "Add Enrollment Group" panel appears, enter the information for the enrollment list entry. 组名是必需的。Group name is required. 另外,对于“证书类型”,请选择“CA 证书”或“中间证书”,并为设备组上传根主证书Also select "CA or Intermediate" for Certificate type, and upload the root Primary certificate for the group of devices.
      d.d. 单击“保存” 。Click Save. 注册组创建成功后,应可在“注册组”选项卡下看到组名称 。On successful creation of your enrollment group, you should see the group name appear under the Enrollment Groups tab.

      门户中的注册组Enrollment group in the portal

  • 单独注册是用于单个设备注册的条目 。An Individual enrollment is an entry for a single device that may register. 个人注册可使用 x509 证书或 SAS 令牌(来自物理或虚拟 TPM)作为证明机制。Individual enrollments may use either x509 certificates or SAS tokens (from a physical or virtual TPM) as attestation mechanisms. 对于需要唯一初始配置的设备或仅能通过 TPM 或虚拟 TPM 使用 SAS 令牌作为证明机制的设备,建议使用单独注册。We recommend using individual enrollments for devices which require unique initial configurations, or for devices which can only use SAS tokens via TPM or virtual TPM as the attestation mechanism. 单独注册可能会指定所需 IoT 中心设备 ID。Individual enrollments may have the desired IoT hub device ID specified.

    可通过以下步骤在门户中创建单独注册。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:
      a.a. 单击“管理注册”,然后选择“个人注册”选项卡。 Click Manage enrollments, then select the Individual Enrollments tab.
      b.b. 单击顶部的“添加”按钮 。Click the Add button at the top.
      c.c. 当“添加注册”面板出现时,输入注册列表项的信息。When the "Add Enrollment" panel appears, enter the information for the enrollment list entry. 首先为设备选择证明机制(X.509 或 TPM)。First select the attestation Mechanism for the device (X.509 or TPM). X.509 证明要求为设备上传叶主证书X.509 attestation requires you to upload the leaf Primary certificate for the device. TPM 要求为设备输入证明密钥注册 IDTPM requires you to enter the Attestation Key and Registration ID for the device.
      d.d. 单击“保存” 。Click Save. 注册组创建成功后,应可在“单独注册”选项卡下看到设备 。On successful creation of your enrollment group, you should see your device appear under the Individual Enrollments tab.

      门户中的个人注册Individual enrollment in the portal

更新注册条目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, as well as 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 will see your entry removed from the list of device enrollments.

    在门户中删除注册