You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article provides end-to-end instructions for autoprovisioning one or more Linux IoT Edge devices using X.509 certificates. You can automatically provision Azure IoT Edge devices with the [Azure IoT Hub device provisioning service](../iot-dps/index.yml) (DPS). If you're unfamiliar with the process of autoprovisioning, review the [provisioning overview](../iot-dps/about-iot-dps.md#provisioning-process) before continuing.
18
+
This article gives step-by-step instructions for autoprovisioning one or more Linux IoT Edge devices using X.509 certificates. Automatically provision Azure IoT Edge devices with the [Azure IoT Hub device provisioning service](../iot-dps/index.yml) (DPS). If you aren't familiar with autoprovisioning, review the [provisioning overview](../iot-dps/about-iot-dps.md#provisioning-process) before you continue.
19
19
20
-
The tasks are as follows:
20
+
Here are the steps to provision IoT Edge devices using X.509 certificates:
21
21
22
22
1. Generate certificates and keys.
23
-
1. Create either an **individual enrollment** for a single device or a **group enrollment** for a set of devices.
23
+
1. Create an **individual enrollment** for a single device or a **group enrollment** for a set of devices.
24
24
1. Install the IoT Edge runtime and register the device with IoT Hub.
25
25
26
-
Using X.509 certificates as an attestation mechanism is an excellent way to scale production and simplify device provisioning. Typically, X.509 certificates are arranged in a certificate chain of trust. Starting with a self-signed or trusted root certificate, each certificate in the chain signs the next lower certificate. This pattern creates a delegated chain of trust from the root certificate down through each intermediate certificate to the final downstream device certificate installed on a device.
26
+
X.509 certificates let you scale production and simplify device provisioning. Typically, X.509 certificates are arranged in a certificate chain of trust. The chain starts with a self-signed or trusted root certificate, and each certificate in the chain signs the next lower certificate. This pattern creates a delegated chain of trust from the root certificate through each intermediate certificate to the final downstream device certificate installed on a device.
27
27
28
28
> [!TIP]
29
-
> If your device has a Hardware Security Module (HSM) such as a TPM 2.0, then we recommend storing the X.509 keys securely in the HSM. Learn more about how to implement the zero-touch provisioning at scale described in [this blueprint](https://azure.microsoft.com/blog/the-blueprint-to-securely-solve-the-elusive-zerotouch-provisioning-of-iot-devices-at-scale) with the [iotedge-tpm2cloud](https://aka.ms/iotedge-tpm2cloud) sample.
29
+
> If your device has a Hardware Security Module (HSM) like a TPM 2.0, store the X.509 keys securely in the HSM. Learn how to implement zero-touch provisioning at scale in [this blueprint](https://azure.microsoft.com/blog/the-blueprint-to-securely-solve-the-elusive-zerotouch-provisioning-of-iot-devices-at-scale) with the [iotedge-tpm2cloud](https://aka.ms/iotedge-tpm2cloud) sample.
30
30
31
31
## Prerequisites
32
32
@@ -35,32 +35,32 @@ Using X.509 certificates as an attestation mechanism is an excellent way to scal
35
35
36
36
### Device requirements
37
37
38
-
A physical or virtual Linux device to be the IoT Edge device.
38
+
Use a physical or virtual Linux device as the IoT Edge device.
39
39
40
40
## Generate device identity certificates
41
41
42
42
The device identity certificate is a downstream device certificate that connects through a certificate chain of trust to the top X.509 certificate authority (CA) certificate. The device identity certificate must have its common name (CN) set to the device ID that you want the device to have in your IoT hub.
43
43
44
-
Device identity certificates are only used for provisioning the IoT Edge device and authenticating the device with Azure IoT Hub. They aren't signing certificates, unlike the CA certificates that the IoT Edge device presents to modules or downstream devices for verification. For more information, see [Azure IoT Edge certificate usage detail](iot-edge-certs.md).
44
+
Device identity certificates are only used for provisioning the IoT Edge device and authenticating the device with Azure IoT Hub. These certificates aren't signing certificates. CA certificates that the IoT Edge device presents to modules or downstream devices are used for verification. For more information, see [Azure IoT Edge certificate usage detail](iot-edge-certs.md).
45
45
46
-
After you create the device identity certificate, you should have two files: a .cer or .pem file that contains the public portion of the certificate, and a .cer or .pem file with the private key of the certificate. If you plan to use group enrollment in DPS, you also need the public portion of an intermediate or root CA certificate in the same certificate chain of trust.
46
+
After you create the device identity certificate, you have two files: a `.cer` or `.pem` file with the public portion of the certificate, and a `.cer` or `.pem` file with the private key. If you use group enrollment in DPS, you also need the public portion of an intermediate or root CA certificate in the same certificate chain of trust.
47
47
48
-
You need the following files to set up automatic provisioning with X.509:
48
+
You need these files to set up automatic provisioning with X.509:
49
49
50
50
* The device identity certificate and its private key certificate. The device identity certificate is uploaded to DPS if you create an individual enrollment. The private key is passed to the IoT Edge runtime.
51
-
* A full chain certificate, which should have at least the device identity and the intermediate certificates in it. The full chain certificate is passed to the IoT Edge runtime.
51
+
* A full chain certificate with at least the device identity and the intermediate certificates. The full chain certificate is passed to the IoT Edge runtime.
52
52
* An intermediate or root CA certificate from the certificate chain of trust. This certificate is uploaded to DPS if you create a group enrollment.
53
53
54
54
### Use test certificates (optional)
55
55
56
-
If you don't have a certificate authority available to create new identity certs and want to try out this scenario, the Azure IoT Edge git repository contains scripts that you can use to generate test certificates. These certificates are designed for development testing only, and must not be used in production.
56
+
If you don't have a certificate authority to create new identity certificates and want to try this scenario, use the scripts in the Azure IoT Edge git repository to generate test certificates. Use these certificates for development testing only. Don't use them in production.
57
57
58
-
To create test certificates, follow the steps in [Create demo certificates to test IoT Edge device features](how-to-create-test-certificates.md). Complete the two required sections to set up the certificate generation scripts and to create a root CA certificate. Then, follow the steps to create a device identity certificate. When you're finished, you should have the following certificate chain and key pair:
58
+
To create test certificates, follow the steps in [Create demo certificates to test IoT Edge device features](how-to-create-test-certificates.md). Complete the two required sections to set up the certificate generation scripts and create a root CA certificate. Then, follow the steps to create a device identity certificate. When you finish, you have the following certificate chain and key pair:
You need both these certificates on the IoT Edge device. If you're going to use individual enrollment in DPS, then you upload the .cert.pem file. If you're going to use group enrollment in DPS, then you also need an intermediate or root CA certificate in the same certificate chain of trust to upload. If you're using demo certs, use the `<WRKDIR>/certs/azure-iot-test-only.root.ca.cert.pem` certificate for group enrollment.
63
+
You need both certificates on the IoT Edge device. If youuse individual enrollment in DPS, upload the `.cert.pem` file. If youuse group enrollment in DPS, also upload an intermediate or root CA certificate in the same certificate chain of trust. If you use demo certificates, use the `<WRKDIR>/certs/azure-iot-test-only.root.ca.cert.pem` certificate for group enrollment.
64
64
65
65
<!-- Create a DPS enrollment using X.509 certificates H2 and content -->
@@ -70,29 +70,29 @@ You need both these certificates on the IoT Edge device. If you're going to use
70
70
71
71
## Provision the device with its cloud identity
72
72
73
-
Once the runtime is installed on your device, configure the device with the information it uses to connect to the device provisioning service and IoT Hub.
73
+
After you install the runtime on your device, set up the device with the information it uses to connect to the device provisioning service and IoT Hub.
74
74
75
-
Have the following information ready:
75
+
Make sure you have the following information:
76
76
77
-
* The DPS **ID Scope** value. You can retrieve this value from the overview page of your DPS instance in the Azure portal.
77
+
* The DPS **ID Scope** value. Get this value from the overview page of your DPS instance in the Azure portal.
78
78
* The device identity certificate chain file on the device.
79
79
* The device identity key file on the device.
80
80
81
-
Create a configuration file for your device based on a template file that is provided as part of the IoT Edge installation.
81
+
Create a configuration file for your device based on the template file that's included with the IoT Edge installation.
Open the configuration file on the IoT Edge device.
89
+
Open the configuration file on your IoT Edge device.
90
90
91
91
```bash
92
92
sudo nano /etc/aziot/config.toml
93
93
```
94
94
95
-
Find the **Provisioning** section of the file. Uncomment the lines for DPS provisioning with X.509 certificate, and make sure any other provisioning lines are commented out.
95
+
Find the **Provisioning** section of the file. Uncomment the lines for DPS provisioning with X.509 certificate, and make sure all other provisioning lines are commented out.
96
96
97
97
```toml
98
98
# DPS provisioning with X.509 certificate
@@ -116,19 +116,19 @@ identity_pk = "DEVICE_IDENTITY_PRIVATE_KEY_HERE" # For example, "file:///var/a
116
116
117
117
# [Ubuntu Core snaps](#tab/snaps)
118
118
119
-
If using a snap installation of IoT Edge, the template file is located at `/snap/azure-iot-edge/current/etc/aziot/config.toml.edge.template`. Create a copy of the template file in your home directory and name it config.toml. For example:
119
+
If you use a snap installation of IoT Edge, the template file is at `/snap/azure-iot-edge/current/etc/aziot/config.toml.edge.template`. Copy the template file to your home directory and name it `config.toml`. For example:
Open the configuration file in your home directory on the IoT Edge device.
125
+
Open the configuration file in your home directory on your IoT Edge device.
126
126
127
127
```bash
128
128
nano ~/config.toml
129
129
```
130
130
131
-
Find the **Provisioning** section of the file. Uncomment the lines for DPS provisioning with X.509 certificate, and make sure any other provisioning lines are commented out. The path used for the certificate files should be the path to the shared directory accessible to both *azure-iot-edge* and *azure-iot-identity* snaps. For example, `/var/snap/azure-iot-identity/current/shared/`.
131
+
Find the **Provisioning** section of the file. Uncomment the lines for DPS provisioning with X.509 certificate, and make sure any other provisioning lines are commented out. Use the path to the shared directory that's accessible to both *azure-iot-edge* and *azure-iot-identity* snaps for the certificate files. For example, `/var/snap/azure-iot-identity/current/shared/`.
132
132
133
133
```toml
134
134
# DPS provisioning with X.509 certificate
@@ -153,29 +153,29 @@ identity_pk = "DEVICE_IDENTITY_PRIVATE_KEY_HERE" # For example, "file:///var/s
153
153
154
154
---
155
155
156
-
1. Update the value of `id_scope` with the scope ID you copied from your instance of DPS.
156
+
1. Update the value of `id_scope` with the scope ID you copied from your DPS instance.
157
157
158
-
1.Provide a `registration_id` for the device, which is the ID that the device has in IoT Hub. The registration ID must match the common name (CN) of the identity certificate.
158
+
1.Enter a `registration_id` for the device, which is the ID the device has in IoT Hub. The registration ID must match the common name (CN) of the identity certificate.
159
159
160
160
1. Update the values of `identity_cert` and `identity_pk` with your certificate and key information.
161
161
162
-
The identity certificate value can be provided as a file URI, or can be dynamically issued using EST or a local certificate authority. Uncomment only one line, based on the format you choose to use.
162
+
You can provide the identity certificate value as a file URI, or it can be dynamically issued using EST or a local certificate authority. Uncomment only one line, based on the format you use.
163
163
164
-
The identity private key value can be provided as a file URI or a PKCS#11 URI. Uncomment only one line, based on the format you choose to use.
164
+
You can provide the identity private key value as a file URI or a PKCS#11 URI. Uncomment only one line, based on the format you use.
165
165
166
-
If you use any PKCS#11 URIs, find the **PKCS#11** section in the config file and provide information about your PKCS#11 configuration.
166
+
If you use any PKCS#11 URIs, find the **PKCS#11** section in the config file and enter your PKCS#11 configuration information.
167
167
168
168
For more information about certificates, see [Manage IoT Edge certificates](how-to-manage-device-certificates.md).
169
169
170
170
For more information about provisioning configuration settings, see [Configure IoT Edge device settings](configure-device.md#provisioning).
171
171
172
-
1. Optionally, find the auto reprovisioning mode section of the file. Use the `auto_reprovisioning_mode` parameter to configure your device's reprovisioning behavior. **Dynamic** - Reprovision when the device detects that it may have been moved from one IoT Hub to another. This is the default. **AlwaysOnStartup** - Reprovision when the device is rebooted or a crash causes the daemons to restart. **OnErrorOnly** - Never trigger device reprovisioning automatically. Each mode has an implicit device reprovisioning fallback if the device is unable to connect to IoT Hub during identity provisioning due to connectivity errors. For more information, see [IoT Hub device reprovisioning concepts](../iot-dps/concepts-device-reprovision.md).
172
+
1. Optionally, find the auto reprovisioning mode section of the file. Use the `auto_reprovisioning_mode` parameter to configure your device's reprovisioning behavior. **Dynamic** - Reprovision when the device detects that it can have been moved from one IoT Hub to another. This is the default. **AlwaysOnStartup** - Reprovision when the device is rebooted or a crash causes the daemons to restart. **OnErrorOnly** - Never trigger device reprovisioning automatically. Each mode has an implicit device reprovisioning fallback if the device can't connect to IoT Hub during identity provisioning because of connectivity errors. For more information, see [IoT Hub device reprovisioning concepts](../iot-dps/concepts-device-reprovision.md).
173
173
174
-
1. Optionally, uncomment the `payload` parameter to specify the path to a local JSON file. The contents of the file is[sent to DPS as additional data](../iot-dps/how-to-send-additional-data.md#iot-edge-support) when the device registers. This is useful for [custom allocation](../iot-dps/how-to-use-custom-allocation-policies.md). For example, if you want to allocate your devices based on an IoT Plug and Play model ID without human intervention.
174
+
1. Optionally, uncomment the `payload` parameter to specify the path to a local JSON file. The contents of the file are[sent to DPS as additional data](../iot-dps/how-to-send-additional-data.md#iot-edge-support) when the device registers. This is useful for [custom allocation](../iot-dps/how-to-use-custom-allocation-policies.md). For example, if you want to allocate your devices based on an IoT Plug and Play model ID without human intervention.
175
175
176
176
1. Save and close the file.
177
177
178
-
Apply the configuration changes that you made to IoT Edge.
178
+
Apply the configuration changes you made to IoT Edge.
You can verify that the individual enrollment that you created in device provisioning service was used. Navigate to your device provisioning service instance in the Azure portal. Open the enrollment details for the individual enrollment that you created. Notice that the status of the enrollment is **assigned** and the device ID is listed.
199
+
Check that the individual enrollment you created in device provisioning service is used. Go to your device provisioning service instance in the Azure portal. Open the enrollment details for the individual enrollment you created. The status of the enrollment is **assigned**, and the device ID is listed.
200
200
201
201
# [Group enrollment](#tab/group-enrollment)
202
202
203
-
You can verify that the group enrollment that you created in device provisioning service was used. Navigate to your device provisioning service instance in the Azure portal. Open the enrollment details for the group enrollment that you created. Go to the **Registration Records** tab to view all devices registered in that group.
203
+
Check that the group enrollment you created in device provisioning service is used. Go to your device provisioning service instance in the Azure portal. Open the enrollment details for the group enrollment you created. Go to the **Registration Records** tab to view all devices registered in that group.
204
204
205
205
---
206
206
207
-
Use the following commands on your device to verify that the IoT Edge installed and started successfully.
207
+
Run these commands on your device to check that IoT Edge is installed and running.
208
208
209
209
Check the status of the IoT Edge service.
210
210
211
211
```cmd/sh
212
212
sudo iotedge system status
213
213
```
214
214
215
-
Examine service logs.
215
+
View service logs.
216
216
217
217
```cmd/sh
218
218
sudo iotedge system logs
@@ -226,4 +226,4 @@ sudo iotedge list
226
226
227
227
## Next steps
228
228
229
-
The device provisioning service enrollment process lets you set the device ID and device twin tags at the same time as you provision the new device. You can use those values to target individual devices or groups of devices using automatic device management. Learn how to [Deploy and monitor IoT Edge modules at scale using the Azure portal](how-to-deploy-at-scale.md) or [using Azure CLI](how-to-deploy-cli-at-scale.md).
229
+
The device provisioning service enrollment process lets you set the device ID and device twin tags when you provision a new device. Use these values to target individual devices or groups of devices with automatic device management. Learn how to [deploy and monitor IoT Edge modules at scale using the Azure portal](how-to-deploy-at-scale.md) or [using Azure CLI](how-to-deploy-cli-at-scale.md).
0 commit comments