Skip to content

Commit 42fc157

Browse files
author
Ankita Dutta
committed
new doc
1 parent 0496c48 commit 42fc157

File tree

2 files changed

+82
-40
lines changed

2 files changed

+82
-40
lines changed

articles/site-recovery/tutorial-replicate-vms-edge-zone-to-azure-region.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article describes how to replicate, failover, and failback Azu
44
author: ankitaduttaMSFT
55
ms.service: azure-site-recovery
66
ms.topic: tutorial
7-
ms.date: 12/11/2024
7+
ms.date: 12/18/2024
88
ms.author: ankitadutta
99

1010
---
@@ -13,6 +13,9 @@ ms.author: ankitadutta
1313

1414
This article describes how to replicate, failover, and failback Azure virtual machines (VMs) running on an Azure Extended Zone to its parent Azure region.
1515

16+
> [!IMPORTANT]
17+
> The Azure Site Recovery functionality for Extended Zones is in preview state.
18+
1619
## Disaster recovery in Azure Extended Zone
1720

1821
Site Recovery ensures business continuity by keeping workloads running during outages by continuously replicating the workload from a primary to a secondary location. The ASR functionality for Extended Zones is in preview.

articles/site-recovery/tutorial-replicate-vms-extended-zones-to-another-zone.md

Lines changed: 78 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
---
2-
title: Set up disaster recovery to another Public MEC using PowerShell
3-
description: This article describes how to replicate, failover, and failback Azure virtual machines (VMs) running an Azure Public MEC (in preview for ASR functionality) to another Public MEC connected to the same parent region.
2+
title: Set up disaster recovery to another Extended Zones using PowerShell
3+
description: This article describes how to replicate, failover, and failback Azure virtual machines (VMs) running an Azure Extended Zone (in preview for ASR functionality) to another Extended Zone connected to the same parent region.
44
author: ankitaduttaMSFT
55
ms.service: azure-site-recovery
66
ms.topic: tutorial
7-
ms.date: 12/14/2022
7+
ms.date: 12/18/2024
88
ms.author: ankitadutta
99
---
1010

11-
# Replicate virtual machines running in an Azure Public MEC to another Azure Public MEC in the same region
11+
# Replicate virtual machines running in an Azure Extended Zones to another Azure Extended Zones in the same region
1212

1313
> [!IMPORTANT]
14-
> The Azure Site Recovery functionality for Public MEC is in preview state.
15-
This article describes how to replicate, failover, and failback Azure virtual machines (VMs) running an Azure Public MEC to another Azure Public MEC connected to the same parent region.
14+
> The Azure Site Recovery functionality for Extended Zones is in preview state.
1615
17-
Azure Public MECs are fully managed solution deployed close to your data center and includes hardware, services, and support.
16+
This article describes how to replicate, failover, and failback Azure virtual machines (VMs) running an Azure Extended Zones to another Azure Extended Zones connected to the same parent region.
1817

19-
## Disaster recovery in Azure Public MEC
18+
Azure Extended Zones are fully managed solution deployed close to your data center and includes hardware, services, and support.
19+
20+
## Disaster recovery in Azure Extended Zones
2021

2122
Site Recovery ensures business continuity by keeping workloads running during outages by continuously replicating the workload from primary to secondary location. The ASR functionality for MEC is in preview.
2223

23-
Here the primary location is an Azure Public MEC and secondary location is another Azure Public MEC connected to the same parent region.
24+
Here the primary location is an Azure Extended Zones and secondary location is another Azure Extended Zones connected to the same parent region.
2425

25-
## Set up disaster recovery for VMs in an Azure Public MEC using PowerShell
26+
## Set up disaster recovery for VMs in an Azure Extended Zones using PowerShell
2627

2728
### Prerequisites
2829

