Skip to content

Commit 0fb4dc8

Browse files
committed
Added the changes from the Websites branch: Azure#6046 Updated the version of Storage for websites test in desktop to be compatible with using MockContext, but still have the recordings work. Got the netcore Websites tests working but skip some because of the storage version being out-of-date.
1 parent d7a3e77 commit 0fb4dc8

File tree

117 files changed

+48321
-17199
lines changed

Some content is hidden

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

117 files changed

+48321
-17199
lines changed

src/Azure.PowerShell.Netcore.Test.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Storage.Test.Netco
2929
EndProject
3030
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Management.Storage.Test.Netcore", "ResourceManager\Storage\Commands.Management.Storage.Test\Commands.Management.Storage.Test.Netcore.csproj", "{4504227B-3BAF-4DDB-8081-BB57CC21AD87}"
3131
EndProject
32+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Websites.Test.Netcore", "ResourceManager\Websites\Commands.Websites.Test\Commands.Websites.Test.Netcore.csproj", "{717E6427-EF88-441E-B4EF-0D7D96CF3317}"
33+
EndProject
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Authorization.Netcore", "Common\Commands.Common.Authorization\Common.Authorization.Netcore.csproj", "{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}"
35+
EndProject
3236
Global
3337
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3438
Debug|Any CPU = Debug|Any CPU
@@ -195,6 +199,30 @@ Global
195199
{4504227B-3BAF-4DDB-8081-BB57CC21AD87}.Release|x64.Build.0 = Release|Any CPU
196200
{4504227B-3BAF-4DDB-8081-BB57CC21AD87}.Release|x86.ActiveCfg = Release|Any CPU
197201
{4504227B-3BAF-4DDB-8081-BB57CC21AD87}.Release|x86.Build.0 = Release|Any CPU
202+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
203+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|Any CPU.Build.0 = Debug|Any CPU
204+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|x64.ActiveCfg = Debug|Any CPU
205+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|x64.Build.0 = Debug|Any CPU
206+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|x86.ActiveCfg = Debug|Any CPU
207+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Debug|x86.Build.0 = Debug|Any CPU
208+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|Any CPU.ActiveCfg = Release|Any CPU
209+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|Any CPU.Build.0 = Release|Any CPU
210+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|x64.ActiveCfg = Release|Any CPU
211+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|x64.Build.0 = Release|Any CPU
212+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|x86.ActiveCfg = Release|Any CPU
213+
{717E6427-EF88-441E-B4EF-0D7D96CF3317}.Release|x86.Build.0 = Release|Any CPU
214+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
215+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|Any CPU.Build.0 = Debug|Any CPU
216+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|x64.ActiveCfg = Debug|Any CPU
217+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|x64.Build.0 = Debug|Any CPU
218+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|x86.ActiveCfg = Debug|Any CPU
219+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Debug|x86.Build.0 = Debug|Any CPU
220+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|Any CPU.ActiveCfg = Release|Any CPU
221+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|Any CPU.Build.0 = Release|Any CPU
222+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|x64.ActiveCfg = Release|Any CPU
223+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|x64.Build.0 = Release|Any CPU
224+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|x86.ActiveCfg = Release|Any CPU
225+
{5E145C97-7BBC-4DA0-9B3C-7273AA36468E}.Release|x86.Build.0 = Release|Any CPU
198226
EndGlobalSection
199227
GlobalSection(SolutionProperties) = preSolution
200228
HideSolutionNode = FALSE

src/ResourceManager/Websites/AzureRM.Websites.psd1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ PrivateData = @{
129129
# IconUri = ''
130130

131131
# ReleaseNotes of this module
132-
ReleaseNotes = '* Updated to the latest version of the Azure ClientRuntime'
132+
ReleaseNotes = '* Upgrade to latest version of the Websites SDK
133+
* Added -AssignIdentity & -Httpsonly properties for SetAzureWebApp'
133134

134135
# Prerelease string of this module
135136
# Prerelease = ''
@@ -140,6 +141,8 @@ PrivateData = @{
140141
# External dependent modules of this module
141142
# ExternalModuleDependencies = @()
142143

144+
# Prerelease = ''
145+
143146
} # End of PSData hashtable
144147

145148
} # End of PrivateData hashtable

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.Netcore.csproj

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
</PropertyGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="3.0.0" />
26-
<PackageReference Include="Microsoft.Azure.Management.Websites" Version="1.2.0-preview" />
27-
<PackageReference Include="Moq" Version="4.2.1510.2205" />
25+
<!-- <PackageReference Include="Microsoft.Azure.Management.Storage" Version="5.0.2-preview" /> -->
26+
<PackageReference Include="Microsoft.Azure.Management.Websites" Version="1.7.1-preview" />
27+
<!-- <PackageReference Include="Moq" Version="4.2.1510.2205" /> -->
2828
</ItemGroup>
2929

