Skip to content

Commit d7758b7

Browse files
authored
Merge pull request #2912 from AsrOneSdk/devRelease2
[Azure Site Recovery] PR contains: aligning PowerShell to service object model, supporting some new features and some bug fixes.
2 parents 5a9e883 + 1f72d89 commit d7758b7

File tree

79 files changed

+19112
-7162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+19112
-7162
lines changed

src/ResourceManager/RecoveryServices/AzureRM.RecoveryServices.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '2.1.0'
13-
12+
ModuleVersion = '2.1.1'
13+
1414
# ID used to uniquely identify this module
1515
GUID = '4AA53B7E-FCFE-4E22-979C-9A4E6380DE58'
1616

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
<Reference Include="Microsoft.Azure.Common.NetFramework">
4545
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4646
</Reference>
47-
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
47+
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.3.0.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
49+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.3.0.1-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
5050
</Reference>
5151
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5252
<SpecificVersion>False</SpecificVersion>
@@ -173,4 +173,4 @@
173173
</ItemGroup>
174174
<ItemGroup />
175175
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
176-
</Project>
176+
</Project>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<package id="Hyak.Common" version="1.0.3" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
6-
<package id="Microsoft.Azure.Management.RecoveryServices" version="2.0.0-preview" targetFramework="net45" />
6+
<package id="Microsoft.Azure.Management.RecoveryServices" version="3.0.1-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Resources" version="2.18.11-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Test.Framework" version="1.0.6052.28118-prerelease" targetFramework="net45" />
99
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.7-preview" targetFramework="net45" />

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
<SpecificVersion>False</SpecificVersion>
4848
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4949
</Reference>
50-
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
50+
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5151
<SpecificVersion>False</SpecificVersion>
52-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.3.0.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
52+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.3.0.1-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
5353
</Reference>
5454
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.1.741, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5555
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.1\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
@@ -168,4 +168,4 @@
168168
</Content>
169169
</ItemGroup>
170170
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
171-
</Project>
171+
</Project>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<package id="Hyak.Common" version="1.0.3" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
6-
<package id="Microsoft.Azure.Management.RecoveryServices" version="3.0.0-preview" targetFramework="net45" />
6+
<package id="Microsoft.Azure.Management.RecoveryServices" version="3.0.1-preview" targetFramework="net45" />
77
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
88
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />

src/ResourceManager/SiteRecovery/AzureRM.SiteRecovery.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '2.1.0'
12+
ModuleVersion = '3.0.0'
1313

1414
# ID used to uniquely identify this module
1515
GUID = 'd1de7560-48e1-48f3-bc8c-4eea3af2bbe1'

src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<Reference Include="Microsoft.Azure.Common.NetFramework">
4545
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4646
</Reference>
47-
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.SiteRecovery.1.0.3-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
47+
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.SiteRecovery.2.0.0-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
4949
<Private>True</Private>
5050
</Reference>
5151
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -130,6 +130,7 @@
130130
</ItemGroup>
131131
<ItemGroup>
132132
<Compile Include="Properties\AssemblyInfo.cs" />
133+
<Compile Include="ScenarioTests\Constants.cs" />
133134
<Compile Include="ScenarioTests\SiteRecoveryTests.cs" />
134135
<Compile Include="ScenarioTests\SiteRecoveryTestsBase.cs" />
135136
</ItemGroup>
@@ -144,6 +145,12 @@
144145
<None Include="SessionRecords\Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests.SiteRecoveryTests\EnumerationTests.json">
145146
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
146147
</None>
148+
<None Include="SessionRecords\Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests.SiteRecoveryTests\FabricTests.json">
149+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
150+
</None>
151+
<None Include="SessionRecords\Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests.SiteRecoveryTests\NewModelE2ETest.json">
152+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
153+
</None>
147154
<None Include="SessionRecords\Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests.SiteRecoveryTests\TestAssociateProfile.json">
148155
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
149156
</None>
@@ -201,4 +208,4 @@
201208
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
202209
</ItemGroup>
203210
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
204-
</Project>
211+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using System;
17+
using System.Collections.Generic;
18+
19+
namespace Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests
20+
{
21+
public class Constants
22+
{
23+
public const string Default = "Default";
24+
public const string NewModel = "NewModel";
25+
}
26+
}

