Skip to content

Commit 4160929

Browse files
[Az.RecoveryServices] Fix for A2A Reprotect cmdlet (Azure#27532)
1 parent 2b3380e commit 4160929

File tree

5 files changed

+3554
-0
lines changed

5 files changed

+3554
-0
lines changed

Diff for: src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs

+10
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,15 @@ public void A2AClusterCommitFailoverJob()
288288
$"Import-Module {_testModule.AsAbsoluteLocation()}",
289289
"Test-ClusterCommitFailoverJob");
290290
}
291+
292+
[Fact]
293+
[Trait(Category.AcceptanceType, Category.CheckIn)]
294+
public void A2AReprotectTest()
295+
{
296+
TestRunner.RunTestScript(
297+
$"Import-Module {_helperModule.AsAbsoluteLocation()}",
298+
$"Import-Module {_testModule.AsAbsoluteLocation()}",
299+
"Test-A2ASingleVMReprotect");
300+
}
291301
}
292302
}

Diff for: src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1

+31
Original file line numberDiff line numberDiff line change
@@ -2185,4 +2185,35 @@ function Test-CRGReplication {
21852185
# Failover
21862186
$failoverjob = Start-AzRecoveryServicesAsrUnPlannedFailoverJob -ReplicationProtectedItem $pe -Direction PrimaryToRecovery -PerformSourceSideAction
21872187
WaitForJobCompletion -JobId $failoverjob.Name
2188+
}
2189+
2190+
<#
2191+
.SYNOPSIS
2192+
Test-A2ASingleVMReprotect parametersets
2193+
#>
2194+
function Test-A2ASingleVMReprotect{
2195+
$vault = Get-AzRecoveryServicesVault -Name "vijamireprotecttest" -ResourceGroupName "vijami-alertrg"
2196+
2197+
Set-AzRecoveryServicesAsrVaultContext -Vault $vault
2198+
2199+
$primaryfabric = Get-AzRecoveryServicesAsrFabric -Name asr-a2a-default-uksouth
2200+
2201+
$PrimaryProtContainer = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $primaryfabric
2202+
2203+
$recoveryfabric = Get-AzRecoveryServicesAsrFabric -Name asr-a2a-default-ukwest
2204+
2205+
$RecoveryContainer = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $recoveryfabric
2206+
2207+
$RecoveryMapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -ProtectionContainer $RecoveryContainer -Name ukwest-uksouth-24-hour-retention-policy
2208+
2209+
$ReplicationProtectedItem = Get-AzRecoveryServicesAsrReplicationProtectedItem -FriendlyName "reprotectvm" -ProtectionContainer $PrimaryProtContainer
2210+
2211+
$CacheStorageAccount = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/gl-rec-rg-prod-z2zgql-ukw/providers/Microsoft.Storage/storageAccounts/bootdiag0411052737"
2212+
2213+
$rgId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/vijami-alertrg"
2214+
2215+
$ReprotectJob = Update-AzRecoveryServicesAsrProtectionDirection -AzureToAzure -ReplicationProtectedItem $ReplicationProtectedItem -ProtectionContainerMapping $RecoveryMapping -LogStorageAccountId $CacheStorageAccount -RecoveryResourceGroupID $rgId
2216+
2217+
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
2218+
WaitForJobCompletion -JobId $ReprotectJob.Name
21882219
}

0 commit comments

Comments
 (0)