Skip to content

Commit 5a4d2e7

Browse files
committed
Adding platform fault domain and avzone support
1 parent 18da2aa commit 5a4d2e7

File tree

9 files changed

+133
-9
lines changed

9 files changed

+133
-9
lines changed

src/RecoveryServices/RecoveryServices.SiteRecovery.Management.Sdk/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ payload-flattening-threshold: 2
2323
2424
###
2525
``` yaml
26-
commit: 203d98d48deb3c3daead3101d106a1977eba2453
26+
commit: 511060cc81ed358bd4a8be701f7bdf4196a440e2
2727
input-file:
28-
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2024-10-01/service.json
28+
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-08-01/service.json
2929

3030
output-folder: Generated
3131

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/A2ATestsHelper.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ function getClusterName{
183183
return "powershell-cluster";
184184
}
185185

186+
function getPlatformFaultDomain
187+
{
188+
return 0
189+
}
190+
191+
function getPlatformUpdateDomain1
192+
{
193+
return 1
194+
}
195+
186196
function Get-RandomSuffix(
187197
[int] $size = 8)
188198
{

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,8 @@ function Test-VMSSReplication {
19311931
$recMappingName = getRecoveryContainerMapping
19321932
$primaryNetMapping = getPrimaryNetworkMapping
19331933
$recoveryNetMapping = getRecoveryNetworkMapping
1934+
$platformFaultDomain = getPlatformDomain
1935+
$platformFaultDomain1 = getPlatformDomain1
19341936

19351937
#create recovery side resources
19361938
$recRgName = getRecoveryResourceGroupName
@@ -1941,7 +1943,7 @@ function Test-VMSSReplication {
19411943
$recRg = $RecoveryAzureNetworkId.Substring(0, $index)
19421944
#create virtual Machine scale set
19431945
$stnd = "Standard"
1944-
$vmssConfig = New-AzVmssConfig -Location $recoveryLocation -PlatformFaultDomainCount 1 -SinglePlacementGroup 0 -SecurityType $stnd
1946+
$vmssConfig = New-AzVmssConfig -Location $recoveryLocation -PlatformFaultDomainCount 2 -SinglePlacementGroup 0 -SecurityType $stnd
19451947
$recVmss = new-azvmss -resourcegroupname $recRgName -vmscalesetname 'vmss-asr' -virtualmachinescaleset $vmssConfig
19461948
$recVmss1 = new-azvmss -resourcegroupname $recRgName -vmscalesetname 'vmss1-asr' -virtualmachinescaleset $vmssConfig
19471949

@@ -2017,7 +2019,7 @@ function Test-VMSSReplication {
20172019
$v = New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -ManagedDisk -LogStorageAccountId $logStg `
20182020
-DiskId $vhdid -RecoveryResourceGroupId $recRg -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
20192021
-RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
2020-
$enableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $vm.Id -Name $vmName -ProtectionContainerMapping $mapping -RecoveryResourceGroupId $recRg -AzureToAzureDiskReplicationConfiguration $v -RecoveryVirtualMachineScaleSetId $recVmss.Id
2022+
$enableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $vm.Id -Name $vmName -ProtectionContainerMapping $mapping -RecoveryResourceGroupId $recRg -AzureToAzureDiskReplicationConfiguration $v -RecoveryVirtualMachineScaleSetId $recVmss.Id -PlatformFaultDomain $platformFaultDomain
20212023
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
20222024
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
20232025
WaitForJobCompletion -JobId $enableDRjob.Name
@@ -2026,12 +2028,14 @@ function Test-VMSSReplication {
20262028
#Validate vmss Set in replicated vm properties
20272029
$pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
20282030
Assert-NotNull($pe.providerSpecificDetails.RecoveryVirtualMachineScaleSetId)
2031+
Assert-NotNull($pe.providerSpecificDetails.PlatformFaultDomain)
20292032

20302033
#Update Vmpropertie
2031-
$updateDRjob = Set-AzRecoveryServicesAsrReplicationProtectedItem -InputObject $pe -RecoveryVirtualMachineScaleSetId $recVmss1.Id
2034+
$updateDRjob = Set-AzRecoveryServicesAsrReplicationProtectedItem -InputObject $pe -RecoveryVirtualMachineScaleSetId $recVmss1.Id -PlatformFaultDomain $platformFaultDomain1
20322035
WaitForJobCompletion -JobId $updateDRjob.Name
20332036
$pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
20342037
Assert-NotNull($pe.providerSpecificDetails.RecoveryVirtualMachineScaleSetId)
2038+
Assert-NotNull($pe.providerSpecificDetails.PlatformFaultDomain)
20352039

20362040
#Failover
20372041
$failoverjob = Start-AzRecoveryServicesAsrUnPlannedFailoverJob -ReplicationProtectedItem $pe -Direction PrimaryToRecovery -PerformSourceSideAction
@@ -2212,7 +2216,9 @@ $CacheStorageAccount = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/reso
22122216

22132217
$rgId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/vijami-alertrg"
22142218

2215-
$ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId
2219+
$platformFaultDomain = 1
2220+
2221+
$ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId -PlatformFaultDomain $platformFaultDomain
22162222

22172223
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
22182224
WaitForJobCompletion -JobId $ReprotectJob.Name

src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/NewAzureRmRecoveryServicesAsrReplicationProtectedItem.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,14 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
577577
[ValidateNotNullOrEmpty]
578578
public ASRReplicationProtectionCluster ReplicationProtectionCluster { get; set; }
579579

580+
/// <summary>
581+
/// Gets or sets the resource ID of virtual machine scale set to failover this virtual machine to.
582+
/// </summary>
583+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure, HelpMessage = "Specify the platform fault domain to be used by the failover Vm in target recovery region.")]
584+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithoutDiskDetails, HelpMessage = "Specify the platform fault domain to be used by the failover Vm in target recovery region.")]
585+
[ValidateNotNullOrEmpty]
586+
public int? PlatformFaultDomain { get; set; }
587+
580588
/// <summary>
581589
/// ProcessRecord of the command.
582590
/// </summary>
@@ -994,7 +1002,8 @@ private void AzureToAzureReplication(EnableProtectionInput input)
9941002
RecoveryExtendedLocation = this.IsParameterBound(c => c.RecoveryExtendedLocation) ? new ExtendedLocation
9951003
{
9961004
Name = this.RecoveryExtendedLocation
997-
} : null
1005+
} : null,
1006+
PlatformFaultDomain = this.PlatformFaultDomain,
9981007
};
9991008

