Skip to content

[Release.1.3.2] Add backup and restore cmdlets for Azure Web Apps #2073

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 41 commits into from
Apr 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
acf65ef
Wrote first draft of all cmdlets for backup and restore
Dec 7, 2015
ef3cff6
New commands added to csproj
Dec 7, 2015
bafcb8e
Moved new cmdlets to their own directory
Dec 7, 2015
f0b6fec
Sketched out the first test
Dec 9, 2015
cae5ac4
Sketched out a few more tests
Dec 10, 2015
d4b08eb
Wrote most of the tests and refactored a few things. Making a commit …
Dec 11, 2015
a401557
Refactored backup/restore cmdlets to inherit from a base class. Chang…
Dec 14, 2015
5f2237c
Bug fixes found by hand testing
Dec 15, 2015
febbe5a
Renamed cmdlets to use Rm instead of RM. Also added Restore cmdlet th…
Dec 15, 2015
90de3c9
Merge remote-tracking branch 'upstream/dev' into dev
Jan 7, 2016
b4976df
Merge remote-tracking branch 'upstream/dev' into dev
Jan 7, 2016
ce231db
Merge remote-tracking branch 'upstream/dev' into dev
Feb 1, 2016
957d71c
Merge remote-tracking branch 'upstream/dev' into dev
Feb 1, 2016
1d56a68
Merge remote-tracking branch 'upstream/dev' into dev
Feb 17, 2016
eff9404
Merge remote-tracking branch 'upstream/dev' into dev
Feb 19, 2016
28efb4a
Prepare to rework tests to remove SQL database backup
Feb 22, 2016
e49ba8a
Merge remote-tracking branch 'upstream/dev' into dev
Feb 25, 2016
f04ed1c
Merge remote-tracking branch 'upstream/dev' into dev
Feb 25, 2016
8a34479
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
Feb 29, 2016
44a5191
Wrote passing tests for WebSites backup
Mar 12, 2016
08762f6
Finished writing tests for backup/restore code
Mar 15, 2016
6b1323b
Merge remote-tracking branch 'upstream/dev' into dev
Mar 18, 2016
76a95c0
Merge remote-tracking branch 'upstream/dev' into dev
Mar 21, 2016
5d1b6b5
WebAppBackup tests will now pass in playback mode
Mar 21, 2016
cba2807
Cleaned up test and project files
Mar 21, 2016
cbd5925
Added copyright headers to *.cs files
Mar 21, 2016
aba2532
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
Mar 28, 2016
ac6b51f
Rewrote the web app backup and restore cmdlets to allow more convenie…
Mar 29, 2016
bd4037e
Rewrote tests to match new piping semantics
Mar 30, 2016
0713f24
Deleted Remove-AzureRmWebAppBackupConfiguration cmdlet due to bugs in…
Mar 30, 2016
61ab1d6
Rewrote and rerecorded websites backup tests
Mar 31, 2016
5f81534
Added cmdlet to help create a database backup setting
Mar 31, 2016
62de610
Moved switch parameters to end positions
Apr 7, 2016
d72a48b
Fix build, rewrite deleted code
Apr 8, 2016
61f6304
Fix build, and add a null check
Apr 8, 2016
7d19b93
Added checks to FrequencyUnit string parsing
Apr 8, 2016
df8ff39
Merge remote-tracking branch 'upstream/Release.1.3.2' into Release.1.3.2
Apr 8, 2016
cd537d3
Regenerate wxi file
Apr 9, 2016
51cd62f
Revert "Regenerate wxi file"
Apr 11, 2016
57b8331
Address Mark's code review comments - add copyright headers, document…
Apr 11, 2016
0a74380
Minor documentation corrections
Apr 11, 2016
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 @@ -60,8 +60,12 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Websites, Version=1.0.0.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.1.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.1.2.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -140,6 +144,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ScenarioTests\AppServicePlanTests.cs" />
<Compile Include="ScenarioTests\WebAppBackupRestoreTests.cs" />
<Compile Include="ScenarioTests\SSLBindingTests.cs" />
<Compile Include="ScenarioTests\WebAppSlotTests.cs" />
<Compile Include="ScenarioTests\WebsitesController.cs" />
Expand All @@ -157,6 +162,9 @@
<None Include="ScenarioTests\AppServicePlanTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\WebAppBackupRestoreTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\SSLBindingTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -199,6 +207,24 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.SSLBindingTests\TestWebAppSSLBindingPipeSupport.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestCreateNewWebAppBackup.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestCreateNewWebAppBackupPiping.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestEditAndGetWebAppBackupConfiguration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestEditAndGetWebAppBackupConfigurationPiping.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppBackup.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests\TestGetWebAppBackupList.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests\TestCloneWebAppSlot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -278,6 +304,10 @@
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>
<Name>Commands.Resources</Name>
</ProjectReference>
<ProjectReference Include="..\..\Storage\Commands.Management.Storage\Commands.Management.Storage.csproj">
<Project>{a50ab133-5c04-4a17-9054-f8343683ec23}</Project>
<Name>Commands.Management.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\Commands.Websites\Commands.Websites.csproj">
<Project>{80a92297-7c92-456b-8ee7-9fb6ce30149d}</Project>
<Name>Commands.Websites</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ function Get-ResourceGroupName
return getAssetName
}

<#
.SYNOPSIS
Gets a backup name for testing.
#>
function Get-BackupName
{
return getAssetName
}

<#
.SYNOPSIS
Gets an aseName for testing.
Expand Down Expand Up @@ -133,4 +142,22 @@ function PingWebApp($webApp)

return $statusCode
}
}
}

# Create a SAS Uri
function Get-SasUri
{
param ([string] $storageAccount, [string] $storageKey, [string] $container, [TimeSpan] $duration, [Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions] $type)

$uri = "https://$storageAccount.blob.core.windows.net/$container"

$destUri = New-Object -TypeName System.Uri($uri);
$cred = New-Object -TypeName Microsoft.WindowsAzure.Storage.Auth.StorageCredentials($storageAccount, $storageKey);
$destBlob = New-Object -TypeName Microsoft.WindowsAzure.Storage.Blob.CloudPageBlob($destUri, $cred);
$policy = New-Object Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy;
$policy.Permissions = $type;
$policy.SharedAccessExpiryTime = (Get-Date).Add($duration);
$uri += $destBlob.GetSharedAccessSignature($policy);

return $uri;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Websites.Test.ScenarioTests
{
public class WebAppBackupRestoreTests : RMTestBase
{
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppBackup()
{
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppBackup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppBackupPiping()
{
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppBackupPiping");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetWebAppBackup()
{
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppBackup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetWebAppBackupList()
{
WebsitesController.NewInstance.RunPsTest("Test-GetWebAppBackupList");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestEditAndGetWebAppBackupConfiguration()
{
WebsitesController.NewInstance.RunPsTest("Test-EditAndGetWebAppBackupConfiguration");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestEditAndGetWebAppBackupConfigurationPiping()
{
WebsitesController.NewInstance.RunPsTest("Test-EditAndGetWebAppBackupConfigurationPiping");
}
}
}
Loading