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
# Move DevTest Labs and schedules to another region
12
12
13
-
To move a lab, create a copy of an existing lab in another region.
13
+
You can move DevTest Labs and their associated schedules to another reason. To move a lab, create a copy of an existing lab in another region. When you've moved your lab, and you have a virtual machine (VM) in the target region, you can move your lab schedules.
14
14
15
15
In this article, you learn how to:
16
16
> [!div class="checklist"]
@@ -20,6 +20,7 @@ In this article, you learn how to:
20
20
> - Deploy the template to create the new lab in the target region.
21
21
> - Configure the new lab.
22
22
> - Move data to the new lab.
23
+
> - Move schedules to the new lab.
23
24
> - Delete the resources in the source region.
24
25
25
26
## Prerequisites
@@ -34,23 +35,41 @@ In this article, you learn how to:
34
35
- the Stored Secrets
35
36
- PAT tokens of the private Artifact Repos to move the private repos together with the lab.
36
37
37
-
## Prepare to move
38
+
- When moving a lab schedule, ensure a Compute VM exists in the target region.
38
39
39
-
To get started, export and modify a Resource Manager template.
40
+
## Move a lab
41
+
42
+
The following section describes how to create and customize an ARM template to move a lab from one region to another.
43
+
44
+
You can move a schedule without moving a lab, if you have a VM in the target region. If you want to move a schedule without moving a lab, see [Move a schedule](#move-a-schedule).
45
+
46
+
### Prepare to move a lab
40
47
41
-
### Prepare your Virtual Network
48
+
When you move a lab, there are some steps you must take to prepare for the move. You need to:
49
+
50
+
- Prepare the virtual network
51
+
- Export an ARM template of the lab
52
+
- Modify the template
53
+
- Deploy the template to move the lab
54
+
- Configure the new lab
55
+
- Swap the OS disks of the Compute VMs under the new VMs
56
+
- Clean up the original lab
57
+
58
+
#### Prepare the Virtual Network
59
+
60
+
To get started, export and modify a Resource Manager template.
42
61
43
62
1. Sign in to the [Azure portal](https://portal.azure.com).
44
63
45
64
1. If you don't have [Resource Group](../azure-resource-manager/management/manage-resource-groups-portal.md#create-resource-groups) under the target region, create one now.
46
65
47
-
1. Move your current Virtual Network to the new region and resource group using the steps included in the article, "[Move an Azure virtual network to another region](../virtual-network/move-across-regions-vnet-portal.md)".
66
+
1. Move the current Virtual Network to the new region and resource group using the steps included in the article, "[Move an Azure virtual network to another region](../virtual-network/move-across-regions-vnet-portal.md)".
48
67
49
68
Alternately, you can create a new virtual network, if you don't have to keep the original one.
50
69
51
-
### Export an ARM template of your lab.
70
+
####Export an ARM template of the lab
52
71
53
-
Next, you export a JSON template contains settings that describe your lab.
72
+
Next, you export a JSON template contains settings that describe the lab.
54
73
55
74
To export a template by using Azure portal:
56
75
@@ -64,7 +83,7 @@ To export a template by using Azure portal:
64
83
65
84
This zip file contains the .json files that comprise the template and scripts to deploy the template. It contains all the resources under your lab listed in ARM template format, except for the Shared Image Gallery resources.
66
85
67
-
### Modify the template
86
+
####Modify the template
68
87
69
88
In order for the ARM template to deploy correctly in the new region, you must change a few parts of the template.
70
89
@@ -75,8 +94,8 @@ To update the template by using Azure portal:
75
94
1. In **Search the Marketplace**, type **template deployment**, and then press **ENTER**.
:::image type="content" source="./media/how-to-move-labs/azure-resource-manager-template-library.png" alt-text="Screenshot that shows the Azure Marketplace with template deployment selected.":::
80
99
81
100
1. Select **Create**.
82
101
@@ -123,7 +142,7 @@ To update the template by using Azure portal:
123
142
}
124
143
```
125
144
126
-
1. Find the `"type": "microsoft.devtestlab/labs/virtualnetworks"` resource. If you created a new virtual network earlier in these steps, you must add the actual subnet name in `/subnets/[SUBNET_NAME]`. If you chose to move the Vnet to a new region, you should skip this step.
145
+
1. Find the `"type": "microsoft.devtestlab/labs/virtualnetworks"` resource. If you created a new virtual network earlier in these steps, you must add the actual subnet name in `/subnets/[SUBNET_NAME]`. If you chose to move the virtual network to a new region, you should skip this step.
127
146
128
147
1. Find the `"type": "microsoft.devtestlab/labs/virtualmachines"` resource.
129
148
@@ -180,7 +199,7 @@ To update the template by using Azure portal:
180
199
181
200
1. In the editor, save the template.
182
201
183
-
## Deploy to move
202
+
### Deploy the template to move the lab
184
203
185
204
Deploy the template to create a new lab in the target region.
186
205
@@ -203,14 +222,14 @@ Deploy the template to create a new lab in the target region.
203
222
204
223
1. Select the bell icon (notifications) from the top of the screen to see the deployment status. You shall see **Deployment in progress**. Wait until the deployment is completed.
205
224
206
-
### Configure the new lab
225
+
#### Configure the new lab
207
226
208
227
While most Lab resources have been replicated under the new region using the ARM template, a few edits still need to be moved manually.
209
228
210
229
1. Add the Compute Gallery back to the lab if there are any in the original one.
211
230
1. Add the policies "Virtual machines per user", "Virtual machines per lab" and "Allowed Virtual machine sizes" back to the moved lab
212
231
213
-
### Swap the OS disks of the Compute VMs under the new VMs.
232
+
#### Swap the OS disks of the Compute VMs under the new VMs
214
233
215
234
Note the VMs under the new Lab have the same specs as the ones under the old Lab. The only difference is their OS Disks.
216
235
@@ -247,9 +266,55 @@ Note the VMs under the new Lab have the same specs as the ones under the old Lab
247
266
248
267
1. Swap the OS disk of the Compute VM under the new lab with the new disk. To learn how, see the article, "[Change the OS disk used by an Azure VM using PowerShell](../virtual-machines/windows/os-disk-swap.md)".
249
268
269
+
## Move a schedule
270
+
271
+
There are two ways to move a schedule:
272
+
273
+
- Manually recreate the schedules on the moved VMs. This process can be time consuming and error prone. This approach is most useful when you have a few schedules and VMs.
274
+
- Export and redeploy the schedules by using ARM templates.
275
+
276
+
Use the following steps to export and redeploy your schedule in another Azure region by using an ARM template:
277
+
278
+
1. Sign in to the [Azure portal](https://portal.azure.com).
279
+
280
+
2. Go to the source resource group that held your VMs.
281
+
282
+
3. On the **Resource Group Overview** page, under **Resources**, select **Show hidden types**.
283
+
284
+
4. Select all resources with the type **microsoft.devtestlab/schedules**.
285
+
286
+
5. Select **Export template**.
287
+
288
+
:::image type="content" source="./media/how-to-move-labs/move-compute-schedule.png" alt-text="Screenshot that shows the hidden resources in a resource group, with schedules selected.":::
289
+
290
+
6. On the **Export resource group template** page, select **Deploy**.
291
+
292
+
7. On the **Custom deployment** page, select **Edit template**.
293
+
294
+
8. In the template code, change all instances of `"location": "<old location>"` to `"location": "<new location>"` and then select **Save**.
295
+
296
+
9. On the **Custom deployment** page, enter values that match the target VM:
297
+
298
+
|Name|Value|
299
+
|----|----|
300
+
|**Subscription**|Select an Azure subscription.|
301
+
|**Resource group**|Select the resource group name. |
302
+
|**Region**|Select a location for the lab schedule. For example, **Central US**. |
303
+
|**Schedule Name**|Must be a globally unique name. |
304
+
|**VirtualMachine_xxx_externalId**|Must be the target VM. |
305
+
306
+
:::image type="content" source="./media/how-to-move-labs/move-schedule-custom-deployment.png" alt-text="Screenshot that shows the custom deployment page, with new location values for the relevant settings.":::
307
+
308
+
>[!IMPORTANT]
309
+
>Each schedule must have a globally unique name; you will need to change the schedule name for the new location.
310
+
311
+
10. Select **Review and create** to create the deployment.
312
+
313
+
11. When the deployment is complete, verify that the new schedule is configured correctly on the new VM.
314
+
250
315
## Discard or clean up
251
316
252
-
After the deployment, if you want to start over, you can delete the target lab, and repeat the steps described in the [Prepare](#prepare-to-move) and [Move](#deploy-to-move) sections of this article.
317
+
After the deployment, if you want to start over, you can delete the target lab, and repeat the steps described in the [Prepare](#prepare-to-move-a-lab) and [Move](#deploy-the-template-to-move-the-lab) sections of this article.
253
318
254
319
To commit the changes and complete the move, you must delete the original lab.
255
320
@@ -261,10 +326,11 @@ To remove a lab by using the Azure portal:
261
326
262
327
1. Select **Delete**, and confirm.
263
328
329
+
You can also choose to clean up the original schedules if they're no longer used. Go to the original schedule resource group (where you exported templates from in step 5 above) and delete the schedule resource.
330
+
264
331
## Next steps
265
332
266
333
In this article, you moved DevTest Labs from one region to another and cleaned up the source resources. To learn more about moving resources between regions and disaster recovery in Azure, refer to:
267
334
268
335
- [Move resources to a new resource group or subscription](../azure-resource-manager/management/move-resource-group-and-subscription.md)
269
-
- [Move Azure VMs to another region](../site-recovery/azure-to-azure-tutorial-migrate.md)
270
-
- [Move Microsoft.DevtestLab/schedules to another region](./how-to-move-schedule-to-new-region.md)
336
+
- [Move Azure VMs to another region](../site-recovery/azure-to-azure-tutorial-migrate.md)
0 commit comments