Skip to content

Commit 7f1e0e0

Browse files
authored
Merge pull request #173698 from v-gpettibone/clone
Initial commit for freshness check
2 parents b2c275e + a3795a9 commit 7f1e0e0

8 files changed

+65
-91
lines changed

articles/iot-hub/iot-hub-how-to-clone.md

Lines changed: 65 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -109,73 +109,55 @@ This section provides specific instructions for migrating the hub.
109109

110110
1. Select **Export template** from the list of properties and settings for the hub.
111111

112-
![Screenshot showing the command for exporting the template for the IoT Hub.](./media/iot-hub-how-to-clone/iot-hub-export-template.png)
112+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-export-template.png" alt-text="Screenshot showing the command for exporting the template for the IoT Hub." border="true":::
113113

114114
1. Select **Download** to download the template. Save the file somewhere you can find it again.
115115

116-
![Screenshot showing the command for downloading the template for the IoT Hub.](./media/iot-hub-how-to-clone/iot-hub-download-template.png)
116+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-download-template.png" alt-text="Screenshot showing the command for downloading the template for the IoT Hub." border="true":::
117117

118118
### View the template
119119

120-
1. Go to the Downloads folder (or to whichever folder you used when you exported the template) and find the zip file. Open the zip file and find the file called `template.json`. Select it, then select Ctrl+C to copy the template. Go to a different folder that's not in the zip file and paste the file (Ctrl+V). Now you can edit it.
120+
1. Go to the Downloads folder (or to whichever folder you used when you exported the template) and find the zip file. Extract the zip file and find the file called `template.json`. Select and copy it. Go to a different folder and paste the template file (Ctrl+V). Now you can edit it.
121121

122-
The following example is for a generic hub with no routing configuration. It is an S1 tier hub (with 1 unit) called **ContosoTestHub29358** in region **westus**. Here is the exported template.
122+
The following example is for a generic hub with no routing configuration. It is an S1 tier hub (with 1 unit) called **ContosoHub** in region **westus**. Here is the exported template.
123123