@@ -32,34 +33,43 @@ Here the primary location is an Azure Public MEC and secondary location is anoth
3233
```
3334
Get-InstalledModule -Name Az
3435
```
36+
3537
- Ensure the Linux distro version and kernel is supported by Azure Site Recovery. For more information, see the [support matrix](./azure-to-azure-support-matrix.md#linux).
3638
- Ensure the primary VM has a public IP. To validate, go to the VM NIC and check if public IP is attached to the NIC. Ensure that recovery VM has a public IP when you switch to protection direction.
39+
3740
>[!Note]
3841
>Azure Site Recovery doesn’t re-create the public IP, so it's important to check the availability of the public IP and that it is attached to the NIC before you switch to protection direction from recovery to primary.
39-
## Replicate Virtual machines running in an Azure Public MEC to another Azure Public MEC
40-
To replicate VMs running in a Public MEC to another Azure Public MEC, follow these steps:
42+
43+
## Replicate Virtual machines running in an Azure Extended Zones to another Azure Extended Zones
44+
45+
To replicate VMs running in a Extended Zones to another Azure Extended Zones, follow these steps:
46+
4147
> [!NOTE]
42-
> For this example, the primary location is an Azure Public MEC, and the secondary/recovery location is another Azure Public MEC connected to the same region.
48+
> For this example, the primary location is an Azure Extended Zones, and the secondary/recovery location is another Azure Extended Zones connected to the same region.
49+
4350
1. Sign-in to your Azure account.
4451
```
4552
Connect-AzAccount
4653
```
54+
4755
1. Select Right subscription.
4856
```
4957
$subscription = Get-AzSubscription -SubscriptionName "<SubscriptionName>"
5058
Set-AzContext $subscription.Id
5159
$targetEdgeZoneName = “microsoftrrdclab3”
5260
```
61+
5362
1. Get the details of the virtual machine that you plan to replicate.
5463
```
5564
$VM = Get-AzVM -ResourceGroupName "<ResourceGroupName>" -Name "<VMName>"
5665
5766
$sourceEdgeZoneName = $VM.ExtendedLocation.Name
5867
Write-Output $VM
5968
```
69+
6070
1. Create a resource group for the recovery services vault in the secondary Azure region.
6171
```
62-
New-AzResourceGroup -Name "edgezonerecoveryrg" -Location "<EdgeZoneRegion>"
72+
New-AzResourceGroup -Name "edgezonerecoveryrg" -Location "<AzureRegion>"
6373
```
6474
6575
1. Create a new Recovery services vault in the secondary region.
@@ -69,13 +79,16 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
6979
ResourceGroupName "edgezonerecovery" -Location "\<EdgeZoneRegion\>"
7080
Write-Output $vault
7181
```
82+
7283
1. Set the vault context.
7384
```
7485
Set-AzRecoveryServicesAsrVaultContext -Vault $vault
7586
```
87+
88+
7689
1. Create Primary Site Recovery fabric.
7790
```
78-
$TempASRJob = New-AzRecoveryServicesAsrFabric -Azure -Location “<EdgeZoneRegion>” -
91+
$TempASRJob = New-AzRecoveryServicesAsrFabric -Azure -Location “<AzureRegion>” -
7992
Name "EdgeZoneFabric"
8093
```
8194
@@ -154,6 +167,7 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
154167
```
155168
156169
1. Track Job status to check for completion.
170+
157171
```
158172
while (($TempASRJob.State -eq "InProgress") -or ($TempASRJob.State -eq
159173
"NotStarted")){
@@ -170,7 +184,9 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
170184
$EdgeZoneToAzurePCMapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -
171185
ProtectionContainer $PrimaryProtectionContainer -Name "PrimaryToRecovery"
172186
```
187+
173188
1. Create a protection container mapping for failback, between the recovery and primary protection containers with the Replication policy.
189+
174190
```
175191
$TempASRJob = New-AzRecoveryServicesAsrProtectionContainerMapping -Name
176192
"RecoveryToPrimary" -Policy $ReplicationPolicy -PrimaryProtectionContainer
@@ -179,13 +195,13 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
179195
```
180196
181197
1. Track Job status to check for completion.
182-
```
183-
while (($TempASRJob.State -eq "InProgress") -or ($TempASRJob.State -eq
184-
"NotStarted")){
198+
```
199+
while (($TempASRJob.State -eq "InProgress") -or ($TempASRJob.State -eq
200+
"NotStarted")){
185201
sleep 10;
186202
$TempASRJob = Get-AzRecoveryServicesAsrJob -Job $TempASRJob
187-
}
188-
```
203+
}
204+
```
189205
190206
1. On successful completion, the job state must be **Succeeded**.
191207
@@ -194,35 +210,41 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
194210
$AzureToEdgeZonePCMapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -
195211
ProtectionContainer $RecoveryProtectionContainer -Name "RecoveryToPrimary"
196212
```
213+
197214
1. Create a cache storage account for replication logs in the primary region. The cache storage account is created in the primary region.
198-
You can use **Local cache** (cache in the Public MEC) or **Remote cache** (cache in Azure).
215+
You can use **Local cache** (cache in the Extended Zone) or **Remote cache** (cache in Azure).
199216
200217
In this example, remote cache is used but there is no difference between them in terms of PowerShell commands. ARM ID of the cache storage account we provide to `New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig` is the only difference.
218+
201219
```
202220
$CacheStorageAccount = New-AzStorageAccount -Name "cachestorage" -ResourceGroupName
203-
"<primary ResourceGroupName>" -Location '<EdgeZoneRegion>' -SkuName Standard_LRS -
221+
"<primary ResourceGroupName>" -Location '<AzureRegion>' -SkuName Standard_LRS -
204222
Kind Storage
205223
```
224+
206225
```
207226
$CacheStorageAccount = New-AzStorageAccount -Name "cachestorage" -ResourceGroupName
208-
"<primary ResourceGroupName>" -Location '<EdgeZoneRegion>' -SkuName Standard_LRS -
227+
"<primary ResourceGroupName>" -Location '<AzureRegion>' -SkuName Standard_LRS -
209228
Kind Storage
210229
```
230+
211231
1. Ensure to create a virtual network in the target location. Create a Recovery Network in the recovery region.
212232
213233
```
214234
$recoveryVnet = New-AzVirtualNetwork -Name "recoveryvnet" -ResourceGroupName
215-
"recoveryrg" -Location '<EdgeZoneRegion>' -AddressPrefix "10.0.0.0/16" -EdgeZone $targetEdgeZoneName
235+
"recoveryrg" -Location '<AzureRegion>' -AddressPrefix "10.0.0.0/16" -EdgeZone $targetEdgeZoneName
216236
Add-AzVirtualNetworkSubnetConfig -Name "defaultsubnetconf" -VirtualNetwork
217237
$recoveryVnet -AddressPrefix "10.0.0.0/24" | Set-AzVirtualNetwork
218238
$recoveryNetwork = $recoveryVnet.Id
219239
```
220-
1. Use the following PowerShell cmdlet to replicate an Azure Public MECs Azure virtual machine with managed disks. This step may take around 20 minutes to complete.
240+
241+
1. Use the following PowerShell cmdlet to replicate an Azure Extended Zones Azure virtual machine with managed disks. This step may take around 20 minutes to complete.
221242
1. Get the resource group that the virtual machine must be created in when it's failed
222243
over.
244+
223245
```
224246
$RecoveryRG = Get-AzResourceGroup -Name "edgezonerecoveryrg" -Location "
225-
<EdgeZoneRegion>"
247+
<AzureRegion>"
226248
```
227249
228250
1. Get VM and display contents.
@@ -246,11 +268,12 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
246268
RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
247269
-RecoveryTargetDiskAccountType $RecoveryOSDiskAccountType
248270
```
271+
249272
1. Data disk
250-
1. If VM has data disk, use the following command to create disk configuration. If not,
251-
you can skip this section. From `$datadiskId` to `$DataDisk1ReplicationConfig $datadiskId = $vm.StorageProfile.OSDisk.ManagedDisk.Id`.
273+
1. If VM has data disk, use the following command to create disk configuration. If not, you can skip this section. From `$datadiskId` to `$DataDisk1ReplicationConfig $datadiskId = $vm.StorageProfile.OSDisk.ManagedDisk.Id`.
252274
253-
Alternatively,
275+
Alternatively, use:
276+
254277
```
255278
$RecoveryReplicaDiskAccountType = "Premium_LRS"
256279
$RecoveryTargetDiskAccountType = "Premium_LRS"
@@ -286,15 +309,11 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
286309
```
287310
Write-Output $TempASRJob.State
288311
```
312+
289313
1. After the operation to start replication succeeds, virtual machine data is replicated to the recovery region.
290314
291315
Initially, when the replication process starts, it creates a copy of the replicating disks of the virtual machine in the recovery region. This phase is called the initial replication phase. This step takes around 20 minutes. See the status of the replication in the Vault blade under **Replicated items**.
292316
293-
:::image type="Replicated items" source="./media/tutorial-replicate-vms-edge-zone-to-another-zone/replicated-items.png" alt-text="Screenshot of replicated items.":::
294-
When the replication is completed, the Vault replication items will show as below:
295-
296-
:::image type="Vault replication" source="./media/tutorial-replicate-vms-edge-zone-to-another-zone/vault-replication.png" alt-text="Screenshot of Vault replication.":::
297-
298317
Now the virtual machine is protected, and you can perform a test failover operation. The replication state of the replicated item that represents the virtual machine goes to the protected state after initial replication completes.
299318
300319
Monitor the replication state and replication health for the virtual machine by getting details of the replication protected item that corresponds to it:
@@ -308,13 +327,12 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
308327
309328
If you see **Protected** in the *ProtectionState*, you are ready to proceed to test failover.
310329
311-
:::image type="Protection state" source="./media/tutorial-replicate-vms-edge-zone-to-another-zone/protection-state.png" alt-text="Screenshot of Protection state.":::
312330
1. Perform, validate, and clean up a test failover. You can skip the Test failover. However, we recommend executing test failover to ensure that your secondary region comes up as expected.
313331
1. Create a separate network for test failover (not connected to my DR network).
314332
315333
```
316334
$TFOVnet = New-AzVirtualNetwork -Name "TFOvnet" -ResourceGroupName "edgezonerecoveryrg"
317-
-Location '<EdgeZoneRegion>' -AddressPrefix "10.3.0.0/26"
335+
-Location '<AzureRegion>' -AddressPrefix "10.3.0.0/26"
318336
319337
Add-AzVirtualNetworkSubnetConfig -Name "default" -VirtualNetwork $TFOVnet -AddressPrefix
320338
"10.3.0.0/26" | Set-AzVirtualNetwork
@@ -343,26 +361,34 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
343361
```
344362
345363
1. Wait for the test failover to complete.
364+
346365
```
347366
Get-AzRecoveryServicesAsrJob -Job $TFOJob
348367
```
368+
349369
>[!NOTE]
350370
>To check the progress, go to the portal, select the vault and then select the Site Recovery Jobs.
371+
351372
After the test failover job completes successfully, you can connect to the test failed over virtual machine and validate the test failover. Once testing is complete on the test failed over virtual machine, clean up the test copy by starting the cleanup test failover operation. This operation deletes the test copy of the virtual machine that was created by the test failover.
352373
Verify that all the target settings are right in the test failover VM including location, network setting, no data corruption, and no data is lost in the target VM. Now you can delete the test failover and start the failover.
374+
353375
```
354376
$Job_TFOCleanup = Start-AzRecoveryServicesAsrTestFailoverCleanupJob -
355377
ReplicationProtectedItem $ReplicationProtectedItem
356378
Get-AzRecoveryServicesAsrJob -Job $Job_TFOCleanup | Select State
357379
```
380+
358381
1. Next step would be to fail over the virtual machine. This step will create the VM using the replicated disks in recovery region.
382+
359383
```
360384
$ReplicationProtectedItem = Get-AzRecoveryServicesAsrReplicationProtectedItem -
361385
FriendlyName "<VMName>" -ProtectionContainer $PrimaryProtectionContainer
362386
$RecoveryPoints = Get-AzRecoveryServicesAsrRecoveryPoint -ReplicationProtectedItem
363387
$ReplicationProtectedItem
364388
```
389+
365390
The list of recovery points returned may not be sorted chronologically. You need to sort these first to find the oldest or the latest recovery points for the virtual machine.
391+
366392
```
367393
"{0} {1}" -f $RecoveryPoints[0].RecoveryPointType, $RecoveryPoints[-
368394
1].RecoveryPointTime
@@ -381,11 +407,14 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
381407
"NotStarted"))
382408
$Job_Failover.State
383409
```
410+
384411
1. When the failover job is successful, you can commit the failover.
412+
385413
```
386414
$CommitFailoverJob = Start-AzRecoveryServicesAsrCommitFailoverJob -
387415
ReplicationProtectedItem $ReplicationProtectedItem
388416
```
417+
389418
1. Wait until commit failover job is finished.
390419
391420
```
@@ -396,6 +425,7 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
396425
}
397426
Get-AzRecoveryServicesAsrJob -Job $CommitFailoverJOb
398427
```
428+
399429
1. After a failover, when you're ready to go back to the original region, start reverse replication for the replication protected item using the `Update-AzRecoveryServicesAsrProtectionDirection` cmdlet.
400430
1. Create Cache storage account for replication logs in the recovery region.
401431
@@ -405,7 +435,7 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
405435
Standard_LRS -Kind Storage
406436
```
407437
408-
1. Use the recovery protection container, the new cache storage account in Azure Public MECs region, and the source region VM resource group.
438+
1. Use the recovery protection container, the new cache storage account in Azure Extended Zoness region, and the source region VM resource group.
409439
410440
```
411441
$ReplicationProtectedItem = Get-AzRecoveryServicesAsrReplicationProtectedItem -
@@ -418,14 +448,23 @@ To replicate VMs running in a Public MEC to another Azure Public MEC, follow the
418448
-LogStorageAccountId $EdgeZoneCacheStorageAccount.Id `
419449
-RecoveryResourceGroupID $sourceVMResourcegroupId
420450
```
451+
421452
This step takes ~20 minutes and the status will move from **In progress** to **Successful**.
422-
:::image type="Protected items list" source="media/tutorial-replicate-vms-edge-zone-to-another-zone/protected-items-inline.png" alt-text="Screenshot of Protected items list." lightbox="media/tutorial-replicate-vms-edge-zone-to-another-zone/protected-items-expanded.png":::
453+
423454
1. Disable replication.
455+
424456
```
425457
Remove-AzRecoveryServicesAsrReplicationProtectedItem -ReplicationProtectedItem
426458
$ReplicationProtectedItem
427459
```
460+
428461
1. Clean the environment. This step is optional and can be used to remove the resource group.
462+
429463
```
430464
Remove-AzResourceGroup -Name $Name -Force
431-
```
465+
```
466+
467+
## Next steps
468+
469+
- View the [Azure Site Recovery PowerShell reference](https://learn.microsoft.com/powershell/module/az.recoveryservices/?view=azps-13.0.0) to learn how you can create recovery plans, perform failovers, and failbacks with PowerShell.
470+
- Learn how to [Set up disaster recovery for Azure VMs using the Azure PowerShell](../azure-to-azure-powershell.md).

0 commit comments

Comments
 (0)