3030
<ItemGroup>
3131
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication.Abstractions\Common.Authentication.Abstractions.Netcore.csproj" />
3232
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication\Common.Authentication.Netcore.csproj" />
3333
<ProjectReference Include="..\..\..\Common\Commands.Common.Authorization\Common.Authorization.Netcore.csproj" />
34+
<ProjectReference Include="..\..\..\Common\Commands.Common.Storage\Common.Storage.Netcore.csproj" />
3435
<ProjectReference Include="..\..\..\Common\Commands.Common\Common.Netcore.csproj" />
3536
<ProjectReference Include="..\..\Common\Commands.ResourceManager.Common\Common.ResourceManager.Netcore.csproj" />
3637
<ProjectReference Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\Common.ResourceManager.ScenarioTests.Netcore.csproj" />
@@ -45,4 +46,13 @@
4546
</None>
4647
</ItemGroup>
4748

49+
<ItemGroup>
50+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Resources.ps1">
51+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52+
</None>
53+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
54+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
55+
</None>
56+
</ItemGroup>
57+
4858
</Project>

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,12 @@
5555
<SpecificVersion>False</SpecificVersion>
5656
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5757
</Reference>
58-
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
58+
<Reference Include="Microsoft.Azure.Management.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.4.1.0-preview\lib\net45\Microsoft.Azure.Management.Storage.dll</HintPath>
6060
<Private>True</Private>
6161
</Reference>
62-
<Reference Include="Microsoft.Azure.Management.Websites, Version=1.0.0.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.2.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll</HintPath>
64-
<Private>True</Private>
62+
<Reference Include="Microsoft.Azure.Management.Websites, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.7.1-preview\lib\net452\Microsoft.Azure.Management.Websites.dll</HintPath>
6564
</Reference>
6665
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6766
<SpecificVersion>False</SpecificVersion>
@@ -305,6 +304,10 @@
305304
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
306305
<Name>Commands.Common</Name>
307306
</ProjectReference>
307+
<ProjectReference Include="..\..\..\Storage\Commands.Storage\Commands.Storage.csproj">
308+
<Project>{08cf7da7-0392-4a19-b79b-e1ff67cdb81a}</Project>
309+
<Name>Commands.Storage</Name>
310+
</ProjectReference>
308311
<ProjectReference Include="..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
309312
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
310313
<Name>Commands.ResourceManager.Common</Name>
@@ -313,6 +316,14 @@
313316
<Project>{3436a126-edc9-4060-8952-9a1be34cdd95}</Project>
314317
<Name>Commands.ScenarioTests.ResourceManager.Common</Name>
315318
</ProjectReference>
319+
<ProjectReference Include="..\..\Profile\Commands.Profile\Commands.Profile.csproj">
320+
<Project>{142d7b0b-388a-4ceb-a228-7f6d423c5c2e}</Project>
321+
<Name>Commands.Profile</Name>
322+
</ProjectReference>
323+
<ProjectReference Include="..\..\Resources\Commands.Resources\Commands.Resources.csproj">
324+
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>
325+
<Name>Commands.Resources</Name>
326+
</ProjectReference>
316327
<ProjectReference Include="..\Commands.Websites\Commands.Websites.csproj">
317328
<Project>{80a92297-7c92-456b-8ee7-9fb6ce30149d}</Project>
318329
<Name>Commands.Websites</Name>

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void TestGetAppServicePlanMetrics()
6363
WebsitesController.NewInstance.RunPsTest("Test-GetAppServicePlanMetrics");
6464
}
6565

66-
[Fact]
66+
[Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")]
6767
[Trait(Category.AcceptanceType, Category.CheckIn)]
6868
public void TestCreateNewAppServicePlanInAse()
6969
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.ps1

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,31 +333,29 @@ function Test-CreateNewAppServicePlanInAse
333333
$whpName = Get-WebHostPlanName
334334
$location = "West US"
335335
$capacity = 1
336-
$skuName = "S2"
337-
$aseName = "asedemo"
338-
$aseResourceGroupName = "appdemorg"
336+
$skuName = "I1"
337+
$skuTier = "Isolated"
338+
$aseName = "asedemops"
339+
$aseResourceGroupName = "asedemorg"
339340

340341
try
341342
{
342343
#Setup
343344
New-AzureRmResourceGroup -Name $rgname -Location $location
344345

345346
# Test
346-
$createResult = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier "Standard" -WorkerSize Medium -NumberOfWorkers $capacity -AseName $aseName -AseResourceGroupName $aseResourceGroupName
347+
$createResult = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $skuTier -WorkerSize Medium -NumberOfWorkers $capacity -AseName $aseName -AseResourceGroupName $aseResourceGroupName
347348

348349
# Assert
349350
Assert-AreEqual $whpName $createResult.Name
350-
Assert-AreEqual "Standard" $createResult.Sku.Tier
351+
Assert-AreEqual "Isolated" $createResult.Sku.Tier
351352
Assert-AreEqual $skuName $createResult.Sku.Name
352-
Assert-AreEqual $capacity $createResult.Sku.Capacity
353353

354354
# Assert
355-
356355
$getResult = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName
357356
Assert-AreEqual $whpName $getResult.Name
358-
Assert-AreEqual "Standard" $getResult.Sku.Tier
357+
Assert-AreEqual "Isolated" $getResult.Sku.Tier
359358
Assert-AreEqual $skuName $getResult.Sku.Name
360-
Assert-AreEqual $capacity $getResult.Sku.Capacity
361359
}
362360
finally
363361
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/Common.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ function Get-SecondaryLocation
123123

124124
if ($location -eq $null)
125125
{
126-
return "East US"
126+
return "West US"
127127
} else
128128
{
129129
return $location.Locations[1]
130130
}
131131
}
132132

