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/how-to-provision-multitenant.md
+49-45Lines changed: 49 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,19 @@
1
1
---
2
2
title: How to provision devices for multitenancy in Azure IoT Hub Device Provisioning Service
3
3
description: How to provision devices for multitenancy with your Device Provisioning Service (DPS) instance
4
-
author: wesmc7777
5
-
ms.author: wesmc
6
-
ms.date: 04/10/2019
4
+
author: anastasia-ms
5
+
ms.author: v-stharr
6
+
ms.date: 10/05/2021
7
7
ms.topic: conceptual
8
8
ms.service: iot-dps
9
9
services: iot-dps
10
10
---
11
11
12
-
13
12
# How to provision for multitenancy
14
13
15
-
This article demonstrates how to securely provision multiple simulated symmetric key devices to a group of IoT Hubs using an [allocation policy](concepts-service.md#allocation-policy). Allocation policies defined by the provisioning service support a variety of allocation scenarios. Two common scenarios are:
14
+
This article demonstrates how to securely provision multiple simulated symmetric key devices to a group of IoT Hubs using an [allocation policy](concepts-service.md#allocation-policy). Allocation policies that are defined by the provisioning service support a variety of allocation scenarios. Two common scenarios are:
16
15
17
-
***Geolocation / GeoLatency**: As a device moves between locations, network latency is improved by having the device provisioned to the IoT hub closest to each location. In this scenario, a group of IoT hubs, which span across regions, are selected for enrollments. The **Lowest latency** allocation policy is selected for these enrollments. This policy causes the Device Provisioning Service to evaluate device latency and determine the closet IoT hub out of the group of IoT hubs.
16
+
***Geolocation / GeoLatency**: As a device moves between locations, network latency is improved by having the device provisioned to the IoT hub that's closest to each location. In this scenario, a group of IoT hubs, which span across regions, are selected for enrollments. The **Lowest latency** allocation policy is selected for these enrollments. This policy causes the Device Provisioning Service to evaluate device latency and determine the closet IoT hub out of the group of IoT hubs.
18
17
19
18
***Multi-tenancy**: Devices used within an IoT solution may need to be assigned to a specific IoT hub or group of IoT hubs. The solution may require all devices for a particular tenant to communicate with a specific group of IoT hubs. In some cases, a tenant may own IoT hubs and require devices to be assigned to their IoT hubs.
20
19
@@ -29,101 +28,104 @@ This article uses a simulated device sample from the [Azure IoT C SDK](https://g
29
28
> * Set up the development environment for the Azure IoT C SDK on both Linux VMs
30
29
> * Simulate the devices to see that they are provisioned for the same tenant in the closest region.
* If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin.
35
34
36
-
## Prerequisites
35
+
* Complete the steps in [Set up IoT Hub Device Provisioning Service with the Azure portal](./quick-setup-auto-provision.md).
37
36
38
-
- Completion of the [Set up IoT Hub Device Provisioning Service with the Azure portal](./quick-setup-auto-provision.md) quickstart.
In this section, you will use the Azure Cloud Shell to create two new regional IoT hubs in the **West US** and **East US** regions for a tenant.
41
+
In this section, you'll create an Azure resource group, and two new regional IoT hub resources for a tenant. One IoT hub will be for the **West US**region and the other is will be for the **East US** regions.
44
42
43
+
>[!IMPORTANT]
44
+
>It is recommended that you use the same resource group for all resources created in this article. This will make clean up easier after you are finished.
45
45
46
-
1. Use the Azure Cloud Shell to create a resource group with the [az group create](/cli/azure/group#az_group_create) command. An Azure resource group is a logical container into which Azure resources are deployed and managed.
47
-
48
-
The following example creates a resource group named *contoso-us-resource-group* in the *eastus* region. It is recommended that you use this group for all resources created in this article. This will make clean up easier after you are finished.
46
+
1. In the Azure Cloud Shell, create a resource group with the following [az group create](/cli/azure/group#az_group_create) command:
49
47
50
48
```azurecli-interactive
51
49
az group create --name contoso-us-resource-group --location eastus
52
50
```
53
51
54
-
2. Use the Azure Cloud Shell to create an IoT hub in the **eastus** region with the [az iot hub create](/cli/azure/iot/hub#az_iot_hub_create) command. The IoT hub will be added to the *contoso-us-resource-group*.
55
-
56
-
The following example creates an IoT hub named *contoso-east-hub* in the *eastus* location. You must use your own unique hub name instead of **contoso-east-hub**.
52
+
2. Create an IoT hub in the *eastus* location and add it to the resource group you created with the following [az iot hub create](/cli/azure/iot/hub#az_iot_hub_create) command(replace `{unique-hub-name}` with your own unique name):
3. Use the Azure Cloud Shell to create an IoT hub in the **westus** region with the [az iot hub create](/cli/azure/iot/hub#az_iot_hub_create) command. This IoT hub will also be added to the *contoso-us-resource-group*.
58
+
This command may take a few minutes to complete.
65
59
66
-
The following example creates an IoT hub named *contoso-west-hub* in the *westus* location. You must use your own unique hub name instead of **contoso-west-hub**.
60
+
3. Finally, create an IoT hub in the *westus* location add it to the resource group you created with the following [az iot hub create](/cli/azure/iot/hub#az_iot_hub_create) command(replace `{unique-hub-name}` with your own unique name):
In this section, you will create a new enrollment group for the tenant devices.
70
+
In this section, you'll create a new enrollment group for the tenant devices.
79
71
80
72
For simplicity, this article uses [Symmetric key attestation](concepts-symmetric-key-attestation.md) with the enrollment. For a more secure solution, consider using [X.509 certificate attestation](concepts-x509-attestation.md) with a chain of trust.
81
73
82
-
1. Sign in to the [Azure portal](https://portal.azure.com), and open your Device Provisioning Service instance.
74
+
1. In the Azure portal, select your Device Provisioning Service.
83
75
84
-
2. Select the **Manage enrollments** tab, and then click the **Add enrollment group** button at the top of the page.
76
+
2. In the **Settings** menu, select **Manage enrollments**.
85
77
86
-
3. On **Add Enrollment Group**, enter the following information, and click the **Save** button.
78
+
3. Select **+ Add enrollment group**.
87
79
88
-
**Group name**: Enter **contoso-us-devices**.
80
+
4. On the **Add Enrollment Group** page, enter the following information:
89
81
90
-
**Attestation Type**: Select **Symmetric Key**.
82
+
**Group name**: Enter *contoso-us-devices*.
83
+
84
+
**Attestation Type**: Select *Symmetric Key*.
91
85
92
86
**Auto Generate Keys**: This checkbox should already be checked.
93
87
94
-
**Select how you want to assign devices to hubs**: Select **Lowest latency**.
88
+
**Select how you want to assign devices to hubs**: Select *Lowest latency*.
95
89
96
-

90
+
5. Select **Link a new IoT Hub**
97
91
92
+
:::image type="content" source="./media/how-to-provision-multitenant/create-multitenant-enrollment.png" alt-text="Add multitenant enrollment group for symmetric key attestation.":::
98
93
99
-
4. On **Add Enrollment Group**, click **Link a new IoT hub** to link both of your regional hubs.
94
+
6. On the **Add link to IoT hub** page, enter the following information:
100
95
101
96
**Subscription**: If you have multiple subscriptions, choose the subscription where you created the regional IoT hubs.
102
97
103
-
**IoT hub**: Select one of the regional hubs you created.
98
+
**IoT hub**: Select the IoT hub that you created for the *eastus* location.
99
+
100
+
**Access Policy**: Select *iothubowner*.
101
+
102
+
:::image type="content" source="./media/how-to-provision-multitenant/link-regional-hubs.png" alt-text="Link the regional IoT hubs with the provisioning service.":::
104
103
105
-
**Access Policy**: Choose **iothubowner**.
104
+
7. Select **Save**.
106
105
107
-

106
+
8. Repeat Steps 5 through 7 for the second IoT hub that you created for the *westgus* location.
108
107
108
+
9. Select the two IoT Hubs you created in the **Select the IoT hubs this group c an be assigned to** drop down.
109
109
110
-
5. Once both regional IoT hubs have been linked, you must select them for the enrollmentgroup and click **Save** to create the regional IoT hub group for the enrollment.
110
+
:::image type="content" source="./media/how-to-provision-multitenant/enrollment-regional-hub-group.png" alt-text="Select the linked IoT hubs.":::
111
111
112
-

112
+
10. Select **Save**
113
113
114
+
11. Select *contoso-us-devices* in the enrollment groups list.
114
115
115
-
6. After saving the enrollment, reopen it and make a note of the **Primary Key**. You must save the enrollment first to have the keys generated. This key will be used to generate unique device keys for both simulated devices later.
116
+
12. Copy the *Primary Key*. This key will be used later to generate unique device keys for both simulated devices.
116
117
118
+
:::image type="content" source="./media/how-to-provision-multitenant/copy-primary-key.png" alt-text="Copy the primary key.":::
117
119
118
120
## Create regional Linux VMs
119
121
120
-
In this section, you will create two regional Linux virtual machines (VMs). These VMs will run a device simulation sample from each region to demonstrate device provisioning for tenant devices from both regions.
122
+
In this section, you'll create two regional Linux virtual machines (VMs). These VMs will run a device simulation sample from each region to demonstrate device provisioning for tenant devices from both regions.
121
123
122
124
To make clean-up easier, these VMs will be added to the same resource group that contains the IoT hubs that were created, *contoso-us-resource-group*. However, the VMs will run in separate regions (**West US** and **East US**).
123
125
124
-
1. In the Azure Cloud Shell, execute the following command to create an **East US** region VM after making the following parameter changes in the command:
126
+
1. In the Azure Cloud Shell, run the following command to create an **East US** region VM after making the following parameter changes in the command:
125
127
126
-
**--name**: Enter a unique name for your **East US** regional device VM.
128
+
**--name**: Enter a unique name for your **East US** regional device VM.
127
129
128
130
**--admin-username**: Use your own admin user name.
129
131
@@ -138,11 +140,12 @@ To make clean-up easier, these VMs will be added to the same resource group that
138
140
--admin-username contosoadmin \
139
141
--admin-password myContosoPassword2018 \
140
142
--authentication-type password
143
+
--public-ip-sku Standard
141
144
```
142
145
143
146
This command will take a few minutes to complete. Once the command has completed, make a note of the **publicIpAddress** value for your East US region VM.
144
147
145
-
1. In the Azure Cloud Shell, execute the command to create a **West US** region VM after making the following parameter changes in the command:
148
+
2. In the Azure Cloud Shell, execute the command to create a **West US** region VM after making the following parameter changes in the command:
146
149
147
150
**--name**: Enter a unique name for your **West US** regional device VM.
148
151
@@ -159,11 +162,12 @@ To make clean-up easier, these VMs will be added to the same resource group that
159
162
--admin-username contosoadmin \
160
163
--admin-password myContosoPassword2018 \
161
164
--authentication-type password
165
+
--public-ip-sku Standard
162
166
```
163
167
164
168
This command will take a few minutes to complete. Once the command has completed, make a note of the **publicIpAddress** value for your West US region VM.
165
169
166
-
1. Open two command-line shells. Connect to one of the regional VMs in each shell using SSH.
170
+
3. Open two command-line shells. Connect to one of the regional VMs in each shell using SSH.
167
171
168
172
Pass your admin username, and the public IP address you noted for the VM as parameters to SSH. Enter the admin password when prompted.
0 commit comments