Skip to content

Commit 9d677bb

Browse files
authored
Merge pull request #265536 from PatAltimore/patricka-snaps
Add snaps to IoT Edge install
2 parents dd94741 + 9f11422 commit 9d677bb

9 files changed

+474
-120
lines changed

articles/iot-edge/how-to-access-host-storage-from-module.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ Your deployment manifest would be similar to the following:
7272
}
7373
```
7474

75+
> [!NOTE]
76+
> If you are using a snap installation, ensure you choose a host storage path that is accessible to the snaps. For example, `$HOME/snap/azure-iot-edge/current/modules/`.
77+
7578
### Automatic host system permissions management
7679

7780
On version 1.4 and newer, there's no need for manually setting ownership or permissions for host storage backing the `StorageFolder`. Permissions and ownership are automatically managed by the system modules during startup.

articles/iot-edge/how-to-provision-devices-at-scale-linux-symmetric.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create and provision IoT Edge devices using symmetric keys on Linux - Azu
33
description: Use symmetric key attestation to test provisioning Linux devices at scale for Azure IoT Edge with device provisioning service
44
author: PatAltimore
55
ms.author: patricka
6-
ms.date: 08/26/2022
6+
ms.date: 02/27/2024
77
ms.topic: conceptual
88
ms.service: iot-edge
99
services: iot-edge
@@ -51,18 +51,36 @@ Have the following information ready:
5151
* The device **Registration ID** you created
5252
* Either the **Primary Key** from an individual enrollment, or a [derived key](#derive-a-device-key) for devices using a group enrollment.
5353

54-
1. Create a configuration file for your device based on a template file that is provided as part of the IoT Edge installation.
54+
Create a configuration file for your device based on a template file that is provided as part of the IoT Edge installation.
5555

56-
```bash
57-
sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
58-
```
56+
# [Ubuntu / Debian / RHEL](#tab/ubuntu+debian+rhel)
57+
58+
```bash
59+
sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
60+
```
5961

60-
1. Open the configuration file on the IoT Edge device.
62+
Open the configuration file on the IoT Edge device.
6163

6264
```bash
6365
sudo nano /etc/aziot/config.toml
6466
```
6567

68+
# [Ubuntu Core snaps](#tab/snaps)
69+
70+
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:
71+
72+
```bash
73+
cp /snap/azure-iot-edge/current/etc/aziot/config.toml.edge.template ~/config.toml
74+
```
75+
76+
Open the configuration file in your home directory on the IoT Edge device.
77+
78+
```bash
79+
nano ~/config.toml
80+
```
81+
82+
---
83+
6684
1. Find the **Provisioning** section of the file. Uncomment the lines for DPS provisioning with symmetric key, and make sure any other provisioning lines are commented out.
6785

6886
```toml
@@ -90,18 +108,29 @@ Have the following information ready:
90108

91109
If you use any PKCS#11 URIs, find the **PKCS#11** section in the config file and provide information about your PKCS#11 configuration.
92110

