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
IoT Edge devices require certificates for secure communication between the runtime, the modules, and any downstream devices.
18
-
If you don't have a certificate authority to create the required certificates, you can use demo certificates to try out IoT Edge features in your test environment.
19
-
This article describes the functionality of the certificate generation scripts that IoT Edge provides for testing.
17
+
IoT Edge devices need certificates for secure communication between the runtime, the modules, and any downstream devices.
18
+
If you don't have a certificate authority to create the required certificates, use demo certificates to try out IoT Edge features in your test environment.
19
+
This article explains the certificate generation scripts that IoT Edge provides for testing.
20
20
21
21
> [!WARNING]
22
-
> These certificates expire in 30 days, and should not be used in any production scenario.
22
+
> These certificates expire in 30 days, and you shouldn't use them in any production scenario.
23
23
24
-
You can create certificates on any machine and then copy them over to your IoT Edge device, or generate the certificates directly on the IoT Edge device.
24
+
Create certificates on any machine and then copy them to your IoT Edge device, or generate the certificates directly on the IoT Edge device.
25
25
26
26
## Prerequisites
27
27
28
-
A development machine with Git installed.
28
+
Use a development machine that has Git installed.
29
29
30
30
## Download test certificate scripts and set up working directory
31
31
@@ -34,18 +34,18 @@ This section provides instructions for preparing the scripts to run on your comp
34
34
35
35
# [Windows](#tab/windows)
36
36
37
-
To create demo certificates on a Windows device, you need to install OpenSSL and then clone the generation scripts and set them up to run locally in PowerShell.
37
+
To create demo certificates on a Windows device, install OpenSSL, then clone the generation scripts and set them up to run locally in PowerShell.
38
38
39
39
#### Install OpenSSL
40
40
41
-
Install OpenSSL for Windows on the machine that you're using to generate the certificates.
42
-
If you already have OpenSSL installed on your Windows device, ensure that openssl.exe is available in your PATH environment variable.
41
+
Install OpenSSL for Windows on the device you use to generate the certificates.
42
+
If OpenSSL is already installed, make sure that openssl.exe is available in your PATH environment variable.
43
43
44
-
There are several ways to install OpenSSL, including the following options:
44
+
You can install OpenSSL in different ways:
45
45
46
46
***Easier:** Download and install any [third-party OpenSSL binaries](https://wiki.openssl.org/index.php/Binaries), for example, from [OpenSSL on SourceForge](https://sourceforge.net/projects/openssl/). Add the full path to openssl.exe to your PATH environment variable.
47
47
48
-
***Recommended:** Download the OpenSSL source code and build the binaries on your machine by yourself or via[vcpkg](https://github.com/Microsoft/vcpkg). The instructions listed below use vcpkg to download source code, compile, and install OpenSSL on your Windows machine with easy steps.
48
+
***Recommended:** Download the OpenSSL source code and build the binaries on your device, or use[vcpkg](https://github.com/Microsoft/vcpkg). The following instructions use vcpkg to download source code, compile, and install OpenSSL on your Windows device.
49
49
50
50
1. Navigate to a directory where you want to install vcpkg. Follow the instructions to download and install [vcpkg](https://github.com/Microsoft/vcpkg).
51
51
@@ -60,17 +60,16 @@ There are several ways to install OpenSSL, including the following options:
60
60
#### Prepare scripts in PowerShell
61
61
62
62
The Azure IoT Edge git repository contains scripts that you can use to generate test certificates.
63
-
In this section, you clone the IoT Edge repo and execute the scripts.
63
+
In this section, you clone the IoT Edge repository and execute the scripts.
64
64
65
-
1. Open a PowerShell window in administrator mode.
66
-
67
-
2. Clone the IoT Edge git repo, which contains scripts to generate demo certificates. Use the `git clone` command or [download the ZIP](https://github.com/Azure/iotedge/archive/master.zip).
65
+
1. Open PowerShell in administrator mode.
66
+
2. Clone the IoT Edge git repository, which has scripts to generate demo certificates. Use the `git clone` command or [download the ZIP](https://github.com/Azure/iotedge/archive/master.zip).
68
67
69
68
```powershell
70
69
git clone https://github.com/Azure/iotedge.git
71
70
```
72
71
73
-
2. Create a directory in which you want to work and copy the certificate scripts there. All certificate and key files will be created in this directory.
72
+
3. Create a directory and copy the certificate scripts there. All certificate and key files are created in this directory.
74
73
75
74
```powershell
76
75
mkdir wrkdir
@@ -79,24 +78,25 @@ In this section, you clone the IoT Edge repo and execute the scripts.
79
78
cp ..\iotedge\tools\CACertificates\ca-certs.ps1 .
80
79
```
81
80
82
-
If you downloaded the repo as a ZIP, then the folder name is `iotedge-master` and the rest of the path is the same.
81
+
If you downloaded the repository as a ZIP, the folder name is `iotedge-master` and the rest of the path is the same.
83
82
84
-
3.Enable PowerShell to run the scripts.
83
+
3.Set the PowerShell execution policy to run the scripts.
4.Bring the functions used by the scripts into PowerShell's global namespace.
89
+
4.Import the functions used by the scripts into PowerShell's global namespace.
91
90
92
91
```powershell
93
92
. .\ca-certs.ps1
94
93
```
95
94
96
-
The PowerShell window will display a warning that the certificates generated by this script are only for testing purposes, and should not be used in production scenarios.
95
+
The PowerShell window shows a warning that the certificates generated by this script are only for testing, and shouldn't be used in production scenarios.
97
96
98
97
5. Verify that OpenSSL has been installed correctly and make sure that there won't be name collisions with existing certificates. If there are problems, the script output should describe how to fix them on your system.
99
98
99
+
100
100
```powershell
101
101
Test-CACertsPrerequisites
102
102
```
@@ -105,13 +105,13 @@ In this section, you clone the IoT Edge repo and execute the scripts.
105
105
106
106
To create demo certificates on a Linux device, you need to clone the generation scripts and set them up to run locally in bash.
107
107
108
-
1. Clone the IoT Edge git repo, which contains scripts to generate demo certificates.
108
+
1. Clone the IoT Edge git repository, which contains scripts to generate demo certificates.
109
109
110
110
```bash
111
111
git clone https://github.com/Azure/iotedge.git
112
112
```
113
113
114
-
2. Create a directory in which you want to work and copy the certificate scripts there. All certificate and key files will be created in this directory.
114
+
2. Create a directory and copy the certificate scripts there. All certificate and key files are created in this directory.
115
115
116
116
```bash
117
117
mkdir wrkdir
@@ -120,58 +120,47 @@ To create demo certificates on a Linux device, you need to clone the generation
120
120
cp ../iotedge/tools/CACertificates/certGen.sh .
121
121
```
122
122
123
-
<!--
124
-
4. Configure OpenSSL to generate certificates using the provided script.
125
-
126
-
```bash
127
-
chmod 700 certGen.sh
128
-
```
129
-
-->
130
-
131
123
---
132
124
133
125
## Create root CA certificate
134
126
135
-
Run this script to generate a root CA that is required for each step in this article.
127
+
Run this script to generate a root CA certificate. You need this certificate for each step in this article.
136
128
137
-
The root CA certificate is used to make all the other demo certificates for testing an IoT Edge scenario.
138
-
You can keep using the same root CA certificate to make demo certificates for multiple IoT Edge or downstream devices.
129
+
Use the root CA certificate to create other demo certificates for testing an IoT Edge scenario. You can use the same root CA certificate to create demo certificates for multiple IoT Edge or downstream devices.
139
130
140
-
If you already have one root CA certificate in your working folder, don't create a new one.
141
-
The new root CA certificate will overwrite the old, and any downstream certificates made from the old one will stop working.
142
-
If you want multiple root CA certificates, be sure to manage them in separate folders.
131
+
If you already have a root CA certificate in your working folder, don't create a new one. Creating a new root CA certificate overwrites the old one, and any downstream certificates created from the old certificate stop working. If you need multiple root CA certificates, manage them in separate folders.
143
132
144
133
# [Windows](#tab/windows)
145
134
146
-
1.Navigate to the working directory `wrkdir` where you placed the certificate generation scripts.
135
+
1.Go to the working directory `wrkdir` where you put the certificate generation scripts.
147
136
148
-
1. Create the root CA certificate and have it sign one intermediate certificate. The certificates are all placed in your working directory.
137
+
1. Create the root CA certificate and sign one intermediate certificate. The certificates are placed in your working directory.
149
138
150
139
```powershell
151
140
New-CACertsCertChain rsa
152
141
```
153
142
154
-
This script command creates several certificate and key files, but when articles ask for the **root CA certificate**, use the following file:
143
+
This script creates several certificate and key files. When articles ask for the **root CA certificate**, use this file:
155
144
156
145
`certs\azure-iot-test-only.root.ca.cert.pem`
157
146
158
147
# [Linux](#tab/linux)
159
148
160
-
1.Navigate to the working directory `wrkdir` where you placed the certificate generation scripts.
149
+
1.Go to the working directory `wrkdir` where you put the certificate generation scripts.
161
150
162
151
1. Create the root CA certificate and one intermediate certificate.
163
152
164
153
```bash
165
154
./certGen.sh create_root_and_intermediate
166
155
```
167
156
168
-
This script command creates several certificate and key files, but when articles ask for the **root CA certificate**, use the following file:
157
+
This script creates several certificate and key files. When articles ask for the **root CA certificate**, use this file:
169
158
170
-
`certs/azure-iot-test-only.root.ca.cert.pem`
159
+
`certs/azure-iot-test-only.root.ca.cert.pem`
171
160
172
161
---
173
162
174
-
This certificate is required before you can create more certificates for your IoT Edge devices and downstream devices as described in the next sections.
163
+
You need this certificate before you create more certificates for your IoT Edge devices and downstream devices, as described in the next sections.
175
164
176
165
## Create identity certificate for the IoT Edge device
177
166
@@ -183,15 +172,15 @@ Device identity certificates go in the **Provisioning** section of the config fi
183
172
184
173
# [Windows](#tab/windows)
185
174
186
-
1.Navigate to the working directory `wrkdir` that has the certificate generation scripts and root CA certificate.
175
+
1.Go to the working directory `wrkdir` that has the certificate generation scripts and root CA certificate.
187
176
188
177
1. Create the IoT Edge device identity certificate and private key with the following command:
189
178
190
179
```powershell
191
180
New-CACertsEdgeDeviceIdentity "<device-id>"
192
181
```
193
182
194
-
The name that you pass in to this command is the device ID for the IoT Edge device in IoT Hub.
183
+
The name you enter for this command is the device ID for the IoT Edge device in IoT Hub.
195
184
196
185
1. The new device identity command creates several certificate and key files:
197
186
@@ -225,21 +214,21 @@ Device identity certificates go in the **Provisioning** section of the config fi
225
214
226
215
## Create Edge CA certificates
227
216
228
-
These certificates are required for **gateway scenarios** because the Edge CA certificate is how the IoT Edge device verifies its identity to downstream devices. You can skip this section if you're not connecting any downstream devices to IoT Edge.
217
+
You need these certificates for **gateway scenarios** because the Edge CA certificate lets the IoT Edge device verify its identity to downstream devices. Skip this section if you aren't connecting any downstream devices to IoT Edge.
229
218
230
-
The **Edge CA** certificate is also responsible for creating certificates for modules running on the device, but IoT Edge runtime can create temporary certificates if Edge CA isn't configured. Edge CA certificates go in the **Edge CA** section of the `config.toml` file on the IoT Edge device. To learn more, see [Understand how Azure IoT Edge uses certificates](iot-edge-certs.md).
219
+
The **Edge CA** certificate also creates certificates for modules running on the device, but the IoT Edge runtime can create temporary certificates if Edge CA isn't set up. Place Edge CA certificates in the **Edge CA** section of the `config.toml` file on the IoT Edge device. To learn more, see [Understand how Azure IoT Edge uses certificates](iot-edge-certs.md).
231
220
232
221
# [Windows](#tab/windows)
233
222
234
223
1. Navigate to the working directory `wrkdir` that has the certificate generation scripts and root CA certificate.
235
224
236
-
2. Create the IoT Edge CA certificate and private key with the following command. Provide a name for the CA certificate. The name passed to the **New-CACertsEdgeDevice** command should *not* be the same as the hostname parameter in the config file or the device's ID in IoT Hub.
225
+
2. Create the IoT Edge CA certificate and private key with the following command. Enter a name for the CA certificate. Don't use the same name as the hostname parameter in the config file or the device's ID in IoT Hub for the **New-CACertsEdgeDevice** command.
237
226
238
227
```powershell
239
228
New-CACertsEdgeDevice "<CA cert name>"
240
229
```
241
230
242
-
3. This command creates several certificate and key files. The following certificate and key pair need to be copied over to an IoT Edge device and referenced in the config file:
231
+
3. This command creates several certificate and key files. Copy the following certificate and key pair to the IoT Edge device and reference them in the config file:
@@ -249,13 +238,13 @@ The **Edge CA** certificate is also responsible for creating certificates for mo
249
238
250
239
1. Navigate to the working directory that has the certificate generation scripts and root CA certificate.
251
240
252
-
2. Create the IoT Edge CA certificate and private key with the following command. Provide a name for the CA certificate. The name passed to the **create_edge_device_ca_certificate** command should *not* be the same as the hostname parameter in the config file or the device's ID in IoT Hub.
241
+
2. Create the IoT Edge CA certificate and private key with the following command. Enter a name for the CA certificate. Don't use the same name as the hostname parameter in the config file or the device's ID in IoT Hub for the **create_edge_device_ca_certificate** command.
3. This script command creates several certificate and key files. The following certificate and key pair need to be copied over to an IoT Edge device and referenced in the config file:
247
+
3. This script command creates several certificate and key files. Copy the following certificate and key pair to the IoT Edge device and reference them in the config file:
0 commit comments