- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.1k
Adding platform fault domain and avzone support #28681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Adding platform fault domain and avzone support #28681
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. | 
| Thank you for your contribution @abageria! We will review the pull request and get back to you soon. | 
| @microsoft-github-policy-service agree company="Microsoft" | 
| /azp run | 
| Commenter does not have sufficient privileges for PR 28681 in repo Azure/azure-powershell | 
| Hi @abageria if you are an employer of Microsoft please join the "Azure" organization here: https://aka.ms/AzureGitHub | 
| [Parameter(ParameterSetName = ASRParameterSets.AzureToAzure, HelpMessage = "Specify the platform fault domain to be used by the failover Vm in target recovery region.")] | ||
| [Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithoutDiskDetails, HelpMessage = "Specify the platform fault domain to be used by the failover Vm in target recovery region.")] | ||
| [ValidateNotNullOrEmpty] | ||
| public int? PlatformFaultDomain { get; set; } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its data type is nullable int, but we are also validating that it can't be null. These two are contradicting each other.
| #create virtual Machine scale set | ||
| $stnd = "Standard" | ||
| $vmssConfig = New-AzVmssConfig -Location $recoveryLocation -PlatformFaultDomainCount 1 -SinglePlacementGroup 0 -SecurityType $stnd | ||
| $vmssConfig = New-AzVmssConfig -Location $recoveryLocation -PlatformFaultDomainCount 2 -SinglePlacementGroup 0 -SecurityType $stnd | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get the value of platformFaultDomainCount from helper class like you are doing for platformFaultDomain.
| #Validate vmss Set in replicated vm properties | ||
| $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName | ||
| Assert-NotNull($pe.providerSpecificDetails.RecoveryVirtualMachineScaleSetId) | ||
| Assert-NotNull($pe.providerSpecificDetails.PlatformFaultDomain) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also validate Equal
| WaitForJobCompletion -JobId $updateDRjob.Name | ||
| $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName | ||
| Assert-NotNull($pe.providerSpecificDetails.RecoveryVirtualMachineScaleSetId) | ||
| Assert-NotNull($pe.providerSpecificDetails.PlatformFaultDomain) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| $rgId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/vijami-alertrg" | ||
|  | ||
| $ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId | ||
| $platformFaultDomain = 1 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't have constants here, get all these values from helper class.
| $ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId | ||
| $platformFaultDomain = 1 | ||
|  | ||
| $ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId -PlatformFaultDomain $platformFaultDomain | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get protected item and perform validations.
| /// Gets or sets the platform fault domain for replication protected item after failover. | ||
| /// </summary> | ||
| [Parameter] | ||
| [ValidateNotNullOrEmpty] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a new entry to ChangeLog.md
| This PR was labeled "needs-revision" because it has unresolved review comments or CI failures. | 
| /azp run | 
| Azure Pipelines successfully started running 3 pipeline(s). | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Platform Fault Domain and Availability Zone parameters in Azure Site Recovery protection workflows. The changes include:
- Adding PlatformFaultDomainandRecoveryAvailabilityZoneparameters to cmdlets for Enable, Update, and Switch Protection operations
- Updating the SDK to version 2025-08-01 API
- Adding test coverage for the new parameters
- Extending VMware CBT and InMageRcm scenarios with disk configuration properties (IOPS, throughput, disk size)
Reviewed Changes
Copilot reviewed 10 out of 50 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description | 
|---|---|
| Update-AzRecoveryServicesAsrProtectionDirection.md | Added documentation for RecoveryAvailabilityZone and PlatformFaultDomain parameters | 
| Set-AzRecoveryServicesAsrReplicationProtectedItem.md | Added documentation for PlatformFaultDomain parameter | 
| New-AzRecoveryServicesAsrReplicationProtectedItem.md | Added documentation for PlatformFaultDomain parameter | 
| UpdateAzureRmRecoveryServicesAsrProtectionDirection.cs | Added RecoveryAvailabilityZone and PlatformFaultDomain properties to cmdlet | 
| SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs | Added PlatformFaultDomain property and validation logic | 
| NewAzureRmRecoveryServicesAsrReplicationProtectedItem.cs | Added PlatformFaultDomain property with incorrect XML doc | 
| AsrA2ATests.ps1 | Added test coverage for new parameters with typo in variable name | 
| A2ATestsHelper.ps1 | Added helper functions with naming inconsistencies | 
| README.md | Updated SDK commit hash and API version | 
| SDK Generated files | Generated code from updated OpenAPI spec including new models and operations | 
| ChangeLog.md | Added release notes entry | 
| $recoveryNetMapping = getRecoveryNetworkMapping | ||
| $platformFaultDomain = getPlatformDomain | ||
| $platformFaultDomain1 = getPlatformDomain1 | ||
| $platoformFaultDomainCount2 = getPlatformDomainCount2 | 
    
      
    
      Copilot
AI
    
    
    
      Oct 30, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'platoformFaultDomainCount2' to 'platformFaultDomainCount2'.
| $recoveryNetMapping = getRecoveryNetworkMapping | ||
| $platformFaultDomain = getPlatformDomain | ||
| $platformFaultDomain1 = getPlatformDomain1 | ||
| $platoformFaultDomainCount2 = getPlatformDomainCount2 | 
    
      
    
      Copilot
AI
    
    
    
      Oct 30, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function 'getPlatformDomainCount2' is being called but is not defined in A2ATestsHelper.ps1. Based on the helper file, the correct function name should be 'getPlatformUpdateDomain2' (though that function itself has a naming issue noted separately).
| $platformFaultDomain = getPlatformDomain | ||
| $platformFaultDomain1 = getPlatformDomain1 | 
    
      
    
      Copilot
AI
    
    
    
      Oct 30, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions 'getPlatformDomain' and 'getPlatformDomain1' are being called but are not defined in A2ATestsHelper.ps1. The correct function names based on the helper file are 'getPlatformFaultDomain' and 'getPlatformUpdateDomain1'.
| public ASRReplicationProtectionCluster ReplicationProtectionCluster { get; set; } | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets the resource ID of virtual machine scale set to failover this virtual machine to. | 
    
      
    
      Copilot
AI
    
    
    
      Oct 30, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML documentation comment is incorrect. This property is for PlatformFaultDomain, not for virtual machine scale set resource ID. The comment should describe the platform fault domain property instead.
| this.KeyEncryptionVaultId), | ||
| PlatformFaultDomain = this.PlatformFaultDomain | 
    
      
    
      Copilot
AI
    
    
    
      Oct 30, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PlatformFaultDomain is assigned from 'this.PlatformFaultDomain' instead of the local variable 'platformFaultDomain' that was set earlier (lines 429, 705-707). This bypasses the logic that preserves the existing value when the parameter is not bound, making the fallback behavior ineffective.
| /azp run | 
| Azure Pipelines successfully started running 3 pipeline(s). | 
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.