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-hub/migrate-hub-arm.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ author: kgremban
7
7
ms.author: kgremban
8
8
ms.service: iot-hub
9
9
ms.topic: how-to
10
-
ms.date: 03/24/2023
10
+
ms.date: 04/14/2023
11
11
---
12
12
13
13
# How to manually migrate an Azure IoT hub using an Azure Resource Manager template
@@ -31,14 +31,14 @@ The outcome of this article is similar to [How to automatically migrate an IoT h
31
31
32
32
* The manual process (this article):
33
33
34
-
* Migrates your device registry and your routing and endpoint information. You have to manually recreate additional configuration details in the new IoT hub.
34
+
* Migrates your device registry and your routing and endpoint information. You have to manually recreate other configuration details in the new IoT hub.
35
35
* Is faster for migrating large numbers of devices (for example, more than 100,000).
36
36
* Uses an Azure Storage account to transfer the device registry.
37
37
* Scrubs connection strings for routing and file upload endpoints from the ARM template output, and you need to manually add them back in.
38
38
39
39
* The Azure CLI process:
40
40
41
-
* Migrates your device registry, your routing and endpoint information, and additional configuration details like IoT Edge deployments or automatic device management configurations.
41
+
* Migrates your device registry, your routing and endpoint information, and other configuration details like IoT Edge deployments or automatic device management configurations.
42
42
* Is easier for migrating small numbers of devices (for example, up to 10,000).
43
43
* Doesn't require an Azure Storage account.
44
44
* Collects connection strings for routing and file upload endpoints and includes them in the ARM template output.
@@ -57,9 +57,9 @@ There are several things to consider before migrating an IoT hub.
57
57
58
58
* You can copy devices to the new hub without shutting down or changing the devices.
59
59
60
-
* If the devices were originally provisioned using DPS, update their enrollments to point to the new IoT hub. Then, re-provision the devices to update the connection information stored in each device.
60
+
* If the devices were originally provisioned using DPS, update their enrollments to point to the new IoT hub. Then, reprovision the devices to update the connection information stored in each device.
61
61
62
-
* Otherwise, you have to use the import/export method to move the devices, and then the devices have to be modified to use the new hub. For example, you can set up your device to consume the IoT Hub host name from the twin desired properties. The device will take that IoT Hub host name, disconnect the device from the old hub, and reconnect it to the new one.
62
+
* Otherwise, you have to use the import/export method to move the devices, and then the devices have to be modified to use the new hub. For example, you can set up your device to consume the IoT Hub host name from the twin desired properties. The device takes that IoT Hub host name, disconnect the device from the old hub, and reconnect it to the new one.
63
63
64
64
* You need to update any certificates so you can use them with the new resources. Also, you probably have the hub defined in a DNS table somewhere and need to update that DNS information.
65
65
@@ -257,13 +257,13 @@ You have to make some changes before you can use the template to create the new
257
257
258
258
#### Update the routing endpoint resources
259
259
260
-
When you export the Resource Manager template for a hub that has routing configured, you will see that the keys for those resources aren't 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.
260
+
When you export the Resource Manager template for a hub that has routing configured, you see that the keys for those resources aren't 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.
261
261
262
262
If you moved the routing resources as well, update the name, ID, and resource group of each endpoint as well.
263
263
264
264
1. Retrieve the keys required for any of the routing resources and put them in the template. You can retrieve the key(s) from the resource in the [Azure portal](https://portal.azure.com).
265
265
266
-
* For example, if you are routing messages to a storage container, find the storage account in the portal. Under the Settings section, select **Access keys**, then copy one of the keys. Here's what the key looks like when you first export the template:
266
+
* For example, if you're routing messages to a storage container, find the storage account in the portal. Under the Settings section, select **Access keys**, then copy one of the keys. Here's what the key looks like when you first export the template:
@@ -286,13 +286,13 @@ If you moved the routing resources as well, update the name, ID, and resource gr
286
286
287
287
## Create the new hub by loading the template
288
288
289
-
Create the new hub using the edited template. If you have routing resources that are going to move, the resources should be set up in the new location and the references in the template updated to match. If you are not moving the routing resources, they should be in the template with the updated keys.
289
+
Create the new hub using the edited template. If you have routing resources that are going to move, the resources should be set up in the new location and the references in the template updated to match. If you aren't moving the routing resources, they should be in the template with the updated keys.
290
290
291
291
1. Sign into the [Azure portal](https://portal.azure.com).
292
292
293
293
1. Select **Create a resource**.
294
294
295
-
1. In the search box, search for and select **template deployment (deploy using custom templates)**. This takes you to a screen for the template deployment. Select **Create**.
295
+
1. In the search box, search for and select **template deployment (deploy using custom templates)**. On the screen for the template deployment, select **Create**.
296
296
297
297
1. On the **Custom deployment** page, select **Build your own template in the editor**, which enables you to upload your template from a file.
298
298
@@ -312,7 +312,7 @@ Create the new hub using the edited template. If you have routing resources that
312
312
313
313
**Resource group**: Select an existing resource group or create a new one.
314
314
315
-
**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.
315
+
**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 is its location.
316
316
317
317
**Connection string**: Fill in the connection string for your hub.
318
318
@@ -322,7 +322,7 @@ Create the new hub using the edited template. If you have routing resources that
322
322
323
323
1. Select the **Review + create** button.
324
324
325
-
1. Select the **Create** button. The portal validates your template and deploys your new 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.
325
+
1. Select the **Create** button. The portal validates your template and deploys your new hub. If you have routing configuration data, it is included in the new hub, but points at the resources in the prior location.
326
326
327
327
:::image type="content" source="./media/migrate-hub-arm/iot-hub-custom-deployment-final.png" alt-text="Screenshot showing the final custom deployment page":::
328
328
@@ -334,19 +334,19 @@ There are multiple ways to copy the devices. You either originally used [Device
334
334
335
335
If you didn't use DPS to provision your devices, you can skip the next section and start with [Use Import/Export to move the devices to the new hub](#use-import-export-to-move-the-devices-to-the-new-hub).
336
336
337
-
## Use DPS to re-provision the devices in the new hub
337
+
## Use DPS to reprovision the devices in the new hub
338
338
339
-
To use DPS to move the devices to the new location, see [How to re-provision devices](../iot-dps/how-to-reprovision.md). When you're finished, you can view the devices in the [Azure portal](https://portal.azure.com) and verify they are in the new location.
339
+
To use DPS to move the devices to the new location, see [How to reprovision devices](../iot-dps/how-to-reprovision.md). When you're finished, you can view the devices in the [Azure portal](https://portal.azure.com) and verify they are in the new location.
340
340
341
-
Go to the new hub using the [Azure portal](https://portal.azure.com). Select your hub, then select **IoT Devices**. You see the devices that were re-provisioned to the new hub. You can also view the properties for the new hub.
341
+
Go to the new hub using the [Azure portal](https://portal.azure.com). Select your hub, then select **IoT Devices**. You see the devices that were reprovisioned to the new hub. You can also view the properties for the new hub.
342
342
343
343
If you have implemented routing, test and make sure your messages are routed to the resources correctly.
344
344
345
345
### Roll back the changes after using DPS
346
346
347
-
If you want to roll back the changes, re-provision the devices from the new hub to the old one.
347
+
If you want to roll back the changes, reprovision the devices from the new hub to the old one.
348
348
349
-
You are now finished migrating your hub and its devices. You can skip to [Clean-up](#clean-up).
349
+
You're now finished migrating your hub and its devices. You can skip to [Clean-up](#clean-up).
350
350
351
351
## Use import-export to move the devices to the new hub
352
352
@@ -360,19 +360,19 @@ The application targets .NET Core, so you can run it on either Windows or Linux.
360
360
361
361
1. To run the application, specify three connection strings and five options. You pass this data in as command-line arguments or use environment variables, or use a combination of the two. We're going to pass the options in as command line arguments, and the connection strings as environment variables.
362
362
363
-
The reason for this is because the connection strings are long and ungainly, and unlikely to change, but you might want to change the options and run the application more than once. To change the value of an environment variable, you have to close the command window and Visual Studio or Visual Studio Code, whichever you are using.
363
+
The reason for this is because the connection strings are long and ungainly, and unlikely to change, but you might want to change the options and run the application more than once. To change the value of an environment variable, you have to close the command window and Visual Studio or Visual Studio Code, whichever you're using.
364
364
365
365
### Options
366
366
367
-
Here are the five options you specify when you run the application. We'll put these on the command line in a minute.
367
+
Here are the five options you specify when you run the application:
368
368
369
-
* **addDevices** (argument 1) -- set this to true if you want to add virtual devices that are generated for you. These are added to the source hub. Also, set **numToAdd** (argument 2) to specify how many devices you want to add. The maximum number of devices you can register to a hub is one million. The purpose of this option is for testing. You can generate a specific number of devices, and then copy them to another hub.
369
+
* **addDevices** (argument 1) - set this option to `True` if you want to add virtual devices that are generated for you. These devices are added to the source hub. Also, set **numToAdd** (argument 2) to specify how many devices you want to add. The maximum number of devices you can register to a hub is one million. The purpose of this option is for testing. You can generate a specific number of devices, and then copy them to another hub.
370
370
371
-
* **copyDevices** (argument 3) -- set this to true to copy the devices from one hub to another.
371
+
* **copyDevices** (argument 3) - set this option to `True` to copy the devices from one hub to another.
372
372
373
-
* **deleteSourceDevices** (argument 4) -- set this to true to delete all of the devices registered to the source hub. We recommend waiting until you are certain all of the devices have been transferred before you run this. Once you delete the devices, you can't get them back.
373
+
* **deleteSourceDevices** (argument 4) - set this option to `True` to delete all of the devices registered to the source hub. We recommend waiting until you are certain all of the devices have been transferred before you run this. Once you delete the devices, you can't get them back.
374
374
375
-
* **deleteDestDevices** (argument 5) -- set this to true to delete all of the devices registered to the destination hub. You might want to do this if you want to copy the devices more than once.
375
+
* **deleteDestDevices** (argument 5) - set this option to `True` to delete all of the devices registered to the destination hub. You might want to do this if you want to copy the devices more than once.
376
376
377
377
The basic command is *dotnet run*, which tells .NET to build the local csproj file and then run it. You add your command-line arguments to the end before you run it.
378
378
@@ -396,7 +396,7 @@ Your command-line will look like these examples:
396
396
397
397
1. To get the connection string values, sign in to the [Azure portal](https://portal.azure.com).
398
398
399
-
1. Put the connection strings somewhere you can retrieve them, such as NotePad. If you copy the following, you can paste the connection strings in directly where they go. Don't add spaces around the equal sign, or it changes the variable name. Also, you don't need double-quotes around the connection strings. If you put quotes around the storage account connection string, it won't work.
399
+
1. Put the connection strings somewhere you can retrieve them, such as NotePad. If you copy the following, you can paste the connection strings in directly where they go. Don't add spaces around the equal sign, or it changes the variable name. Also, you don't need double-quotes around the connection strings. If you put quotes around the storage account connection string, the script fails.
400
400
401
401
Set the environment variables in Windows:
402
402
@@ -437,7 +437,7 @@ Now you have the environment variables in a file with the SET commands, and you
437
437
dotnet run arg1 arg2 arg3 arg4 arg5
438
438
```
439
439
440
-
The dotnet command builds and runs the application. Because you are passing in the options when you run the application, you can change the values of them each time you run the application. For example, you may want to run it once and create new devices, then run it again and copy those devices to a new hub, and so on. You can also perform all the steps in the same run, although we recommend not deleting any devices until you are certain you are finished with the migration. Here is an example that creates 1000 devices and then copies them to the other hub.
440
+
The dotnet command builds and runs the application. Because you're passing in the options when you run the application, you can change the values of them each time you run the application. For example, you may want to run it once and create new devices, then run it again and copy those devices to a new hub, and so on. You can also perform all the steps in the same run, although we recommend not deleting any devices until you're certain you're finished with the migration. Here's an example that creates 1000 devices and then copies them to the other hub.
441
441
442
442
``` console
443
443
// Format: dotnet run add-devices num-to-add copy-devices delete-source-devices delete-destination-devices
@@ -510,7 +510,7 @@ If you decide to roll back the changes, here are the steps to perform:
510
510
511
511
* Update each device to change the IoT Hub Hostname to point the IoT Hub Hostname for the old hub. You should do this using the same method you used when you first provisioned the device.
512
512
513
-
* Change any applications you have that refer to the new hub to point to the old hub. For example, if you are using Azure Analytics, you may need to reconfigure your [Azure Stream Analytics input](../stream-analytics/stream-analytics-define-inputs.md#stream-data-from-iot-hub).
513
+
* Change any applications you have that refer to the new hub to point to the old hub. For example, if you're using Azure Analytics, you may need to reconfigure your [Azure Stream Analytics input](../stream-analytics/stream-analytics-define-inputs.md#stream-data-from-iot-hub).
514
514
515
515
* Delete the new hub.
516
516
@@ -524,7 +524,7 @@ If you have implemented routing, test and make sure your messages are routed to
524
524
525
525
## Clean up
526
526
527
-
Don't clean up until you are certain the new hub is up and running and the devices are working correctly. Also be sure to test the routing if you are using that feature. When you're ready, clean up the old resources by performing these steps:
527
+
Don't clean up until you're certain the new hub is up and running and the devices are working correctly. Also be sure to test the routing if you're using that feature. When you're ready, clean up the old resources by performing these steps:
528
528
529
529
* If you haven't already, delete the old hub. This removes all of the active devices from the hub.
0 commit comments