10001009
if (!string.IsNullOrEmpty(this.ReplicationGroupName))

src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ public class SetAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
307307
[ValidateNotNullOrEmpty]
308308
public string TestNetworkId { get; set; }
309309

310+
/// <summary>
311+
/// Gets or sets the platform fault domain for replication protected item after failover.
312+
/// </summary>
313+
[Parameter]
314+
[ValidateNotNullOrEmpty]
315+
public int? PlatformFaultDomain { get; set; }
316+
310317
/// <summary>
311318
/// ProcessRecord of the command.
312319
/// </summary>
@@ -354,6 +361,7 @@ public override void ExecuteSiteRecoveryCmdlet()
354361
this.IsParameterBound(c => c.RecoveryProximityPlacementGroupId) &&
355362
this.IsParameterBound(c => c.RecoveryVirtualMachineScaleSetId) &&
356363
this.IsParameterBound(c => c.RecoveryCapacityReservationGroupId) &&
364+
this.IsParameterBound(c => c.PlatformFaultDomain) &&
357365
string.IsNullOrEmpty(this.RecoveryCloudServiceId) &&
358366
string.IsNullOrEmpty(this.RecoveryResourceGroupId) &&
359367
string.IsNullOrEmpty(this.LicenseType) &&
@@ -419,6 +427,7 @@ public override void ExecuteSiteRecoveryCmdlet()
419427
var recoveryNicTag = this.RecoveryNicTag;
420428
var diskTag = this.DiskTag;
421429
var tfoNetworkId = string.Empty;
430+
var platformFaultDomain = this.PlatformFaultDomain;
422431
var vMNicInputDetailsList = new List<VMNicInputDetails>();
423432
var providerSpecificInput = new UpdateReplicationProtectedItemProviderInput();
424433

@@ -694,6 +703,10 @@ public override void ExecuteSiteRecoveryCmdlet()
694703
? this.RecoveryCapacityReservationGroupId
695704
: providerSpecificDetails.RecoveryCapacityReservationGroupId;
696705