93-
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 daemon(s) 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).
111+
For more information about provisioning configuration settings, see [Configure IoT Edge device settings](configure-device.md#provisioning).
94112

95-
1. Optionally, uncomment the `payload` parameter to specify the path to a local JSON file. The contents of the file will be [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.
113+
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).
96114

97-
1. Save and close the file.
115+
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.
98116

99-
1. Apply the configuration changes that you made to IoT Edge.
117+
1. Save and close the file.
100118

101-
```bash
102-
sudo iotedge config apply
103-
```
119+
1. Apply the configuration changes that you made on the device.
104120

121+
# [Ubuntu / Debian / RHEL](#tab/ubuntu+debian+rhel)
122+
```bash
123+
sudo iotedge config apply
124+
```
125+
126+
# [Ubuntu Core snaps](#tab/snaps)
127+
128+
```bash
129+
sudo snap set azure-iot-edge raw-config="$(cat ~/config.toml)"
130+
```
131+
132+
---
133+
105134
## Verify successful installation
106135

107136
If the runtime started successfully, you can go into your IoT Hub and start deploying IoT Edge modules to your device.

articles/iot-edge/how-to-provision-devices-at-scale-linux-tpm.md

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use a simulated TPM on a Linux device to test the Azure IoT Hub dev
44
author: PatAltimore
55
manager: lizross
66
ms.author: patricka
7-
ms.date: 05/13/2022
7+
ms.date: 02/27/2024
88
ms.topic: conceptual
99
ms.service: iot-edge
1010
services: iot-edge
@@ -52,7 +52,7 @@ The tasks are as follows:
5252

5353
A physical Linux device to be the IoT Edge device.
5454

55-
If you are a device manufacturer then refer to guidance on [integrating a TPM into the manufacturing process](../iot-dps/concepts-device-oem-security-practices.md#integrating-a-tpm-into-the-manufacturing-process).
55+
If you are a device manufacturer, then refer to guidance on [integrating a TPM into the manufacturing process](../iot-dps/concepts-device-oem-security-practices.md#integrating-a-tpm-into-the-manufacturing-process).
5656

5757
# [Virtual machine](#tab/virtual-machine)
5858

@@ -165,6 +165,11 @@ Sign in to your device, and install the `tpm2-tools` package.
165165
sudo yum install tpm2-tools
166166
```
167167

168+
# [Ubuntu Core snaps](#tab/snaps)
169+
170+
```bash
171+
sudo snap install tpm2-tools
172+
```
168173
---
169174

170175
Run the following script to read the endorsement key, creating one if it does not already exist.
@@ -212,19 +217,37 @@ After you have your registration ID and endorsement key, you're ready to continu
212217

213218
After 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.
214219

215-
1. Know your device provisioning service **ID Scope** and device **Registration ID** that were gathered previously.
220+
Know your device provisioning service **ID Scope** and device **Registration ID** that were gathered previously.
216221

217-
1. Create a configuration file for your device based on a template file that's provided as part of the IoT Edge installation.
222+
Create a configuration file for your device based on a template file that's provided as part of the IoT Edge installation.
218223

219-
```bash
220-
sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
221-
```
224+
# [Ubuntu / Debian / RHEL](#tab/ubuntu+debian+rhel)
222225

223-
1. Open the configuration file on the IoT Edge device.
226+
```bash
227+
sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
228+
```
224229

225-
```bash
226-
sudo nano /etc/aziot/config.toml
227-
```
230+
Open the configuration file on the IoT Edge device.
231+
232+
```bash
233+
sudo nano /etc/aziot/config.toml
234+
```
235+
236+
# [Ubuntu Core snaps](#tab/snaps)
237+
238+
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:
239+
240+
```bash
241+
cp /snap/azure-iot-edge/current/etc/aziot/config.toml.edge.template ~/config.toml
242+
```
243+
244+
Open the configuration file in your home directory on the IoT Edge device.
245+
246+
```bash
247+
nano ~/config.toml
248+
```
249+
250+
---
228251

229252
1. Find the provisioning configurations section of the file. Uncomment the lines for TPM provisioning, and make sure any other provisioning lines are commented out.
230253

@@ -247,9 +270,11 @@ After the runtime is installed on your device, configure the device with the inf
247270

248271
1. Update the values of `id_scope` and `registration_id` with your device provisioning service and device information. The `scope_id` value is the **ID Scope** from your device provisioning service instance's overview page.
249272

250-
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 daemon(s) 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).
273+
For more information about provisioning configuration settings, see [Configure IoT Edge device settings](configure-device.md#provisioning).
251274

252-
1. Optionally, uncomment the `payload` parameter to specify the path to a local JSON file. The contents of the file will be [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.
275+
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).
276+
277+
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.
253278

254279
1. Save and close the file.
255280

@@ -259,7 +284,7 @@ The IoT Edge runtime relies on a TPM service that brokers access to a device's T
259284

260285
You can give access to the TPM by overriding the systemd settings so that the `aziottpm` service has root privileges. If you don't want to elevate the service privileges, you can also use the following steps to manually provide TPM access.
261286

262-
1. Create a new rule that will give the IoT Edge runtime access to `tpm0` and `tpmrm0`.
287+
1. Create a new rule that gives the IoT Edge runtime access to `tpm0` and `tpmrm0`.
263288

264289
```bash
265290
sudo touch /etc/udev/rules.d/tpmaccess.rules
@@ -300,39 +325,48 @@ You can give access to the TPM by overriding the systemd settings so that the `a
300325
crw-rw---- 1 root aziottpm 10, 224 Jul 20 16:27 /dev/tpmrm0
301326
```
302327

303-
If you don't see that the correct permissions have been applied, try rebooting your machine to refresh `udev`.
328+
If you don't see that the correct permissions applied, try rebooting your machine to refresh `udev`.
304329

305330
1. Apply the configuration changes that you made on the device.
306331

307-
```bash
308-
sudo iotedge config apply
309-
```
332+
# [Ubuntu / Debian / RHEL](#tab/ubuntu+debian+rhel)
333+
```bash
334+
sudo iotedge config apply
335+
```
336+
337+
# [Ubuntu Core snaps](#tab/snaps)
338+
339+
```bash
340+
sudo snap set azure-iot-edge raw-config="$(cat ~/config.toml)"
341+
```
342+
343+
---
310344

311345
## Verify successful installation
312346

313347
If you didn't already, apply the configuration changes that you made on the device.
314348
315-
```bash
316-
sudo iotedge config apply
317-
```
349+
```bash
350+
sudo iotedge config apply
351+
```
318352
319353
Check to see that the IoT Edge runtime is running.
320354
321355
```bash
322-
sudo iotedge system status
323-
```
356+
sudo iotedge system status
357+
```
324358
325359
Examine daemon logs.
326360
327-
```cmd/sh
328-
sudo iotedge system logs
329-
```
361+
```cmd/sh
362+
sudo iotedge system logs
363+
```
330364
331365
If you see provisioning errors, it might be that the configuration changes haven't taken effect yet. Try restarting the IoT Edge daemon.
332366

333-
```bash
334-
sudo systemctl daemon-reload
335-
```
367+
```bash
368+
sudo systemctl daemon-reload
369+
```
336370

337371
Or, try restarting your VM to see if the changes take effect on a fresh start.
338372

0 commit comments

Comments
 (0)