133-
return "EastUS"
133+
return "WestUS"
134134
}
135135

136136
<#

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/SSLBindingTests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ assign a custom domain to it and update global variable values.
1717
#>
1818

1919
#Global variables
20-
$rgname = "webappsslbindingrb"
21-
$appname = "webappsslbindingtest"
20+
$rgname = "lketmtestantps10"
21+
$appname = "lketmtestantps10"
2222
$slot = "testslot"
23-
$prodHostname = "www.webappsslbindingtests.com"
24-
$slotHostname = "testslot.webappsslbindingtests.com"
25-
$thumbprint = "40D6600B0B8740C41BA4B3D13B967DDEF6ED1918"
23+
$prodHostname = "www.adorenow.net"
24+
$slotHostname = "testslot.adorenow.net"
25+
$thumbprint = "ECC61863C674D5CEE90AB06373D37342368F0413"
2626

2727
<#
2828
.SYNOPSIS
@@ -62,7 +62,7 @@ function Test-GetNewWebAppSSLBinding
6262

6363
# Test - Get commands for web app
6464
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname
65-
Assert-AreEqual 2 $getResult.Count
65+
Assert-AreEqual 1 $getResult.Count
6666
$currentHostNames = $getResult | Select -expand Name
6767
Assert-True { $currentHostNames -contains $createWebAppResult.Name }
6868
$getResult = Get-AzureRMWebAppSSLBinding -ResourceGroupName $rgname -WebAppName $appname -Name $prodHostname
@@ -138,7 +138,7 @@ function Test-WebAppSSLBindingPipeSupport
138138

139139
# Test - Retrieve Ssl bindings using web app and web app slot objects
140140
$getResult = $webapp | Get-AzureRMWebAppSSLBinding
141-
Assert-AreEqual 2 $getResult.Count
141+
Assert-AreEqual 1 $getResult.Count
142142

143143
$getResult = $webappslot | Get-AzureRMWebAppSSLBinding
144144
Assert-AreEqual 1 $getResult.Count

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppBackupRestoreTests.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,72 @@ public WebAppBackupRestoreTests(ITestOutputHelper output)
2727
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
2828
}
2929

30+
#if NETSTANDARD
31+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
32+
[Trait(Category.RunType, Category.DesktopOnly)]
33+
#else
3034
[Fact]
35+
#endif
3136
[Trait(Category.AcceptanceType, Category.CheckIn)]
3237
public void TestCreateNewWebAppBackup()
3338
{
3439
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppBackup");
3540
}
3641

42+
#if NETSTANDARD
43+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
44+
[Trait(Category.RunType, Category.DesktopOnly)]
45+
#else
3746
[Fact]
47+
#endif
3848
[Trait(Category.AcceptanceType, Category.CheckIn)]
3949
public void TestCreateNewWebAppBackupPiping()
4050
{
4151
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppBackupPiping");
4252
}
4353

54+
#if NETSTANDARD
55+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
56+
[Trait(Category.RunType, Category.DesktopOnly)]
57+
#else
4458
[Fact]
59+
#endif
4560
[Trait(Category.AcceptanceType, Category.CheckIn)]
4661
public void TestGetWebAppBackup()
4762
{
4863
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppBackup");
4964
}
5065

66+
#if NETSTANDARD
67+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
68+
[Trait(Category.RunType, Category.DesktopOnly)]
69+
#else
5170
[Fact]
71+
#endif
5272
[Trait(Category.AcceptanceType, Category.CheckIn)]
5373
public void TestGetWebAppBackupList()
5474
{
5575
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppBackupList");
5676
}
5777