706+
platformFaultDomain = this.IsParameterBound(c => c.PlatformFaultDomain)
707+
? this.PlatformFaultDomain
708+
: providerSpecificDetails.PlatformFaultDomain;
709+
697710
if (!this.MyInvocation.BoundParameters.ContainsKey(
698711
Utilities.GetMemberName(() => this.RecoveryCloudServiceId)))
699712
{
@@ -756,7 +769,8 @@ public override void ExecuteSiteRecoveryCmdlet()
756769
this.DiskEncryptionSecretUrl,
757770
this.DiskEncryptionVaultId,
758771
this.KeyEncryptionKeyUrl,
759-
this.KeyEncryptionVaultId)
772+
this.KeyEncryptionVaultId),
773+
PlatformFaultDomain = this.PlatformFaultDomain
760774
};
761775

762776
if (this.ASRVMNicConfiguration != null &&

src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/UpdateAzureRmRecoveryServicesAsrProtectionDirection.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,22 @@ public class UpdateAzureRmRecoveryServicesAsrProtection : SiteRecoveryCmdletBase
406406
HelpMessage = "Specifies the disk encryption secret key vault ID(Azure disk encryption) to be used be recovery VM after failover.")]
407407
public string KeyEncryptionVaultId { get; set; }
408408

409+
/// <summary>
410+
/// Gets or sets the recovery availability zone for protected Vm.
411+
/// </summary>
412+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure)]
413+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithMultipleStorageAccount)]
414+
[ValidateNotNullOrEmpty]
415+
public string RecoveryAvailabilityZone { get; set; }
416+
417+
/// <summary>
418+
/// Gets or sets platform fault domain for protected Vm.
419+
/// </summary>
420+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure)]
421+
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithMultipleStorageAccount)]
422+
[ValidateNotNullOrEmpty]
423+
public int? PlatformFaultDomain { get; set; }
424+
409425
/// <summary>
410426
/// ProcessRecord of the command.
411427
/// </summary>
@@ -783,7 +799,9 @@ private void A2ARPIReprotect()
783799
RecoveryBootDiagStorageAccountId = this.RecoveryBootDiagStorageAccountId,
784800
RecoveryProximityPlacementGroupId = this.RecoveryProximityPlacementGroupId,
785801
RecoveryVirtualMachineScaleSetId = this.RecoveryVirtualMachineScaleSetId,
786-
RecoveryCapacityReservationGroupId = this.RecoveryCapacityReservationGroupId
802+
RecoveryCapacityReservationGroupId = this.RecoveryCapacityReservationGroupId,
803+
RecoveryAvailabilityZone = this.RecoveryAvailabilityZone,
804+
PlatformFaultDomain = this.PlatformFaultDomain
787805
};
788806

789807
// Fetch the latest Protected item objects

