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
Copy file name to clipboardExpand all lines: articles/iot-dps/tutorial-set-up-cloud.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,9 @@ This tutorial shows how to set up the cloud for automatic device provisioning us
23
23
24
24
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
25
25
26
-
## Log in to the Azure portal
26
+
## Sign in to the Azure portal
27
27
28
-
Log in to the [Azure portal](https://portal.azure.com/).
28
+
Sign in to the [Azure portal](https://portal.azure.com/).
29
29
30
30
## Create a Device Provisioning Service instance and get the ID scope
31
31
@@ -45,9 +45,9 @@ Follow these steps to create a new Device Provisioning Service instance.
45
45
46
46

47
47
48
-
5. Click **Create**.
49
-
6.The *ID scope* is used to identify registration IDs, and provides a guarantee that the registration ID is unique. To obtain this value, click **Overview** to open the **Essentials** page for the Device Provisioning Service. Copy the **ID Scope** value to a temporary location for later use.
50
-
7. Also make a note of the **Service endpoint** value, or copy it to a temporary location for later use.
48
+
5. Click **Create**. After a few moments, the Device Provisioning Service instance is created and the **Overview** page is displayed.
49
+
6.On the **Overview** page for the new service instance, copy the value for the **ID scope** for use later. That value is used to identify registration IDs, and provides a guarantee that the registration ID is unique.
50
+
7. Also, copy the **Service endpoint** value for later use.
@@ -60,8 +60,11 @@ The next step is to link the Device Provisioning Service and IoT hub so that the
60
60
1. In the **All resources** page, click the Device Provisioning Service instance you created previously.
61
61
2. In the Device Provisioning Service page, click **Linked IoT hubs**.
62
62
3. Click **Add**.
63
-
4. In the **Add link to IoT hub** page, use the radio buttons to specify whether the linked IoT hub is located in the current subscription, or in a different subscription. Then, choose the name of the IoT hub from the **IoT hub** box.
64
-
5. Click **Save**.
63
+
4. In the **Add link to IoT hub** page, provide the following information, and click **Save**:
64
+
65
+
***Subscription:** Make sure the subscription that contains the IoT hub is selected. You can link to IoT hub that resides in a different subscription.
66
+
***IoT hub:** Choose the name of the IoT hub that you want to link with this Device Provisioning Service instance.
67
+
***Access Policy:** Select **iothubowner** as the credentials to use for establishing the link to the IoT hub.
65
68
66
69

67
70
@@ -70,7 +73,7 @@ The next step is to link the Device Provisioning Service and IoT hub so that the
70
73
The allocation policy is a IoT Hub Device Provisioning Service setting that determines how devices are assigned to an IoT hub. There are three supported allocation policies:
71
74
72
75
1.**Lowest latency**: Devices are provisioned to an IoT hub based on the hub with the lowest latency to the device.
73
-
2.**Evenly weighted distribution** (default): Linked IoT hubs are equally likely to have devices provisioned to them. This is the default setting. If you are provisioning devices to only one IoT hub, you can keep this setting.
76
+
2.**Evenly weighted distribution** (default): Linked IoT hubs are equally likely to have devices provisioned to them. This setting is the default. If you are provisioning devices to only one IoT hub, you can keep this setting.
74
77
3.**Static configuration via the enrollment list**: Specification of the desired IoT hub in the enrollment list takes priority over the Device Provisioning Service-level allocation policy.
75
78
76
79
To set the allocation policy, in the Device Provisioning Service page click **Manage allocation policy**. Make sure the allocation policy is set to **Evenly weighted distribution** (the default). If you make any changes, click **Save** when you are done.
Copy file name to clipboardExpand all lines: articles/iot-dps/tutorial-set-up-device.md
+50-33Lines changed: 50 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,62 +13,74 @@ ms.custom: mvc
13
13
14
14
# Set up a device to provision using the Azure IoT Hub Device Provisioning Service
15
15
16
-
In the previous tutorial, you learned how to set up the Azure IoT Hub Device Provisioning Service to automatically provision your devices to your IoT hub. This tutorial shows you how to set up your device during the manufacturing process, enabling it to be auto-provisioned with IoT Hub. Your device is provisioned based on its [Attestation mechanism](concepts-device.md#attestation-mechanism), upon first boot and connection to the provisioning service. This tutorial discusses the processes to:
16
+
In the previous tutorial, you learned how to set up the Azure IoT Hub Device Provisioning Service to automatically provision your devices to your IoT hub. This tutorial shows you how to set up your device during the manufacturing process, enabling it to be auto-provisioned with IoT Hub. Your device is provisioned based on its [Attestation mechanism](concepts-device.md#attestation-mechanism), upon first boot and connection to the provisioning service. This tutorial covers the following tasks:
Before proceeding, create your Device Provisioning Service instance and an IoT hub, using the instructions in the previous [1 - Set up cloud resources](./tutorial-set-up-cloud.md) tutorial.
23
+
This tutorial expects that you have already created your Device Provisioning Service instance and an IoT hub, using the instructions in the previous [Set up cloud resources](tutorial-set-up-cloud.md) tutorial.
26
24
27
25
This tutorial uses the [Azure IoT SDKs and libraries for C repository](https://github.com/Azure/azure-iot-sdk-c), which contains the Device Provisioning Service Client SDK for C. The SDK currently provides TPM and X.509 support for devices running on Windows or Ubuntu implementations. This tutorial is based on use of a Windows development client, which also assumes basic proficiency with Visual Studio 2017.
28
26
29
27
If you're unfamiliar with the process of auto-provisioning, be sure to review [Auto-provisioning concepts](concepts-auto-provisioning.md) before continuing.
* Visual Studio 2015 or [Visual Studio 2017](https://www.visualstudio.com/vs/) with the ['Desktop development with C++'](https://www.visualstudio.com/vs/support/selecting-workloads-visual-studio-2017/) workload enabled.
35
+
* Latest version of [Git](https://git-scm.com/download/) installed.
36
+
37
+
38
+
31
39
## Build a platform-specific version of the SDK
32
40
33
41
The Device Provisioning Service Client SDK helps you implement your device registration software. But before you can use it, you need to build a version of the SDK specific to your development client platform and attestation mechanism. In this tutorial, you build an SDK that uses Visual Studio 2017 on a Windows development platform, for a supported type of attestation:
34
42
35
-
1. Install the required tools and clone the GitHub repository that contains the provisioning service Client SDK for C:
36
-
37
-
a. Make sure you have either Visual Studio 2015 or [Visual Studio 2017](https://www.visualstudio.com/vs/) installed on your machine. You must have ['Desktop development with C++'](https://www.visualstudio.com/vs/support/selecting-workloads-visual-studio-2017/) workload enabled for your Visual Studio installation.
43
+
1. Download the latest release version of the [CMake build system](https://cmake.org/download/). From that same site, look up the cryptographic hash for the version of the binary distribution you chose. Verify the downloaded binary using the corresponding cryptographic hash value. The following example used Windows PowerShell to verify the cryptographic hash for version 3.11.4 of the x64 MSI distribution:
38
44
39
-
b. Download and install the [CMake build system](https://cmake.org/download/). It is important that the Visual Studio with 'Desktop development with C++' workload is installed on your machine, **before** the CMake installation.
c. Make sure `git`is installed on your machine and is added to the environment variables accessible to the command window. See [Software Freedom Conservancy's Git client tools](https://git-scm.com/download/) for the latest `git` tools, including **Git Bash**, a command-line Bash shell for interacting with your local Git repository.
51
+
It is important that the Visual Studio prerequisites (Visual Studio and the 'Desktop development with C++' workload) are installed on your machine, **before** starting the `CMake` installation. Once the prerequisites are in place, and the download is verified, install the CMake build system.
42
52
43
-
d. Open Git Bash, and clone the "Azure IoT SDKs and libraries for C" repository. The clone command may take several minutes to complete, as it also downloads several dependant submodules:
53
+
2. Open a command prompt or Git Bash shell. Execute the following command to clone the [Azure IoT C SDK](https://github.com/Azure/azure-iot-sdk-c) GitHub repository:
The size of this repository is currently around 220 MB. You should expect this operation to take several minutes to complete.
48
59
49
-
e. Create a new `cmake` subdirectory inside of the newly created repository subdirectory:
50
60
51
-
```cmd/sh
52
-
mkdir azure-iot-sdk-c/cmake
53
-
```
61
+
3. Create a `cmake` subdirectory in the root directory of the git repository, and navigate to that folder.
54
62
55
-
2. From the Git Bash command prompt, change into the azure-iot-sdk-c repository's `cmake` subdirectory:
63
+
```cmd/sh
64
+
cd azure-iot-sdk-c
65
+
mkdir cmake
66
+
cd cmake
67
+
```
56
68
57
-
```cmd/sh
58
-
cd azure-iot-sdk-c/cmake
59
-
```
69
+
4. Build the SDK for your development platform based on the attestation mechanisms you will be using. Use one of the following commands (also note the two trailing period characters for each command). Upon completion, CMake builds out the `/cmake` subdirectory with content specific to your device:
70
+
71
+
- For devices that use the TPM simulator for attestation:
60
72
61
-
3. Build the SDK for your development platform and one of the supported attestation mechanisms, using one of the following commands (also note the two trailing period characters). Upon completion, CMake builds out the `/cmake` subdirectory with content specific to your device:
62
-
- For devices that use a physical TPM/HSM, or a simulated X.509 certificate for attestation:
Now you're ready to use the SDK to build your device registration code.
73
85
74
86
<a id="extractsecurity"></a>
@@ -77,19 +89,23 @@ Now you're ready to use the SDK to build your device registration code.
77
89
78
90
The next step is to extract the security artifacts for the attestation mechanism used by your device.
79
91
80
-
### Physical device
92
+
### Physical devices
81
93
82
-
If you built the SDK to use attestation from a physical TPM/HSM:
94
+
Depending on whether you built the SDK to use attestation for a physical TPM/HSM or using X.509 certificates, gathering the security artifacts is as follows:
83
95
84
96
- For a TPM device, you need to determine the **Endorsement Key** associated with it from the TPM chip manufacturer. You can derive a unique **Registration ID** for your TPM device by hashing the endorsement key.
85
97
86
-
- For an X.509 device, you need to obtain the certificates issued to your device(s) - end-entity certificates for individual device enrollments, while root certificates for group enrollments of devices.
98
+
- For an X.509 device, you need to obtain the certificates issued to your device(s). The provisioning service exposes two types of enrollment entries that control access for devices using the X.509 attestation mechanism. The certificates needed depend on the enrollment types you will be using.
87
99
88
-
### Simulated device
100
+
1. Individual enrollments: Enrollment for a specific single device. This type of enrollment entry requires [end-entity, "leaf", certificates](concepts-security.md#end-entity-leaf-certificate).
101
+
2. Enrollment groups: This type of enrollment entry requires intermediate or root certificates. For more information, see [Controlling device access to the provisioning service with X.509 certificates](concepts-security.md#controlling-device-access-to-the-provisioning-service-with-x509-certificates).
89
102
90
-
If you built the SDK to use attestation from a simulated TPM or X.509 certificate:
103
+
### Simulated devices
104
+
105
+
Depending on whether you built the SDK to use attestation for a simulated device using TPM or X.509 certificates, gathering the security artifacts is as follows:
91
106
92
107
- For a simulated TPM device:
108
+
93
109
1. Open a Windows Command Prompt, navigate to the `azure-iot-sdk-c` subdirectory, and run the TPM simulator. It listens over a socket on ports 2321 and 2322. Do not close this command window; you will need to keep this simulator running until the end of the following Quickstart.
94
110
95
111
From the `azure-iot-sdk-c` subdirectory, run the following command to start the simulator:
@@ -105,14 +121,15 @@ If you built the SDK to use attestation from a simulated TPM or X.509 certificat
105
121
106
122
3. In the *Solution Explorer* pane in Visual Studio, navigate to the folder **Provision\_Tools**. Right-click the **tpm_device_provision** project and select **Set as Startup Project**.
107
123
108
-
4. Run the solution using either of the "Start" commands on the "Debug" menu. The output window displays the TPM simulator's **_Registration ID_** and the **_Endorsement Key_**, needed for device enrollment and registration. Copy these values for use later. You can close this window (with Registration Id and Endorsement Key), but leave the TPM simulator window running that you started in step #1.
124
+
4. Run the solution using either of the "Start" commands on the "Debug" menu. The output window displays the TPM simulator's **_Registration ID_** and the **_Endorsement Key_**, needed for device enrollment and registration. Copy these values for use later. You can close this window (with Registration ID and Endorsement Key), but leave the TPM simulator window running that you started in step #1.
109
125
110
126
- For a simulated X.509 device:
127
+
111
128
1. Using Visual Studio, open the solution generated in the *cmake* folder named `azure_iot_sdks.sln`, and build it using the "Build solution" command on the "Build" menu.
112
129
113
130
2. In the *Solution Explorer* pane in Visual Studio, navigate to the folder **Provision\_Tools**. Right-click the **dice\_device\_enrollment** project and select **Set as Startup Project**.
114
131
115
-
3. Run the solution using either of the "Start" commands on the "Debug" menu. In the output window, enter **i** for individual enrollment when prompted. The output window displays a locally generated X.509 certificate for your simulated device. Copy to clipboard the output starting from *-----BEGIN CERTIFICATE-----* and ending at the first *-----END CERTIFICATE-----*, making sure to include both of these lines as well. Note that you need only the first certificate from the output window.
132
+
3. Run the solution using either of the "Start" commands on the "Debug" menu. In the output window, enter **i** for individual enrollment when prompted. The output window displays a locally generated X.509 certificate for your simulated device. Copy to clipboard the output starting from *-----BEGIN CERTIFICATE-----* and ending at the first *-----END CERTIFICATE-----*, making sure to include both of these lines as well. You only need the first certificate from the output window.
116
133
117
134
4. Create a file named **_X509testcert.pem_**, open it in a text editor of your choice, and copy the clipboard contents to this file. Save the file as you will use it later for device enrollment. When your registration software runs, it uses the same certificate during auto-provisioning.
0 commit comments