78+
#if NETSTANDARD
79+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
80+
[Trait(Category.RunType, Category.DesktopOnly)]
81+
#else
5882
[Fact]
83+
#endif
5984
[Trait(Category.AcceptanceType, Category.CheckIn)]
6085
public void TestEditAndGetWebAppBackupConfiguration()
6186
{
6287
WebsitesController.NewInstance.RunPsTest("Test-EditAndGetWebAppBackupConfiguration");
6388
}
6489

90+
#if NETSTANDARD
91+
[Fact(Skip = "Storage version out-of-date: Awaiting Storage.Management.Common")]
92+
[Trait(Category.RunType, Category.DesktopOnly)]
93+
#else
6594
[Fact]
95+
#endif
6696
[Trait(Category.AcceptanceType, Category.CheckIn)]
6797
public void TestEditAndGetWebAppBackupConfigurationPiping()
6898
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppBackupRestoreTests.ps1

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15+
# Snapshots require a Premium app to exist for several hours.
16+
# Deploy a Premium app and update these global variables to re-record the snapshots tests.
17+
$snapshotRgName = 'onesdksnapshots'
18+
$snapshotAppName = 'onesdkpremapp'
19+
$snapshotAppSlot = 'staging'
20+
1521
function Test-CreateNewWebAppBackup
1622
{
1723
$rgName = Get-ResourceGroupName
@@ -322,6 +328,56 @@ function Test-EditAndGetWebAppBackupConfigurationPiping
322328
}
323329
}
324330

331+
function Test-GetWebAppSnapshots
332+
{
333+
# Test named parameters
334+
$snapshots = Get-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName
335+
Assert-True { $snapshots.Length -gt 0 }
336+
Assert-NotNull $snapshots[0]
337+
Assert-NotNull $snapshots[0].SnapshotTime
338+
Assert-AreEqual 'Production' $snapshots[0].Slot
339+
340+
# Test positional parameters
341+
$snapshots = Get-AzureRmWebAppSnapshot $snapshotRgName $snapshotAppName
342+
Assert-True { $snapshots.Length -gt 0 }
343+
Assert-NotNull $snapshots[0]
344+
Assert-NotNull $snapshots[0].SnapshotTime
345+
Assert-AreEqual 'Production' $snapshots[0].Slot
346+
347+
# Test snapshots for slots
348+
$snapshots = Get-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -Slot $snapshotAppSlot
349+
Assert-True { $snapshots.Length -gt 0 }
350+
Assert-NotNull $snapshots[0]
351+
Assert-NotNull $snapshots[0].SnapshotTime
352+
Assert-AreEqual $snapshotAppSlot $snapshots[0].Slot
353+
354+
# Test piping
355+
$app = Get-AzureRmWebApp -ResourceGroupName $snapshotRgName -Name $snapshotAppName
356+
$snapshots = $app | Get-AzureRmWebAppSnapshot
357+
Assert-True { $snapshots.Length -gt 0 }
358+
Assert-NotNull $snapshots[0]
359+
Assert-NotNull $snapshots[0].SnapshotTime
360+
Assert-AreEqual 'Production' $snapshots[0].Slot
361+
}
362+
363+
function Test-RestoreWebAppSnapshot
364+
{
365+
# Test overwrite
366+
$snapshot = (Get-AzureRmWebAppSnapshot $snapshotRgName $snapshotAppName)[0]
367+
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -SnapshotTime $snapshot.SnapshotTime -Force -RecoverConfiguration
368+
369+
# Test restore to target slot
370+
$target = Get-AzureRmWebAppSlot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -Slot $snapshotAppSlot
371+
Restore-AzureRmWebAppSnapshot -ResourceGroupName $snapshotRgName -Name $snapshotAppName -SnapshotTime $snapshot.SnapshotTime -RecoverConfiguration -TargetApp $target
372+
373+
# Test piping
374+
$snapshot | Restore-AzureRmWebAppSnapshot -Force
375+
376+
# Test background job
377+
$snapshot | Restore-AzureRmWebAppSnapshot -Force -AsJob
378+
$job | Wait-Job
379+
}
380+
325381
# Utility functions
326382

327383
# Creates a new web app
@@ -354,7 +410,10 @@ function Create-TestStorageAccount
354410
$stoKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroup -Name $storageName).Key1;
355411
# 2 hour access duration
356412
$accessDuration = New-Object -TypeName TimeSpan(2,0,0)
357-
$permissions = [Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions]::Write
413+
$permissions = [Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions]::Write -bor
414+
[Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions]::Read -bor
415+
[Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions]::List -bor
416+
[Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions]::Delete
358417
$sasUri = Get-SasUri $storageName $stoKey $stoContainerName $accessDuration $permissions
359418
return $sasUri
360-
}
419+
}

0 commit comments

Comments
 (0)