Skip to content

[Az.RecoveryServices] Fix for A2A Reprotect cmdlet #27532

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

Merged
merged 2 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,15 @@ public void A2AClusterCommitFailoverJob()
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-ClusterCommitFailoverJob");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void A2AReprotectTest()
{
TestRunner.RunTestScript(
$"Import-Module {_helperModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-A2ASingleVMReprotect");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2185,4 +2185,35 @@ function Test-CRGReplication {
# Failover
$failoverjob = Start-AzRecoveryServicesAsrUnPlannedFailoverJob -ReplicationProtectedItem $pe -Direction PrimaryToRecovery -PerformSourceSideAction
WaitForJobCompletion -JobId $failoverjob.Name
}

<#
.SYNOPSIS
Test-A2ASingleVMReprotect parametersets
#>
function Test-A2ASingleVMReprotect{
$vault = Get-AzRecoveryServicesVault -Name "vijamireprotecttest" -ResourceGroupName "vijami-alertrg"

Set-AzRecoveryServicesAsrVaultContext -Vault $vault

$primaryfabric = Get-AzRecoveryServicesAsrFabric -Name asr-a2a-default-uksouth

$PrimaryProtContainer = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $primaryfabric

$recoveryfabric = Get-AzRecoveryServicesAsrFabric -Name asr-a2a-default-ukwest

$RecoveryContainer = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $recoveryfabric

$RecoveryMapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -ProtectionContainer $RecoveryContainer -Name ukwest-uksouth-24-hour-retention-policy

$ReplicationProtectedItem = Get-AzRecoveryServicesAsrReplicationProtectedItem -FriendlyName "reprotectvm" -ProtectionContainer $PrimaryProtContainer

$CacheStorageAccount = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/gl-rec-rg-prod-z2zgql-ukw/providers/Microsoft.Storage/storageAccounts/bootdiag0411052737"

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

$ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId

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