124124
``` json
125125
{
126-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
126+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
127127
"contentVersion": "1.0.0.0",
128128
"parameters": {
129-
"IotHubs_ContosoTestHub29358_name": {
130-
"defaultValue": "ContosoTestHub29358",
129+
"IotHubs_ContosoHub_connectionString": {
130+
"type": "SecureString"
131+
},
132+
"IotHubs_ContosoHub_containerName": {
133+
"type": "SecureString"
134+
},
135+
"IotHubs_ContosoHub_name": {
136+
"defaultValue": "ContosoHub",
131137
"type": "String"
132138
}
133139
},
134140
"variables": {},
135141
"resources": [
136142
{
137143
"type": "Microsoft.Devices/IotHubs",
138-
"apiVersion": "2018-04-01",
139-
"name": "[parameters('IotHubs_ContosoTestHub29358_name')]",
144+
"apiVersion": "2021-07-01",
145+
"name": "[parameters('IotHubs_ContosoHub_name')]",
140146
"location": "westus",
141147
"sku": {
142148
"name": "S1",
143149
"tier": "Standard",
144150
"capacity": 1
145151
},
152+
"identity": {
153+
"type": "None"
154+
},
146155
"properties": {
147-
"operationsMonitoringProperties": {
148-
"events": {
149-
"None": "None",
150-
"Connections": "None",
151-
"DeviceTelemetry": "None",
152-
"C2DCommands": "None",
153-
"DeviceIdentityOperations": "None",
154-
"FileUploadOperations": "None",
155-
"Routes": "None"
156-
}
157-
},
158156
"ipFilterRules": [],
159157
"eventHubEndpoints": {
160158
"events": {
161159
"retentionTimeInDays": 1,
162-
"partitionCount": 2,
163-
"partitionIds": [
164-
"0",
165-
"1"
166-
],
167-
"path": "contosotesthub29358",
168-
"endpoint": "sb://iothub-ns-contosotes-2227755-92aefc8b73.servicebus.windows.net/"
169-
},
170-
"operationsMonitoringEvents": {
171-
"retentionTimeInDays": 1,
172-
"partitionCount": 2,
173-
"partitionIds": [
174-
"0",
175-
"1"
176-
],
177-
"path": "contosotesthub29358-operationmonitoring",
178-
"endpoint": "sb://iothub-ns-contosotes-2227755-92aefc8b73.servicebus.windows.net/"
160+
"partitionCount": 4
179161
}
180162
},
181163
"routing": {
@@ -199,8 +181,8 @@ This section provides specific instructions for migrating the hub.
199181
"storageEndpoints": {
200182
"$default": {
201183
"sasTtlAsIso8601": "PT1H",
202-
"connectionString": "",
203-
"containerName": ""
184+
"connectionString": "[parameters('IotHubs_ContosoHub_connectionString')]",
185+
"containerName": "[parameters('IotHubs_ContosoHub_containerName')]"
204186
}
205187
},
206188
"messagingEndpoints": {
@@ -220,7 +202,9 @@ This section provides specific instructions for migrating the hub.
220202
"maxDeliveryCount": 10
221203
}
222204
},
223-
"features": "None"
205+
"features": "None",
206+
"disableLocalAuth": false,
207+
"allowedFqdnList": []
224208
}
225209
}
226210
]
@@ -233,63 +217,47 @@ You have to make some changes before you can use the template to create the new
233217

234218
#### Edit the hub name and location
235219

236-
1. Remove the parameters section at the top -- it is much simpler to just use the hub name because we're not going to have multiple parameters.
220+
1. Remove the container name parameter section at the top. **ContosoHub** does not have an associated container.
237221

238222
``` json
239-
"parameters": {
240-
"IotHubs_ContosoTestHub29358_name": {
241-
"defaultValue": "ContosoTestHub29358",
242-
"type": "String"
243-
}
223+
"parameters": {
224+
...
225+
"IotHubs_ContosoHub_containerName": {
226+
"type": "SecureString"
244227
},
228+
...
229+
},
245230
```
246231

247-
1. Change the name to use the actual (new) name rather than retrieving it from a parameter (which you removed in the previous step).
232+
1. Remove the **storageEndpoints** property.
248233

249-
For the new hub, use the name of the original hub plus the string *clone* to make up the new name. Start by cleaning up the hub name and location.
234+
```json
235+
"properties": {
236+
...
237+
"storageEndpoints": {
238+
"$default": {
239+
"sasTtlAsIso8601": "PT1H",
240+
"connectionString": "[parameters('IotHubs_ContosoHub_connectionString')]",
241+
"containerName": "[parameters('IotHubs_ContosoHub_containerName')]"
242+
}
243+
},
244+
...
250245

246+
```
247+
248+
1. Under **resources**, change the location from westus to eastus.
249+
251250
Old version:
252251

253252
``` json
254-
"name": "[parameters('IotHubs_ContosoTestHub29358_name')]",
255253
"location": "westus",
256254
```
257255

258256
New version:
259257

260258
``` json
261-
"name": "ContosoTestHub29358clone",
262259
"location": "eastus",
263260
```
264-
265-
Next, you'll find that the values for **path** contain the old hub name. Change them to use the new one. These are the path values under **eventHubEndpoints** called **events** and **OperationsMonitoringEvents**.
266-
267-
When you're done, your event hub endpoints section should look like this:
268-
269-
``` json
270-
"eventHubEndpoints": {
271-
"events": {
272-
"retentionTimeInDays": 1,
273-
"partitionCount": 2,
274-
"partitionIds": [
275-
"0",
276-
"1"
277-
],
278-
"path": "contosotesthub29358clone",
279-
"endpoint": "sb://iothub-ns-contosotes-2227755-92aefc8b73.servicebus.windows.net/"
280-
},
281-
"operationsMonitoringEvents": {
282-
"retentionTimeInDays": 1,
283-
"partitionCount": 2,
284-
"partitionIds": [
285-
"0",
286-
"1"
287-
],
288-
"path": "contosotesthub29358clone-operationmonitoring",
289-
"endpoint": "sb://iothub-ns-contosotes-2227755-92aefc8b73.servicebus.windows.net/"
290-
}
291-
```
292-
293261
#### Update the keys for the routing resources that are not being moved
294262

295263
When you export the Resource Manager template for a hub that has routing configured, you will see that the keys for those resources are not provided in the exported template -- their placement is denoted by asterisks. You must fill them in by going to those resources in the portal and retrieving the keys **before** you import the new hub's template and create the hub.
@@ -347,35 +315,41 @@ Create the new hub in the new location using the template. If you have routing r
347315

348316
1. Select **Create a resource**.
349317

350-
1. In the search box, put in "template deployment" and select Enter.
318+
1. In the search box, type "template deployment" and select Enter.
351319

352320
1. Select **template deployment (deploy using custom templates)**. This takes you to a screen for the Template deployment. Select **Create**. You see this screen:
353321

354-
![Screenshot showing the command for building your own template](./media/iot-hub-how-to-clone/iot-hub-custom-deployment.png)
322+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-custom-deployment.png" alt-text="Screenshot showing the command for building your own template":::
355323

356324
1. Select **Build your own template in the editor**, which enables you to upload your template from a file.
357325

358-
1. Select **Load file**.
326+
1. Select **Load file**.
359327

360-
![Screenshot showing the command for uploading a template file](./media/iot-hub-how-to-clone/iot-hub-upload-file.png)
328+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-upload-file.png" alt-text="Screenshot showing the command for uploading a template file":::
361329

362330
1. Browse for the new template you edited and select it, then select **Open**. It loads your template in the edit window. Select **Save**.
363331

364-
![Screenshot showing loading the template](./media/iot-hub-how-to-clone/iot-hub-loading-template.png)
332+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-uploaded-file.png" alt-text="Screenshot showing loading the template":::
333+
334+
1. Fill in the following fields on the custom deployment page.
335+
336+
**Subscription**: Select the subscription to use.
337+
338+
**Resource group**: Create a new resource group in a new location. If you already have one set up, you can select it instead of creating a new one.
365339

366-
1. Fill in the following fields.
340+
**Region**: If you selected an existing resource group, the region is filled in for you to match the location of the resource group. If you created a new resource group, this will be its location.
367341

368-
**Subscription**: select the subscription to use.
342+
**Connection string**: Fill in the connection string for your hub.
369343

370-
**Resource group**: create a new resource group in a new location. If you already have a new one set up, you can select it instead of creating a new one.
344+
**Hub name**: Give the new hub in the new region a name.
371345

372-
**Location**: If you selected an existing resource group, this is filled in for you to match the location of the resource group. If you created a new resource group, this will be its location.
346+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-custom-deployment-create.png" alt-text="Screenshot showing the custom deployment page":::
373347

374-
**I agree checkbox**: this basically says that you agree to pay for the resource(s) you're creating.
348+
1. Select the **Review + create** button.
375349

376-
1. Select the **Purchase** button.
350+
1. Select the **Create** button. The portal validates your template and deploys your cloned hub. If you have routing configuration data, it will be included in the new hub, but will point at the resources in the prior location.
377351

378-
The portal now validates your template and deploys your cloned hub. If you have routing configuration data, it will be included in the new hub, but will point at the resources in the prior location.
352+
:::image type="content" source="./media/iot-hub-how-to-clone/iot-hub-custom-deployment-final.png" alt-text="Screenshot showing the final custom deployment page":::
379353

380354
## Managing the devices registered to the IoT hub
381355

45 KB
Loading
66.1 KB
Loading
1.34 KB
Loading
4.45 KB
Loading
3.22 KB
Loading
6.59 KB
Loading
63.4 KB
Loading

0 commit comments

Comments
 (0)