src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTests.cs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,77 +30,91 @@ public SiteRecoveryTests(ITestOutputHelper output)
3030
[Trait(Category.AcceptanceType, Category.CheckIn)]
3131
public void EnumerationTests()
3232
{
33-
this.RunPowerShellTest("Test-SiteRecoveryEnumerationTests -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
33+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryEnumerationTests -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
3434
}
3535

3636
[Fact]
3737
[Trait(Category.AcceptanceType, Category.CheckIn)]
3838
public void TestCreateProfile()
3939
{
40-
this.RunPowerShellTest("Test-SiteRecoveryCreateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
40+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryCreateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
4141
}
4242

4343
[Fact]
4444
[Trait(Category.AcceptanceType, Category.CheckIn)]
4545
public void TestDeleteProfile()
4646
{
47-
this.RunPowerShellTest("Test-SiteRecoveryDeleteProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
47+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryDeleteProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
4848
}
4949

5050
[Fact]
5151
[Trait(Category.AcceptanceType, Category.CheckIn)]
5252
public void TestAssociateProfile()
5353
{
54-
this.RunPowerShellTest("Test-SiteRecoveryAssociateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
54+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryAssociateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
5555
}
5656

5757
[Fact]
5858
[Trait(Category.AcceptanceType, Category.CheckIn)]
5959
public void TestDissociateProfile()
6060
{
61-
this.RunPowerShellTest("Test-SiteRecoveryDissociateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
61+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryDissociateProfile -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
6262
}
6363

6464
[Fact]
6565
[Trait(Category.AcceptanceType, Category.CheckIn)]
6666
public void TestEnableDR()
6767
{
68-
this.RunPowerShellTest("Test-SiteRecoveryEnableDR -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
68+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryEnableDR -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
6969
}
7070

7171
[Fact]
7272
[Trait(Category.AcceptanceType, Category.CheckIn)]
7373
public void TestDisableDR()
7474
{
75-
this.RunPowerShellTest("Test-SiteRecoveryDisableDR -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
75+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryDisableDR -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
7676
}
7777

7878
[Fact]
7979
[Trait(Category.AcceptanceType, Category.CheckIn)]
8080
public void TestCreateRP()
8181
{
82-
this.RunPowerShellTest("Test-SiteRecoveryCreateRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
82+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryCreateRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
8383
}
8484

8585
[Fact]
8686
[Trait(Category.AcceptanceType, Category.CheckIn)]
8787
public void TestEnumerateRP()
8888
{
89-
this.RunPowerShellTest("Test-SiteRecoveryEnumerateRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
89+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryEnumerateRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
9090
}
9191

9292
[Fact]
9393
[Trait(Category.AcceptanceType, Category.CheckIn)]
9494
public void TestRemoveRP()
9595
{
96-
this.RunPowerShellTest("Test-SiteRecoveryRemoveRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
96+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryRemoveRecoveryPlan -vaultSettingsFilePath \"" + vaultSettingsFilePath + "\"");
9797
}
9898

9999
[Fact]
100100
[Trait(Category.AcceptanceType, Category.CheckIn)]
101101
public void VaultCRUDTests()
102102
{
103-
this.RunPowerShellTest("Test-SiteRecoveryVaultCRUDTests");
103+
this.RunPowerShellTest(Constants.Default, "Test-SiteRecoveryVaultCRUDTests");
104+
}
105+
106+
[Fact]
107+
[Trait(Category.AcceptanceType, Category.CheckIn)]
108+
public void FabricTests()
109+
{
110+
this.RunPowerShellTest(Constants.NewModel, "Test-SiteRecoveryFabricTest");
111+
}
112+
113+
[Fact]
114+
[Trait(Category.AcceptanceType, Category.CheckIn)]
115+
public void NewModelE2ETest()
116+
{
117+
this.RunPowerShellTest(Constants.NewModel, "Test-SiteRecoveryNewModelE2ETest");
104118
}
105119
}
106120
}

src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTests.ps1

Lines changed: 132 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,135 @@ function Test-SiteRecoveryVaultCRUDTests
359359
Remove-AzureRmSiteRecoveryVault -Vault $vaultToBeRemoved
360360
$vaults = Get-AzureRmSiteRecoveryVault -ResourceGroupName rg1 -Name v2
361361
Assert-True { $vaults.Count -eq 0 }
362-
}
362+
}
363+
364+
365+
<#
366+
.SYNOPSIS
367+
Site Recovery Fabric Tests New model
368+
#>
369+
function Test-SiteRecoveryFabricTest
370+
{
371+
# Enumerate vaults and set Azure Site Recovery Vault Settings
372+
$vault = Get-AzureRmSiteRecoveryVault -ResourceGroupName ReleaseResourceGroup -Name ReleaseVault
373+
Assert-NotNull($vault)
374+
Assert-True { $vault.Count -gt 0 }
375+
Assert-NotNull($vault.Name)
376+
Assert-NotNull($vault.ID)
377+
Set-AzureRmSiteRecoveryVaultSettings -ASRVault $vault
378+
379+
# Create Fabric
380+
$job = New-AzureRmSiteRecoveryFabric -Name ReleaseFabric -Type HyperVSite
381+
Assert-NotNull($job)
382+
383+
# Enumerate Fabrics
384+
$fabrics = Get-AzureRmSiteRecoveryFabric
385+
Assert-True { $fabrics.Count -gt 0 }
386+
Assert-NotNull($fabrics)
387+
foreach($fabric in $fabrics)
388+
{
389+
Assert-NotNull($fabrics.Name)
390+
Assert-NotNull($fabrics.ID)
391+
}
392+
393+
# Enumerate specific Fabric
394+
$fabric = Get-AzureRmSiteRecoveryFabric -Name ReleaseFabric
395+
Assert-NotNull($fabric)
396+
Assert-NotNull($fabrics.Name)
397+
Assert-NotNull($fabrics.ID)
398+
399+
# Remove specific fabric
400+
$job = Remove-AzureRmSiteRecoveryFabric -Fabric $fabric
401+
Assert-NotNull($job)
402+
WaitForJobCompletion -JobId $job.Name
403+
$fabric = Get-AzureRmSiteRecoveryFabric | Where-Object {$_.Name -eq "ReleaseFabric"}
404+
Assert-Null($fabric)
405+
}
406+
407+
408+
<#
409+
.SYNOPSIS
410+
Site Recovery New model End to End
411+
#>
412+
function Test-SiteRecoveryNewModelE2ETest
413+
{
414+
$JobQueryWaitTimeInSeconds = 30
415+
416+
# Enumerate vaults and set Azure Site Recovery Vault Settings
417+
$vault = Get-AzureRmSiteRecoveryVault -ResourceGroupName ReleaseResourceGroup -Name ReleaseVault
418+
Assert-NotNull($vault)
419+
Assert-True { $vault.Count -eq 1 }
420+
Assert-NotNull($vault.Name)
421+
Assert-NotNull($vault.ID)
422+
Set-AzureRmSiteRecoveryVaultSettings -ASRVault $vault
423+
424+
# Enumerate Fabrics
425+
$fabrics = Get-AzureRmSiteRecoveryFabric
426+
Assert-True { $fabrics.Count -gt 0 }
427+
Assert-NotNull($fabrics)
428+
foreach($fabric in $fabrics)
429+
{
430+
Assert-NotNull($fabrics.Name)
431+
Assert-NotNull($fabrics.ID)
432+
}
433+
434+
# Enumerate RSPs
435+
$rsps = Get-AzureRmSiteRecoveryFabric | Get-AzureRmSiteRecoveryServicesProvider
436+
Assert-True { $rsps.Count -gt 0 }
437+
Assert-NotNull($rsps)
438+
foreach($rsp in $rsps)
439+
{
440+
Assert-NotNull($rsp.Name)
441+
}
442+
443+
$StorageAccountID = "/subscriptions/19b823e2-d1f3-4805-93d7-401c5d8230d5/resourceGroups/releaseresourcegroup/providers/Microsoft.Storage/storageAccounts/releasestorageav"
444+
445+
# Create Policy
446+
$currentJob = New-AzureRmSiteRecoveryPolicy -Name "PP1" -ReplicationProvider HyperVReplicaAzure -ReplicationFrequencyInSeconds 30 -RecoveryPoints 1 -ApplicationConsistentSnapshotFrequencyInHours 0 -Encryption Disable -RecoveryAzureStorageAccountId $StorageAccountID
447+
$ProtectionProfile = Get-AzureRMSiteRecoveryPolicy -Name "PP1"
448+
Assert-NotNull($ProtectionProfile)
449+
Assert-NotNull($ProtectionProfile.Name)
450+
451+
# Get conatiners
452+
$ProtectionContainers = Get-AzureRmSiteRecoveryFabric | Get-AzureRmSiteRecoveryProtectionContainer
453+
$PrimaryContainer = $ProtectionContainers | where { $_.FriendlyName -eq "hark-123" }
454+
Assert-NotNull($PrimaryContainer)
455+
Assert-NotNull($PrimaryContainer.Name)
456+
457+
# Create new Conatiner mapping
458+
$currentJob = New-AzureRmSiteRecoveryProtectionContainerMapping -Name $("hark123" + "PP1") -Policy $ProtectionProfile -PrimaryProtectionContainer $PrimaryContainer
459+
460+
# Get container mapping
461+
$ProtectionContainerMapping = Get-AzureRmSiteRecoveryProtectionContainerMapping -Name $("hark123" + "PP1") -ProtectionContainer $PrimaryContainer
462+
Assert-NotNull($ProtectionContainerMapping)
463+
Assert-NotNull($ProtectionContainerMapping.Name)
464+
465+
# Get protectable item
466+
$protectable = Get-AzureRmSiteRecoveryProtectableItem -ProtectionContainer $PrimaryContainer -FriendlyName "vm3"
467+
Assert-NotNull($protectable)
468+
Assert-NotNull($protectable.Name)
469+
470+
# New replication protected item
471+
$currentJob = New-AzureRmSiteRecoveryReplicationProtectedItem -ProtectableItem $protectable -Name $protectable.Name -ProtectionContainerMapping $ProtectionContainerMapping -RecoveryAzureStorageAccountId $StorageAccountID
472+
Assert-NotNull($currentJob)
473+
474+
# Get replication protected item
475+
$protected = Get-AzureRmSiteRecoveryReplicationProtectedItem -ProtectionContainer $PrimaryContainer -Name $protectable.Name
476+
Assert-NotNull($protected)
477+
Assert-NotNull($protected.Name)
478+
479+
# Remove protected item
480+
$currentJob = Remove-AzureRmSiteRecoveryReplicationProtectedItem -ReplicationProtectedItem $protected -Force -Confirm:$false
481+
$protected = Get-AzureRmSiteRecoveryReplicationProtectedItem -ProtectionContainer $PrimaryContainer | Where-Object {$_.Name -eq $protectable.Name}
482+
Assert-Null($protected)
483+
484+
# Remove conatiner mapping
485+
$currentJob = Remove-AzureRmSiteRecoveryProtectionContainerMapping -ProtectionContainerMapping $ProtectionContainerMapping
486+
$ProtectionContainerMapping = Get-AzureRmSiteRecoveryProtectionContainerMapping -ProtectionContainer $PrimaryContainer | Where-Object {$_.Name -eq $("hark123" + "PP1")}
487+
Assert-Null($ProtectionContainerMapping)
488+
489+
# Remove Policy
490+
$currentJob = Remove-AzureRMSiteRecoveryPolicy -Policy $ProtectionProfile
491+
$ProtectionProfile = Get-AzureRMSiteRecoveryPolicy | Where-Object {$_.Name -eq "PP1"}
492+
Assert-Null($ProtectionProfile)
493+
}

0 commit comments

Comments
 (0)