src/RecoveryServices/RecoveryServices/help/New-AzRecoveryServicesAsrReplicationProtectedItem.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ New-AzRecoveryServicesAsrReplicationProtectedItem [-AzureToAzure]
8888
[-RecoveryCapacityReservationGroupId <String>] [-RecoveryAvailabilitySetId <String>]
8989
[-RecoveryBootDiagStorageAccountId <String>] [-DiskEncryptionVaultId <String>]
9090
[-DiskEncryptionSecretUrl <String>] [-KeyEncryptionKeyUrl <String>] [-KeyEncryptionVaultId <String>]
91+
[-PlatformFaultDomain <Integer>]
9192
[-WaitForCompletion] [-RecoveryExtendedLocation <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
9293
[-Confirm] [<CommonParameters>]
9394
```
@@ -102,6 +103,7 @@ New-AzRecoveryServicesAsrReplicationProtectedItem [-AzureToAzure] -AzureVmId <St
102103
[-RecoveryCapacityReservationGroupId <String>] [-RecoveryAvailabilitySetId <String>]
103104
[-RecoveryBootDiagStorageAccountId <String>] [-DiskEncryptionVaultId <String>]
104105
[-DiskEncryptionSecretUrl <String>] [-KeyEncryptionKeyUrl <String>] [-KeyEncryptionVaultId <String>]
106+
[-PlatformFaultDomain <Integer>]
105107
[-WaitForCompletion] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
106108
```
107109

@@ -607,6 +609,21 @@ Accept pipeline input: False
607609
Accept wildcard characters: False
608610
```
609611
612+
### -PlatformFaultDomain
613+
Specify the platform fault domain to used by the failover Vm in target recovery region.
614+
615+
```yaml
616+
Type: System.int32
617+
Parameter Sets: AzureToAzure, AzureToAzureWithoutDiskDetails
618+
Aliases:
619+
620+
Required: False
621+
Position: Named
622+
Default value: None
623+
Accept pipeline input: False
624+
Accept wildcard characters: False
625+
```
626+
610627
### -ProcessServer
611628
The Process Server to use to replicate this machine. Use the list of process servers in the ASR fabric corresponding to the Configuration server to specify one.
612629

src/RecoveryServices/RecoveryServices/help/Set-AzRecoveryServicesAsrReplicationProtectedItem.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Set-AzRecoveryServicesAsrReplicationProtectedItem -InputObject <ASRReplicationPr
3232
[-RecoveryPublicIPAddressId <String>] [-RecoveryNetworkSecurityGroupId <String>]
3333
[-RecoveryLBBackendAddressPoolId <String[]>] [-TfoAzureVMName <String>]
3434
[-ASRVMNicConfiguration <ASRVMNicConfig[]>] [-TestNetworkId <String>]
35+
[-PlatformFaultDomain <Integer>]
3536
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3637
```
3738

@@ -317,6 +318,21 @@ Accept pipeline input: False
317318
Accept wildcard characters: False
318319
```
319320
321+
### -PlatformFaultDomain
322+
Specify the platform fault domain to used by the failover Vm in target recovery region.
323+
324+
```yaml
325+
Type: System.int32
326+
Parameter Sets: AzureToAzure, AzureToAzureWithoutDiskDetails
327+
Aliases:
328+
329+
Required: False
330+
Position: Named
331+
Default value: None
332+
Accept pipeline input: False
333+
Accept wildcard characters: False
334+
```
335+
320336
### -PrimaryNic
321337
Specifies the NIC which will be used as primary NIC for recovery VM after after failover.
322338

src/RecoveryServices/RecoveryServices/help/Update-AzRecoveryServicesAsrProtectionDirection.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Update-AzRecoveryServicesAsrProtectionDirection [-AzureToAzure]
7777
[-RecoveryCapacityReservationGroupId <String>] [-RecoveryBootDiagStorageAccountId <String>]
7878
[-DiskEncryptionVaultId <String>] [-DiskEncryptionSecretUrl <String>] [-KeyEncryptionKeyUrl <String>]
7979
[-KeyEncryptionVaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
80+
[-RecoveryAvailabilityZone <String>]
81+
[-PlatformFaultDomain <Integer>]
8082
[<CommonParameters>]
8183
```
8284

@@ -91,6 +93,8 @@ Update-AzRecoveryServicesAsrProtectionDirection [-AzureToAzure]
9193
[-RecoveryCapacityReservationGroupId <String>] [-RecoveryBootDiagStorageAccountId <String>]
9294
[-DiskEncryptionVaultId <String>] [-DiskEncryptionSecretUrl <String>] [-KeyEncryptionKeyUrl <String>]
9395
[-KeyEncryptionVaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
96+
[-RecoveryAvailabilityZone <String>]
97+
[-PlatformFaultDomain <Integer>]
9498
[<CommonParameters>]
9599
```
96100

@@ -463,6 +467,21 @@ Accept pipeline input: False
463467
Accept wildcard characters: False
464468
```
465469
470+
### -PlatformFaultDomain
471+
Specify the platform fault domain to used by the failover Vm in target recovery region.
472+
473+
```yaml
474+
Type: System.int32
475+
Parameter Sets: AzureToAzure, AzureToAzureWithoutDiskDetails
476+
Aliases:
477+
478+
Required: False
479+
Position: Named
480+
Default value: None
481+
Accept pipeline input: False
482+
Accept wildcard characters: False
483+
```
484+
466485
### -ProcessServer
467486
Process Server to be used for replication.
468487
@@ -508,6 +527,21 @@ Accept pipeline input: False
508527
Accept wildcard characters: False
509528
```
510529
530+
### -RecoveryAvailabilityZone
531+
Specify the availability zone to used by the failover Vm in target recovery region.
532+
533+
```yaml
534+
Type: System.String
535+
Parameter Sets: AzureToAzure, AzureToAzureWithoutDiskDetails
536+
Aliases:
537+
538+
Required: False
539+
Position: Named
540+
Default value: None
541+
Accept pipeline input: False
542+
Accept wildcard characters: False
543+
```
544+
511545
### -RecoveryAzureStorageAccountId
512546
Specifies the ID of the Azure storage account to replicate to.
513547

0 commit comments

Comments
 (0)