diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets
index b3fcd9c1cebd..7a5479fb8b6b 100644
--- a/AzurePowershell.Test.targets
+++ b/AzurePowershell.Test.targets
@@ -7,6 +7,7 @@
.\src\Local.x64.testsettings
.\src\Common\Commands.ScenarioTest\bin\Debug\Microsoft.WindowsAzure.Commands.ScenarioTest.dll
.\src\Common\Commands.Common.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Common.Test.dll
+ .\src\ResourceManager\AzureBackup\Commands.AzureBackup.Test\bin\Debug\Microsoft.Azure.Commands.AzureBackup.Test.dll
.\src\ResourceManager\Sql\Commands.Sql.Test\bin\Debug\Microsoft.Azure.Commands.Sql.Test.dll
.\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.dll
.\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.Test.dll
@@ -42,6 +43,7 @@
+
@@ -63,7 +65,7 @@
-
+
@@ -217,6 +219,13 @@
Projects="build.proj"/>
+
+
+
+
+
+
diff --git a/ChangeLog.txt b/ChangeLog.txt
index a72bc2486eaa..51ee1314d5f8 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,12 @@
-2015.07.16 version 0.9.5
+2015.07.10 version 1.0.0
+* Azure Backup cmdlets
+ *Added New-AzureBackupVault cmdlets
+ *Added Get-AzureBackupVault cmdlets
+ *Added Set-AzureBackupVault cmdlets
+ *Added Remove-AzureBackupVault cmdlets
+ *Added Get-AzureBackupVaultCredential cmdlets
+
+2015.07.16 version 0.9.5
* Azure Resource Manager cmdlets
* Fixed formatting of output for Get-UsageAggregates
* Fixed executing Get-UsageAggregates when first cmdlet being called.
diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi
index 62bcf021b510..ef6737be3aae 100644
--- a/setup/azurecmdfiles.wxi
+++ b/setup/azurecmdfiles.wxi
@@ -158,6 +158,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -281,6 +349,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4034,6 +4114,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4074,6 +4176,10 @@
+
+
+
+
diff --git a/src/AzurePowershell.sln b/src/AzurePowershell.sln
index b05230dee097..9d36990b7471 100644
--- a/src/AzurePowershell.sln
+++ b/src/AzurePowershell.sln
@@ -226,6 +226,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ApiManagement.Serv
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ApiManagement.ServiceManagement.Test", "ResourceManager\ApiManagement\Commands.SMAPI.Test\Commands.ApiManagement.ServiceManagement.Test.csproj", "{6448E795-3D02-4BDD-B0C7-AD0A2AFE3C8B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup", "ResourceManager\AzureBackup\Commands.AzureBackup\Commands.AzureBackup.csproj", "{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup.Test", "ResourceManager\AzureBackup\Commands.AzureBackup.Test\Commands.AzureBackup.Test.csproj", "{678AE95D-2364-47D7-888C-3FFA6D412CC8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -560,6 +564,14 @@ Global
{6448E795-3D02-4BDD-B0C7-AD0A2AFE3C8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6448E795-3D02-4BDD-B0C7-AD0A2AFE3C8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6448E795-3D02-4BDD-B0C7-AD0A2AFE3C8B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.Build.0 = Release|Any CPU
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -605,5 +617,6 @@ Global
{11387E0A-4DB6-49B8-BDBC-EE020D85D10F} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{F220C306-29A3-4511-8518-A58A55C60D07} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{6448E795-3D02-4BDD-B0C7-AD0A2AFE3C8B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
EndGlobalSection
EndGlobal
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config
new file mode 100644
index 000000000000..51736738e693
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
new file mode 100644
index 000000000000..12977a420ca1
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
@@ -0,0 +1,186 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {678AE95D-2364-47D7-888C-3FFA6D412CC8}
+ Library
+ Properties
+ Microsoft.Azure.Commands.AzureBackup.Test
+ Microsoft.Azure.Commands.AzureBackup.Test
+ v4.5
+ 512
+ ..\..\..\
+ true
+ 0043d215
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.27-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.0-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll
+
+
+
+
+ ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5571.32271-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5571.32271-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
+
+
+ ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll
+
+
+ False
+ ..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll
+
+
+ ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+ False
+ C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll
+
+
+
+
+ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll
+ True
+
+
+ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll
+ True
+
+
+
+
+
+
+
+
+
+ False
+ ..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll
+
+
+ ..\..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll
+
+
+
+
+
+
+ Code
+
+
+
+
+ {5ee72c53-1720-4309-b54b-5fb79703195f}
+ Commands.Common
+
+
+ {c1bda476-a5cc-4394-914d-48b0ec31a710}
+ Commands.ScenarioTests.Common
+
+
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}
+ Commands.AzureBackup
+
+
+
+
+
+
+
+ Designer
+
+
+ Designer
+
+
+ Always
+
+
+ Always
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Properties/AssemblyInfo.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000000..63471bfe0684
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Properties/AssemblyInfo.cs
@@ -0,0 +1,49 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Microsoft.Azure.Commands.AzureBackup.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Commands.AzureBackup.Test")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("49823b4f-deb2-4cf5-a8e7-5118fc6a05d6")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)]
+[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)]
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs
new file mode 100644
index 000000000000..19bfd08fbe0c
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs
@@ -0,0 +1,151 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Common.Authentication;
+using Microsoft.Azure.Management.BackupServices;
+using Microsoft.Azure.Test;
+using Microsoft.Azure.Test.HttpRecorder;
+using Microsoft.WindowsAzure.Commands.ScenarioTest;
+using System;
+using System.Configuration;
+using System.Net;
+using System.Net.Http;
+using System.Net.Security;
+using System.Reflection;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
+{
+ public abstract class AzureBackupTestsBase
+ {
+ private CSMTestEnvironmentFactory csmTestFactory;
+ private EnvironmentSetupHelper helper;
+
+ public BackupVaultServicesManagementClient BackupVaultServicesMgmtClient { get; private set; }
+
+ protected AzureBackupTestsBase()
+ {
+ this.helper = new EnvironmentSetupHelper();
+ this.csmTestFactory = new CSMTestEnvironmentFactory();
+ }
+
+ protected void SetupManagementClients()
+ {
+ BackupVaultServicesMgmtClient = GetBackupVaultServicesManagementClient();
+ //helper.SetupManagementClients(BackupServicesMgmtClient);
+ helper.SetupSomeOfManagementClients(BackupVaultServicesMgmtClient);
+ }
+
+ protected void RunPowerShellTest(params string[] scripts)
+ {
+ using (UndoContext context = UndoContext.Current)
+ {
+ context.Start(TestUtilities.GetCallingClass(2), TestUtilities.GetCurrentMethodName(2));
+
+ SetupManagementClients();
+
+ helper.SetupEnvironment(AzureModule.AzureResourceManager);
+ helper.SetupModules(AzureModule.AzureResourceManager, "ScenarioTests\\" + this.GetType().Name + ".ps1");
+
+ helper.RunPowerShellTest(scripts);
+ }
+ }
+
+ private BackupVaultServicesManagementClient GetBackupVaultServicesManagementClient()
+ {
+ return GetServiceClient();
+ }
+
+ public static T GetServiceClient() where T : class
+ {
+ var factory = (TestEnvironmentFactory)new CSMTestEnvironmentFactory();
+
+ var testEnvironment = factory.GetTestEnvironment();
+
+ ServicePointManager.ServerCertificateValidationCallback = IgnoreCertificateErrorHandler;
+
+ BackupVaultServicesManagementClient client;
+ string resourceName = ConfigurationManager.AppSettings["ResourceName"];
+ string resourceGroupName = ConfigurationManager.AppSettings["ResourceGroupName"];
+
+
+ if (testEnvironment.UsesCustomUri())
+ {
+ client = new BackupVaultServicesManagementClient(
+ resourceName,
+ resourceGroupName,
+ testEnvironment.Credentials as SubscriptionCloudCredentials,
+ testEnvironment.BaseUri);
+ }
+
+ else
+ {
+ client = new BackupVaultServicesManagementClient(
+ resourceName,
+ resourceGroupName,
+ testEnvironment.Credentials as SubscriptionCloudCredentials);
+ }
+
+ return GetServiceClient(factory, client);
+ }
+
+ public static T GetServiceClient(TestEnvironmentFactory factory, BackupVaultServicesManagementClient client) where T : class
+ {
+ TestEnvironment testEnvironment = factory.GetTestEnvironment();
+
+ HttpMockServer instance;
+ try
+ {
+ instance = HttpMockServer.CreateInstance();
+ }
+ catch (ApplicationException)
+ {
+ HttpMockServer.Initialize("TestEnvironment", "InitialCreation");
+ instance = HttpMockServer.CreateInstance();
+ }
+ T obj2 = typeof(T).GetMethod("WithHandler", new Type[1]
+ {
+ typeof (DelegatingHandler)
+ }).Invoke((object)client, new object[1]
+ {
+ (object) instance
+ }) as T;
+
+ if (HttpMockServer.Mode == HttpRecorderMode.Record)
+ {
+ HttpMockServer.Variables[TestEnvironment.SubscriptionIdKey] = testEnvironment.SubscriptionId;
+ }
+
+ if (HttpMockServer.Mode == HttpRecorderMode.Playback)
+ {
+ PropertyInfo property1 = typeof(T).GetProperty("LongRunningOperationInitialTimeout", typeof(int));
+ PropertyInfo property2 = typeof(T).GetProperty("LongRunningOperationRetryTimeout", typeof(int));
+ if (property1 != (PropertyInfo)null && property2 != (PropertyInfo)null)
+ {
+ property1.SetValue((object)obj2, (object)0);
+ property2.SetValue((object)obj2, (object)0);
+ }
+ }
+ return obj2;
+ }
+
+ private static bool IgnoreCertificateErrorHandler
+ (object sender,
+ System.Security.Cryptography.X509Certificates.X509Certificate certificate,
+ System.Security.Cryptography.X509Certificates.X509Chain chain,
+ SslPolicyErrors sslPolicyErrors)
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs
new file mode 100644
index 000000000000..87372daeaeaf
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs
@@ -0,0 +1,29 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 Xunit;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
+{
+ public class AzureBackupVaultTests : AzureBackupTestsBase
+ {
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void AzureBackupVaultScenarioTests()
+ {
+ this.RunPowerShellTest("Test-AzureBackupVaultScenario");
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1
new file mode 100644
index 000000000000..1edbe269e585
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1
@@ -0,0 +1,46 @@
+# ----------------------------------------------------------------------------------
+#
+# 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.
+# ----------------------------------------------------------------------------------
+
+$ResourceGroupName = "backuprg"
+$ResourceName = "backuprn1"
+$Location = "westus"
+$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName;
+
+function Test-AzureBackupVaultScenario
+{
+ $vault = New-AzureBackupVault -ResourceGroupName $ResourceGroupName -Name $ResourceName -Region $Location -Storage "LocallyRedundant";
+ Assert-AreEqual $vault.Name $ResourceName;
+ Assert-AreEqual $vault.ResourceGroupName $ResourceGroupName;
+ Assert-AreEqual $vault.Region $Location;
+ Assert-AreEqual $vault.Storage "LocallyRedundant";
+
+ $vault = Get-AzureBackupVault -ResourceGroupName $ResourceGroupName -Name $ResourceName
+ Assert-AreEqual $vault.Name $ResourceName;
+ Assert-AreEqual $vault.ResourceGroupName $ResourceGroupName;
+ Assert-AreEqual $vault.Region $Location;
+ Assert-AreEqual $vault.Storage "LocallyRedundant";
+
+ $fileName = Get-AzureBackupVaultCredentials -vault $vault -TargetLocation $CertTargetLocation
+ Assert-NotNull $fileName 'File name should not be null';
+ $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName);
+ Assert-True {{ Test-Path $certFileFullPath }}
+
+ $vault = Set-AzureBackupVault -vault $vault -Storage "GeoRedundant";
+ Assert-AreEqual $vault.Name $ResourceName;
+ Assert-AreEqual $vault.ResourceGroupName $ResourceGroupName;
+ Assert-AreEqual $vault.Region $Location;
+ Assert-AreEqual $vault.Storage "GeoRedundant";
+
+ Remove-AzureBackupVault -Vault $vault;
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/AzureBackupVaultScenarioTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/AzureBackupVaultScenarioTests.json
new file mode 100644
index 000000000000..32288e3c71c7
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/AzureBackupVaultScenarioTests.json
@@ -0,0 +1,626 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMT9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"sku\": {\r\n \"name\": \"standard\"\r\n }\r\n },\r\n \"location\": \"westus\",\r\n \"tags\": {}\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "115"
+ ],
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"backuprn1\",\r\n \"etag\": \"22a9ef4f-5bd9-48b5-bc4d-f564d529b597\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"sku\": {\r\n \"name\": \"standard\"\r\n },\r\n \"ProvisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1\",\r\n \"type\": \"Microsoft.Backup/BackupVault\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "339"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "81d97ccb-5ad8-41d5-a9f3-a47af8d6216f"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "81d97ccb-5ad8-41d5-a9f3-a47af8d6216f"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095812Z:81d97ccb-5ad8-41d5-a9f3-a47af8d6216f"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:12 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/storageconfig/vaultstorageconfig?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9zdG9yYWdlY29uZmlnL3ZhdWx0c3RvcmFnZWNvbmZpZz9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "PATCH",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"storageModelType\": \"LocallyRedundant\"\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json"
+ ],
+ "Content-Length": [
+ "72"
+ ],
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "x-ms-version": [
+ "2013-03-01"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "0"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "1cf95f4c-680f-4974-9f74-a6e8629b2ad4"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS",
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "1cf95f4c-680f-4974-9f74-a6e8629b2ad4"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095814Z:1cf95f4c-680f-4974-9f74-a6e8629b2ad4"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:14 GMT"
+ ]
+ },
+ "StatusCode": 204
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/storageconfig/vaultstorageconfig?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9zdG9yYWdlY29uZmlnL3ZhdWx0c3RvcmFnZWNvbmZpZz9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "PATCH",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"storageModelType\": \"GeoRedundant\"\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json"
+ ],
+ "Content-Length": [
+ "68"
+ ],
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "x-ms-version": [
+ "2013-03-01"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "0"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "7bc725d4-f5ef-4278-961a-acab202c5c1a"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS",
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1196"
+ ],
+ "x-ms-correlation-request-id": [
+ "7bc725d4-f5ef-4278-961a-acab202c5c1a"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095820Z:7bc725d4-f5ef-4278-961a-acab202c5c1a"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:20 GMT"
+ ]
+ },
+ "StatusCode": 204
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/storageconfig/vaultstorageconfig?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9zdG9yYWdlY29uZmlnL3ZhdWx0c3RvcmFnZWNvbmZpZz9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"resourceId\": 1117362664063487198,\r\n \"properties\": {\r\n \"storageType\": \"LocallyRedundant\",\r\n \"storageTypeState\": \"Unlocked\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "112"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "3eb0cb5d-390e-4ff0-9c35-0e3a73d9171b"
+ ],
+ "x-ms-client-request-id": [
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS",
+ "8ccef70d-c423-4098-849c-0a1e1b75e2f5-2015-07-08 09:58:09Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14997"
+ ],
+ "x-ms-correlation-request-id": [
+ "3eb0cb5d-390e-4ff0-9c35-0e3a73d9171b"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095814Z:3eb0cb5d-390e-4ff0-9c35-0e3a73d9171b"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:14 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/storageconfig/vaultstorageconfig?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9zdG9yYWdlY29uZmlnL3ZhdWx0c3RvcmFnZWNvbmZpZz9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "0efb57c9-0306-446d-acbc-ae232387f1af-2015-07-08 09:58:14Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"resourceId\": 1117362664063487198,\r\n \"properties\": {\r\n \"storageType\": \"LocallyRedundant\",\r\n \"storageTypeState\": \"Unlocked\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "112"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "79d0534f-03c5-4bdd-b57f-ad84552fcde0"
+ ],
+ "x-ms-client-request-id": [
+ "0efb57c9-0306-446d-acbc-ae232387f1af-2015-07-08 09:58:14Z-PS",
+ "0efb57c9-0306-446d-acbc-ae232387f1af-2015-07-08 09:58:14Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14995"
+ ],
+ "x-ms-correlation-request-id": [
+ "79d0534f-03c5-4bdd-b57f-ad84552fcde0"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095816Z:79d0534f-03c5-4bdd-b57f-ad84552fcde0"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:15 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/storageconfig/vaultstorageconfig?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9zdG9yYWdlY29uZmlnL3ZhdWx0c3RvcmFnZWNvbmZpZz9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"resourceId\": 1117362664063487198,\r\n \"properties\": {\r\n \"storageType\": \"GeoRedundant\",\r\n \"storageTypeState\": \"Unlocked\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "108"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "cb317c47-05af-4847-92a1-07d66589e09a"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS",
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14993"
+ ],
+ "x-ms-correlation-request-id": [
+ "cb317c47-05af-4847-92a1-07d66589e09a"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095822Z:cb317c47-05af-4847-92a1-07d66589e09a"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:21 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMT9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "0efb57c9-0306-446d-acbc-ae232387f1af-2015-07-08 09:58:14Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"backuprn1\",\r\n \"etag\": \"22a9ef4f-5bd9-48b5-bc4d-f564d529b597\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"sku\": {\r\n \"name\": \"standard\"\r\n },\r\n \"ProvisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1\",\r\n \"type\": \"Microsoft.Backup/BackupVault\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "339"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "bea6c724-4984-4afb-bc39-4ee2bac905ca"
+ ],
+ "x-ms-client-request-id": [
+ "0efb57c9-0306-446d-acbc-ae232387f1af-2015-07-08 09:58:14Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14996"
+ ],
+ "x-ms-correlation-request-id": [
+ "bea6c724-4984-4afb-bc39-4ee2bac905ca"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095815Z:bea6c724-4984-4afb-bc39-4ee2bac905ca"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:15 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMT9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"backuprn1\",\r\n \"etag\": \"22a9ef4f-5bd9-48b5-bc4d-f564d529b597\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"sku\": {\r\n \"name\": \"standard\"\r\n },\r\n \"ProvisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1\",\r\n \"type\": \"Microsoft.Backup/BackupVault\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "339"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "f30f6dd0-24bc-4301-9415-134a49893b11"
+ ],
+ "x-ms-client-request-id": [
+ "26734291-d565-4c21-8837-f6fc4f04c302-2015-07-08 09:58:18Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14994"
+ ],
+ "x-ms-correlation-request-id": [
+ "f30f6dd0-24bc-4301-9415-134a49893b11"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095821Z:f30f6dd0-24bc-4301-9415-134a49893b11"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:21 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/certificates/IdMgmtInternalCert?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9jZXJ0aWZpY2F0ZXMvSWRNZ210SW50ZXJuYWxDZXJ0P2FwaS12ZXJzaW9uPTIwMTUtMDMtMTU=",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQFKHEzjT4EpZNl44PA7dJojANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDcwODA5NDgxNVoXDTE1MDcxMDA5NTgxNVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALNA8xmDPJujD5HrGrZ5UZpKncdDBRHJmp4JKEd29jtZng2F8v7z67kF0hDAEE9WSAIxPhjNxQoyxZ2gDdFVQp2r1n6dLxZYlHgih73QFIfAzFo0BP1PCVDCNk5edfMzRt+iZdcK2ruoRRxPiFlo8D6eKSA3MUvwzEl61i44+ctz3mA5lwNf1c58ENLg29IWGhd3LODjkkpre6eGeMEbI5h9+Z2N8yj5ATtzQiDe0FSapbwqktTgT/+ngP6jWxVZI3uyBCZYgxfzfnhtzWkCQnqx2jOOMSu5D1JSiXngQPVQ5wQBVVDmcbF/YdXpRWVER48p2tHemvbd+7zPkmXT5CkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBADo2hDHV3r75KgFAP5Ie4jVqGazT1Y5Gs4NBsG6dzDWg9/0vsHT8SOjNjjccpPUkP2aO/4RQlLhC2gsU/BMYw7kxY0eyUxAM0SB7sJ9gj/EBcHDyeOu1eSnYGmqcvXmbFjMauLwNkNwsACo5vVz0ghXxpazRAnpzyKgZgwNC4ruotDzMT8S4zB8a1WVEpcx43Um/5Yg06QBfIEG4wD11rIpENkKm3DWnP5OV39knHLLt/UvwY011kpfXFuXo4ZVXI3F096kgER/vpr32T+H3SCJVbrTi+qKDLjENpdVSTxEh16w/RK1mB6LST7KOIn0LwC76xveMYoOP/1uYK4hkKgQ=\"\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json"
+ ],
+ "Content-Length": [
+ "1035"
+ ],
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-version": [
+ "2013-03-01"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQFKHEzjT4EpZNl44PA7dJojANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDcwODA5NDgxNVoXDTE1MDcxMDA5NTgxNVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALNA8xmDPJujD5HrGrZ5UZpKncdDBRHJmp4JKEd29jtZng2F8v7z67kF0hDAEE9WSAIxPhjNxQoyxZ2gDdFVQp2r1n6dLxZYlHgih73QFIfAzFo0BP1PCVDCNk5edfMzRt+iZdcK2ruoRRxPiFlo8D6eKSA3MUvwzEl61i44+ctz3mA5lwNf1c58ENLg29IWGhd3LODjkkpre6eGeMEbI5h9+Z2N8yj5ATtzQiDe0FSapbwqktTgT/+ngP6jWxVZI3uyBCZYgxfzfnhtzWkCQnqx2jOOMSu5D1JSiXngQPVQ5wQBVVDmcbF/YdXpRWVER48p2tHemvbd+7zPkmXT5CkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBADo2hDHV3r75KgFAP5Ie4jVqGazT1Y5Gs4NBsG6dzDWg9/0vsHT8SOjNjjccpPUkP2aO/4RQlLhC2gsU/BMYw7kxY0eyUxAM0SB7sJ9gj/EBcHDyeOu1eSnYGmqcvXmbFjMauLwNkNwsACo5vVz0ghXxpazRAnpzyKgZgwNC4ruotDzMT8S4zB8a1WVEpcx43Um/5Yg06QBfIEG4wD11rIpENkKm3DWnP5OV39knHLLt/UvwY011kpfXFuXo4ZVXI3F096kgER/vpr32T+H3SCJVbrTi+qKDLjENpdVSTxEh16w/RK1mB6LST7KOIn0LwC76xveMYoOP/1uYK4hkKgQ=\",\r\n \"resourceId\": 1117362664063487198,\r\n \"globalAcsNamespace\": \"seadev01rrp1users\",\r\n \"globalAcsHostName\": \"accesscontrol.windows.net\",\r\n \"globalAcsRPRealm\": \"http://windowscloudbackup/m3\",\r\n \"subject\": \"CN=Windows Azure Tools\",\r\n \"validFrom\": \"2015-07-08T02:48:15-07:00\",\r\n \"validTo\": \"2015-07-10T02:58:15-07:00\",\r\n \"thumbprint\": \"2F6E98592FCC206CBA2BF6FDCA6279C87A0DCA60\",\r\n \"friendlyName\": \"\",\r\n \"issuer\": \"CN=Windows Azure Tools\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "1410"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "a94d6ca2-6cba-45f0-bd5e-fe3535d1e7d9"
+ ],
+ "x-ms-client-request-id": [
+ "38750946-e6c7-4f15-a698-323deaf1f2ab",
+ "38750946-e6c7-4f15-a698-323deaf1f2ab"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1197"
+ ],
+ "x-ms-correlation-request-id": [
+ "a94d6ca2-6cba-45f0-bd5e-fe3535d1e7d9"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095819Z:a94d6ca2-6cba-45f0-bd5e-fe3535d1e7d9"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:18 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMT9hcGktdmVyc2lvbj0yMDE1LTAzLTE1",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "c4aca23e-b7fa-4016-829d-5af4fd8eef00-2015-07-08 09:58:21Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
+ ]
+ },
+ "ResponseBody": "",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "0"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "17c2f600-ee65-4ad2-a946-de4bc205406d"
+ ],
+ "x-ms-client-request-id": [
+ "c4aca23e-b7fa-4016-829d-5af4fd8eef00-2015-07-08 09:58:21Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1195"
+ ],
+ "x-ms-correlation-request-id": [
+ "17c2f600-ee65-4ad2-a946-de4bc205406d"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150708T095825Z:17c2f600-ee65-4ad2-a946-de4bc205406d"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Wed, 08 Jul 2015 09:58:25 GMT"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config
new file mode 100644
index 000000000000..ec8ef520b0bd
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs
new file mode 100644
index 000000000000..215db6047e47
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs
@@ -0,0 +1,113 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Common.Authentication;
+using Microsoft.Azure.Management.BackupServices;
+using Microsoft.Azure.Management.BackupServices.Models;
+using System;
+using System.Net;
+using System.Threading;
+
+namespace Microsoft.Azure.Commands.AzureBackup.ClientAdapter
+{
+ public partial class AzureBackupClientAdapter
+ {
+ ///
+ /// Cloud credentials for client calls
+ ///
+ private SubscriptionCloudCredentials cloudCreds { get; set; }
+
+ ///
+ /// Base URI for client calls
+ ///
+ private Uri baseURI { get; set; }
+
+ ///
+ /// ResourceGroup context for the operation
+ ///
+ private string resourceGroupName { get; set; }
+
+ ///
+ /// Resource context for the operation
+ ///
+ private string resourceName { get; set; }
+
+ ///
+ /// Client request id.
+ ///
+ private string clientRequestId;
+
+ ///
+ /// Azure backup client.
+ ///
+ private BackupVaultServicesManagementClient azureBackupVaultClient;
+
+ ///
+ /// Cancellation Token Source
+ ///
+ private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
+ private CancellationToken CmdletCancellationToken;
+
+ ///
+ /// Get Azure backup client.
+ ///
+ private BackupVaultServicesManagementClient AzureBackupVaultClient
+ {
+ get
+ {
+ if (this.azureBackupVaultClient == null)
+ {
+ this.azureBackupVaultClient = AzureSession.ClientFactory.CreateCustomClient(resourceName, resourceGroupName, cloudCreds, baseURI);
+ }
+
+ return this.azureBackupVaultClient;
+ }
+ }
+
+ public AzureBackupClientAdapter(SubscriptionCloudCredentials creds, Uri baseUri, string rgName, string rName)
+ {
+ cloudCreds = creds;
+ baseURI = baseUri;
+ resourceGroupName = rgName;
+ resourceName = rName;
+
+ RefreshClientRequestId();
+
+ // Temp code to be able to test internal env.
+ ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
+ }
+
+ public void RefreshClientRequestId()
+ {
+ clientRequestId = Guid.NewGuid().ToString() + "-" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ssZ") + "-PS";
+ }
+
+ public string GetClientRequestId()
+ {
+ return clientRequestId;
+ }
+
+ internal CustomRequestHeaders GetCustomRequestHeaders()
+ {
+ var hdrs = new CustomRequestHeaders()
+ {
+ // ClientRequestId is a unique ID for every request to backend service.
+ ClientRequestId = this.clientRequestId,
+ };
+
+ return hdrs;
+ }
+ }
+}
+
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/VaultAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/VaultAdapter.cs
new file mode 100644
index 000000000000..9d997c95bf7c
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/VaultAdapter.cs
@@ -0,0 +1,130 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Management.BackupServices.Models;
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Azure.Commands.AzureBackup.ClientAdapter
+{
+ public partial class AzureBackupClientAdapter
+ {
+ public const int defaultTop = 100;
+ private const string defaultSKU = "standard";
+
+ ///
+ /// Creates or updates the vault identified by client
+ ///
+ ///
+ ///
+ ///
+ public AzureBackupVault CreateOrUpdateAzureBackupVault(string resourceGroupName, string vaultName, string location)
+ {
+ var createResourceParameters = new AzureBackupVaultCreateOrUpdateParameters()
+ {
+ Location = location,
+ Properties = new AzureBackupVaultProperties()
+ {
+ Sku = new SkuProperties()
+ {
+ Name = defaultSKU,
+ },
+ },
+ };
+
+ var response = AzureBackupVaultClient.Vault.CreateOrUpdateAsync(resourceGroupName, vaultName, createResourceParameters, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ return response.Vault;
+ }
+
+ ///
+ /// Updates storage type of the vault identified by client
+ ///
+ ///
+ public void UpdateStorageType(string storageType)
+ {
+ UpdateVaultStorageTypeRequest updateVaultStorageTypeRequest = new UpdateVaultStorageTypeRequest()
+ {
+ StorageTypeProperties = new StorageTypeProperties()
+ {
+ StorageModelType = storageType,
+ },
+ };
+
+ AzureBackupVaultClient.Vault.UpdateStorageTypeAsync(updateVaultStorageTypeRequest, GetCustomRequestHeaders(), CmdletCancellationToken).Wait();
+ }
+
+ ///
+ /// Gets storage type details of the specified resource
+ ///
+ ///
+ public string GetStorageTypeDetails(string resourceGroupName, string vaultName)
+ {
+ string storageType = String.Empty;
+ try
+ {
+ var response = AzureBackupVaultClient.Vault.GetResourceStorageConfigAsync(resourceGroupName, vaultName, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ storageType = (response != null) ? response.StorageDetails.StorageType : null;
+ }
+ catch (Exception) { }
+
+ return storageType;
+ }
+
+ ///
+ /// Gets the vault identified by the client
+ ///
+ ///
+ public AzureBackupVault GetVault(string resourceGroupName, string vaultName)
+ {
+ var getResponse = AzureBackupVaultClient.Vault.GetAsync(resourceGroupName, vaultName, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ return (getResponse != null) ? getResponse.Vault : null;
+ }
+
+ ///
+ /// Gets backup vaults in current subscription
+ ///
+ ///
+ public IEnumerable GetVaults()
+ {
+ var listResponse = AzureBackupVaultClient.Vault.ListAsync(defaultTop, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ return (listResponse != null) ? listResponse.Vaults : null;
+ }
+
+ ///
+ /// Gets backup vaults in given resource group
+ ///
+ ///
+ ///
+ public IEnumerable GetVaultsInResourceGroup(string resourceGroupName)
+ {
+ var listResponse = AzureBackupVaultClient.Vault.ListByResourceGroupAsync(resourceGroupName, defaultTop, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ return (listResponse != null) ? listResponse.Vaults : null;
+ }
+
+ ///
+ /// Deletes the specified backup vault
+ ///
+ ///
+ ///
+ public void DeleteVault(string resourceGroupName, string vaultName)
+ {
+ AzureBackupVaultClient.Vault.DeleteAsync(resourceGroupName, vaultName, GetCustomRequestHeaders(), CmdletCancellationToken).Wait();
+ }
+
+ public VaultCredUploadCertResponse UploadCertificate(string certName, VaultCredUploadCertRequest request)
+ {
+ return AzureBackupVaultClient.Vault.UploadCertificateAsync(certName, request, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs
new file mode 100644
index 000000000000..68e8ea0d1955
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs
@@ -0,0 +1,140 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 Hyak.Common;
+using Microsoft.Azure.Commands.AzureBackup.ClientAdapter;
+using Microsoft.Azure.Commands.AzureBackup.Properties;
+using Microsoft.Azure.Common.Authentication;
+using Microsoft.Azure.Common.Authentication.Models;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Microsoft.WindowsAzure.Management.Scheduler;
+using System;
+using System.Management.Automation;
+using System.Net;
+using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ public abstract class AzureBackupCmdletBase : AzurePSCmdlet
+ {
+ ///
+ /// Azure backup client.
+ ///
+ private AzureBackupClientAdapter azureBackupClientAdapter;
+
+ ///
+ /// Get Azure backup client.
+ ///
+ protected AzureBackupClientAdapter AzureBackupClient
+ {
+ get
+ {
+ return this.azureBackupClientAdapter;
+ }
+ }
+
+ ///
+ /// Initializes required client adapters
+ ///
+ ///
+ ///
+ protected void InitializeAzureBackupCmdlet(string rgName, string rName)
+ {
+ var cloudServicesClient = AzureSession.ClientFactory.CreateClient(Profile, Profile.Context.Subscription, AzureEnvironment.Endpoint.ResourceManager);
+ azureBackupClientAdapter = new AzureBackupClientAdapter(cloudServicesClient.Credentials, cloudServicesClient.BaseUri, rgName, rName);
+
+ WriteDebug(string.Format("Initialized AzureBackup Cmdlet, ClientRequestId: {0}, ResourceGroupName: {1}, ResourceName : {2}", azureBackupClientAdapter.GetClientRequestId(), rgName, rName));
+ }
+
+ ///
+ /// Initializes required client adapters
+ ///
+ ///
+ protected void InitializeAzureBackupCmdlet(CmdletModel.AzurePSBackupVault vault)
+ {
+ InitializeAzureBackupCmdlet(vault.ResourceGroupName, vault.Name);
+ }
+
+ protected void ExecutionBlock(Action execAction)
+ {
+ try
+ {
+ execAction();
+ }
+ catch (Exception exception)
+ {
+ WriteDebug(String.Format("Caught exception, type: {0}", exception.GetType()));
+ HandleException(exception);
+ }
+ }
+
+ ///
+ /// Handles set of exceptions thrown by client
+ ///
+ ///
+ private void HandleException(Exception exception)
+ {
+ if (exception is AggregateException && ((AggregateException)exception).InnerExceptions != null
+ && ((AggregateException)exception).InnerExceptions.Count != 0)
+ {
+ WriteDebug("Handling aggregate exception");
+ foreach (var innerEx in ((AggregateException)exception).InnerExceptions)
+ {
+ HandleException(innerEx);
+ }
+ }
+ else
+ {
+ Exception targetEx = exception;
+ string targetErrorId = String.Empty;
+ ErrorCategory targetErrorCategory = ErrorCategory.NotSpecified;
+
+ if (exception is CloudException)
+ {
+ var cloudEx = exception as CloudException;
+ if (cloudEx.Response != null && cloudEx.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ WriteDebug(String.Format("Received CloudException, StatusCode: {0}", cloudEx.Response.StatusCode));
+
+ targetEx = new Exception(Resources.ResourceNotFoundMessage);
+ targetErrorCategory = ErrorCategory.InvalidArgument;
+ }
+ else if (cloudEx.Error != null)
+ {
+ WriteDebug(String.Format("Received CloudException, ErrorCode: {0}, Message: {1}", cloudEx.Error.Code, cloudEx.Error.Message));
+
+ targetErrorId = cloudEx.Error.Code;
+ targetErrorCategory = ErrorCategory.InvalidOperation;
+ }
+ }
+ else if (exception is WebException)
+ {
+ var webEx = exception as WebException;
+ WriteDebug(string.Format("Received WebException, Response: {0}, Status: {1}", webEx.Response, webEx.Status));
+
+ targetErrorCategory = ErrorCategory.ConnectionError;
+ }
+ else if (exception is ArgumentException || exception is ArgumentNullException)
+ {
+ WriteDebug(string.Format("Received ArgumentException"));
+ targetErrorCategory = ErrorCategory.InvalidArgument;
+ }
+
+ var errorRecord = new ErrorRecord(targetEx, targetErrorId, targetErrorCategory, null);
+ WriteError(errorRecord);
+ }
+ }
+ }
+}
+
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs
new file mode 100644
index 000000000000..9d2719413564
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs
@@ -0,0 +1,26 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.
+// ----------------------------------------------------------------------------------
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ internal static class AzureBackupCmdletHelpMessage
+ {
+ public const string Vault = "The vault details";
+ public const string ResourceGroupName = "The ResourceGroup name.";
+ public const string ResourceName = "The Resource name.";
+ public const string Location = "The resource location.";
+ public const string TargetLocation = "The directory where the credentials file will be saved. This must be an absolute path.";
+ public const string StorageType = "The vault back-end storage type.";
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupVaultCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupVaultCmdletBase.cs
new file mode 100644
index 000000000000..9ceac2e2fe68
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupVaultCmdletBase.cs
@@ -0,0 +1,34 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Commands.AzureBackup.Models;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ public abstract class AzureBackupVaultCmdletBase : AzureBackupCmdletBase
+ {
+ [Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.Vault, ValueFromPipeline = true)]
+ [ValidateNotNullOrEmpty]
+ public AzurePSBackupVault Vault { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+ Vault.Validate();
+
+ InitializeAzureBackupCmdlet(Vault);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/GetAzureBackupVault.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/GetAzureBackupVault.cs
new file mode 100644
index 000000000000..9f05845750a4
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/GetAzureBackupVault.cs
@@ -0,0 +1,83 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Commands.AzureBackup.Helpers;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using Microsoft.Azure.Management.BackupServices.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Command to get azure backup vaults in a subscription
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureBackupVault"), OutputType(typeof(AzurePSBackupVault), typeof(List))]
+ public class GetAzureBackupVault : AzureBackupCmdletBase
+ {
+ [Parameter(Position = 0, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ResourceGroupName)]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Parameter(Position = 1, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ResourceName)]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+ InitializeAzureBackupCmdlet(String.Empty, String.Empty);
+
+ if (ResourceGroupName != null && Name != null)
+ {
+ var backupVault = AzureBackupClient.GetVault(ResourceGroupName, Name);
+ WriteObject(VaultHelpers.GetCmdletVault(backupVault, AzureBackupClient.GetStorageTypeDetails(VaultHelpers.GetResourceGroup(backupVault.Id), backupVault.Name)));
+ }
+ else if (ResourceGroupName != null)
+ {
+ var backupVaults = AzureBackupClient.GetVaultsInResourceGroup(ResourceGroupName);
+ WriteObject(GetCmdletVaults(backupVaults), true);
+ }
+ else
+ {
+ var backupVaults = AzureBackupClient.GetVaults();
+
+ if (Name != null)
+ {
+ backupVaults = backupVaults.Where(x => x.Name.Equals(Name, StringComparison.InvariantCultureIgnoreCase));
+ }
+ WriteObject(GetCmdletVaults(backupVaults), true);
+ }
+ });
+ }
+
+ private IEnumerable GetCmdletVaults(IEnumerable backupVaults)
+ {
+ List resultList = new List();
+ if (backupVaults != null)
+ {
+ foreach (var backupVault in backupVaults)
+ {
+ resultList.Add(VaultHelpers.GetCmdletVault(backupVault, AzureBackupClient.GetStorageTypeDetails(VaultHelpers.GetResourceGroup(backupVault.Id), backupVault.Name)));
+ }
+ }
+
+ return resultList;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/NewAzureBackupVault.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/NewAzureBackupVault.cs
new file mode 100644
index 000000000000..6bc443c4273f
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/NewAzureBackupVault.cs
@@ -0,0 +1,70 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Commands.AzureBackup.Helpers;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using System;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Command to create an azure backup vault in a subscription
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureBackupVault"), OutputType(typeof(AzurePSBackupVault))]
+ public class NewAzureBackupVault : AzureBackupCmdletBase
+ {
+ [Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.ResourceGroupName)]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Parameter(Position = 1, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.ResourceName)]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(Position = 2, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.Location)]
+ [ValidateNotNullOrEmpty]
+ public string Region { get; set; }
+
+ [Parameter(Position = 3, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.StorageType)]
+ public AzureBackupVaultStorageType Storage { get; set; }
+
+ // TODO: Add support for tags
+ //[Alias("Tags")]
+ //[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ResourceTags)]
+ //public Hashtable[] Tag { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+ InitializeAzureBackupCmdlet(ResourceGroupName, Name);
+
+ WriteDebug(String.Format("Creating backup vault with ResourceGroupName: {0}, ResourceName: {1}", ResourceGroupName, Name));
+
+ var createdVault = AzureBackupClient.CreateOrUpdateAzureBackupVault(ResourceGroupName, Name, Region);
+
+ if (Storage != 0)
+ {
+ WriteDebug(String.Format("Setting storage type for the resource, Type: {0}", Storage));
+
+ AzureBackupClient.UpdateStorageType(Storage.ToString());
+ }
+
+ WriteObject(VaultHelpers.GetCmdletVault(createdVault, AzureBackupClient.GetStorageTypeDetails(VaultHelpers.GetResourceGroup(createdVault.Id), createdVault.Name)));
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/RemoveAzureBackupVault.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/RemoveAzureBackupVault.cs
new file mode 100644
index 000000000000..6124f3a43bed
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/RemoveAzureBackupVault.cs
@@ -0,0 +1,35 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Command to remove an azure backup vault in the subscription
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureBackupVault")]
+ public class RemoveAzureBackupVault : AzureBackupVaultCmdletBase
+ {
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+
+ AzureBackupClient.DeleteVault(Vault.ResourceGroupName, Vault.Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/SetAzureBackupVault.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/SetAzureBackupVault.cs
new file mode 100644
index 000000000000..82b01c2e7200
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/SetAzureBackupVault.cs
@@ -0,0 +1,55 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Commands.AzureBackup.Helpers;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using System;
+using System.Management.Automation;
+using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Command to update an azure backup vault in a subscription.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureBackupVault"), OutputType(typeof(CmdletModel.AzurePSBackupVault))]
+ public class SetAzureBackupVault : AzureBackupVaultCmdletBase
+ {
+ [Parameter(Position = 1, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.StorageType)]
+ public AzureBackupVaultStorageType Storage { get; set; }
+
+ // TODO: Add support for tags
+ //[Alias("Tags")]
+ //[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ResourceTags)]
+ //public Hashtable[] Tag { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+
+ ExecutionBlock(() =>
+ {
+ if (Storage != 0)
+ {
+ WriteDebug(String.Format("Setting storage type for the resource, Type: {0}", Storage));
+
+ AzureBackupClient.UpdateStorageType(Storage.ToString());
+ }
+
+ var backupVault = AzureBackupClient.GetVault(Vault.ResourceGroupName, Vault.Name);
+ WriteObject(VaultHelpers.GetCmdletVault(backupVault, AzureBackupClient.GetStorageTypeDetails(Vault.ResourceGroupName, Vault.Name)));
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs
new file mode 100644
index 000000000000..ef4324c83763
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs
@@ -0,0 +1,218 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Azure.Commands.AzureBackup.Library;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using Microsoft.Azure.Management.BackupServices.Models;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Management.Automation;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Xml;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Command to download an azure backup vault's credentials.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureBackupVaultCredentials"), OutputType(typeof(string))]
+ public class GetAzureBackupVaultCredentials : AzureBackupVaultCmdletBase
+ {
+ [Parameter(Position = 2, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.TargetLocation)]
+ [ValidateNotNullOrEmpty]
+ public string TargetLocation { get; set; }
+
+ private const int VaultCertificateExpiryInHoursForBackup = 48;
+
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+
+ if (!Directory.Exists(TargetLocation))
+ {
+ throw new ArgumentException("The target location provided is not a directory. Please provide a directory.");
+ }
+
+ string subscriptionId = Profile.DefaultSubscription.Id.ToString();
+ string resourceType = "BackupVault";
+ string displayName = subscriptionId + "_" + Vault.ResourceGroupName + "_" + Vault.Name;
+
+ WriteDebug(string.Format(CultureInfo.InvariantCulture,
+ "Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}",
+ subscriptionId, Vault.ResourceGroupName, Vault.Name, TargetLocation));
+
+ X509Certificate2 cert = CertUtils.CreateSelfSignedCert(CertUtils.DefaultIssuer,
+ CertUtils.GenerateCertFriendlyName(subscriptionId, Vault.Name),
+ CertUtils.DefaultPassword,
+ DateTime.UtcNow.AddMinutes(-10),
+ DateTime.UtcNow.AddHours(this.GetCertificateExpiryInHours()));
+
+ AcsNamespace acsNamespace = new AcsNamespace();
+ string channelIntegrityKey = string.Empty;
+ try
+ {
+ // Upload cert into ID Mgmt
+ WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Going to upload the certificate"));
+ acsNamespace = UploadCert(cert, subscriptionId, Vault.Name, resourceType, Vault.ResourceGroupName);
+ WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Successfully uploaded the certificate"));
+ }
+ catch (Exception exception)
+ {
+ throw exception;
+ }
+
+ // generate vault credentials
+ string vaultCredsFileContent = GenerateVaultCreds(cert, subscriptionId, resourceType, acsNamespace);
+
+ // NOTE: One of the scenarios for this cmdlet is to generate a file which will be an input to DPM servers.
+ // We found a bug in the DPM UI which is looking for a particular namespace in the input file.
+ // The below is a hack to circumvent this issue and this would be removed once the bug can be fixed.
+ vaultCredsFileContent = vaultCredsFileContent.Replace("Microsoft.Azure.Commands.AzureBackup.Models",
+ "Microsoft.Azure.Portal.RecoveryServices.Models.Common");
+
+ // prepare for download
+ string fileName = string.Format("{0}_{1}.VaultCredentials", displayName, DateTime.UtcNow.ToString("yyyy-dd-M--HH-mm-ss"));
+ string directoryPath = Path.GetDirectoryName(TargetLocation);
+ if (directoryPath == null)
+ {
+ // TargetLocation is a root path
+ directoryPath = TargetLocation;
+ }
+ string filePath = Path.Combine(directoryPath, fileName);
+ WriteDebug(string.Format("Saving Vault Credentials to file : {0}", filePath));
+
+ File.WriteAllBytes(filePath, Encoding.UTF8.GetBytes(vaultCredsFileContent));
+
+ // Output filename back to user
+ WriteObject(fileName);
+ });
+ }
+
+ ///
+ /// Method to return the Certificate Expiry time in hours
+ ///
+ ///
+ ///
+ private int GetCertificateExpiryInHours(string resourceType = null)
+ {
+ return VaultCertificateExpiryInHoursForBackup;
+ }
+
+ ///
+ /// Upload certificate
+ ///
+ /// management certificate
+ /// subscription Id
+ /// resource name
+ /// resource type
+ /// resource group name
+ /// acs namespace of the uploaded cert
+ private AcsNamespace UploadCert(X509Certificate2 cert, string subscriptionId, string resourceName, string resourceType, string resourceGroupName)
+ {
+ string rawCertDataString = Convert.ToBase64String(cert.RawData);
+ VaultCredUploadCertRequest vaultCredUploadCertRequest = new VaultCredUploadCertRequest()
+ {
+ RawCertificateData = new RawCertificateData()
+ {
+ Certificate = rawCertDataString,
+ },
+ };
+
+ var vaultCredUploadCertResponse = AzureBackupClient.UploadCertificate("IdMgmtInternalCert", vaultCredUploadCertRequest);
+
+ return new AcsNamespace(vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsHostName,
+ vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsNamespace,
+ vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsRPRealm);
+ }
+
+ ///
+ /// Generates vault creds file
+ ///
+ /// management certificate
+ /// subscription Id
+ /// resource type
+ /// display name
+ /// acs namespace
+ /// xml file in string format
+ private string GenerateVaultCreds(X509Certificate2 cert, string subscriptionId, string resourceType, AcsNamespace acsNamespace)
+ {
+ try
+ {
+ return GenerateVaultCredsForBackup(cert, subscriptionId, resourceType, acsNamespace);
+ }
+ catch (Exception exception)
+ {
+ throw exception;
+ }
+ }
+
+ ///
+ /// Generates vault creds file content for backup Vault
+ ///
+ /// management certificate
+ /// subscription Id
+ /// resource type
+ /// display name
+ /// acs namespace
+ /// xml file in string format
+ private string GenerateVaultCredsForBackup(X509Certificate2 cert, string subscriptionId, string resourceType, AcsNamespace acsNamespace)
+ {
+ using (var output = new MemoryStream())
+ {
+ using (var writer = XmlWriter.Create(output, GetXmlWriterSettings()))
+ {
+ BackupVaultCreds backupVaultCreds = new BackupVaultCreds(subscriptionId,
+ resourceType,
+ Vault.Name,
+ CertUtils.SerializeCert(cert, X509ContentType.Pfx),
+ acsNamespace,
+ GetAgentLinks());
+ DataContractSerializer serializer = new DataContractSerializer(typeof(BackupVaultCreds));
+ serializer.WriteObject(writer, backupVaultCreds);
+
+ WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Backup Vault - Successfully serialized the file content"));
+ }
+
+ return Encoding.UTF8.GetString(output.ToArray());
+ }
+ }
+
+ private static string GetAgentLinks()
+ {
+ return "WABUpdateKBLink,http://go.microsoft.com/fwlink/p/?LinkId=229525;" +
+ "StorageQuotaPurchaseLink,http://go.microsoft.com/fwlink/?LinkId=205490;" +
+ "WebPortalLink,http://go.microsoft.com/fwlink/?LinkId=252913;" +
+ "WABprivacyStatement,http://go.microsoft.com/fwlink/?LinkId=221308";
+ }
+
+ ///
+ /// A set of XmlWriterSettings to use for the publishing profile
+ ///
+ /// The XmlWriterSettings set
+ private XmlWriterSettings GetXmlWriterSettings()
+ {
+ return new XmlWriterSettings
+ {
+ Encoding = new UTF8Encoding(false),
+ Indent = true,
+ NewLineOnAttributes = true
+ };
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
new file mode 100644
index 000000000000..b581a19ef2a3
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
@@ -0,0 +1,179 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {6C8D2337-C9D1-4F52-94B3-AB63A19F3453}
+ Library
+ Properties
+ Microsoft.Azure.Commands.AzureBackup
+ Microsoft.Azure.Commands.AzureBackup
+ v4.5
+ 512
+
+ ..\..\..\
+ true
+
+
+ true
+ full
+ false
+ ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureBackup\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+ false
+ true
+ true
+ MinimumRecommendedRules.ruleset
+
+
+ ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureBackup\
+ TRACE;SIGN
+ true
+ pdbonly
+ AnyCPU
+ prompt
+ MinimumRecommendedRules.ruleset
+ true
+ MSSharedLibKey.snk
+ true
+ false
+
+
+
+ ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+
+
+ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.0-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll
+
+
+ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+
+
+ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
+
+
+ ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
+
+
+ ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll
+
+
+ False
+ Cmdlets\VaultCredentials\Microsoft.WindowsAzure.Management.Common.dll
+
+
+ ..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll
+
+
+ ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll
+
+
+ Cmdlets\VaultCredentials\Security.Cryptography.dll
+
+
+
+
+
+
+ False
+ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll
+
+
+ False
+ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+
+ Always
+ Designer
+
+
+
+ Designer
+
+
+
+
+ ResXFileCodeGenerator
+ Designer
+ Resources.Designer.cs
+
+
+
+
+ Always
+
+
+
+
+
+
+ {5ee72c53-1720-4309-b54b-5fb79703195f}
+ Commands.Common
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/VaultHelpers.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/VaultHelpers.cs
new file mode 100644
index 000000000000..a1d9d69b5b54
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/VaultHelpers.cs
@@ -0,0 +1,54 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System;
+using ClientModel = Microsoft.Azure.Management.BackupServices.Models;
+using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Helpers
+{
+ internal static class VaultHelpers
+ {
+ ///
+ /// Gets CmdletModel of backup vault from Client model
+ ///
+ ///
+ ///
+ ///
+ public static CmdletModel.AzurePSBackupVault GetCmdletVault(ClientModel.AzureBackupVault vault, string storageType)
+ {
+ var response = new CmdletModel.AzurePSBackupVault
+ {
+ ResourceId = vault.Id,
+ Name = vault.Name,
+ Region = vault.Location,
+ ResourceGroupName = GetResourceGroup(vault.Id),
+ Storage = storageType,
+ };
+
+ return response;
+ }
+
+ ///
+ /// Gets ResourceGroup from vault ID
+ ///
+ ///
+ ///
+ public static string GetResourceGroup(string vaultId)
+ {
+ string[] tokens = vaultId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
+ return tokens[3];
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Library/CertUtils.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Library/CertUtils.cs
new file mode 100644
index 000000000000..0ed7a5d87e4a
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Library/CertUtils.cs
@@ -0,0 +1,127 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Management;
+using Microsoft.WindowsAzure.Management.EventSources;
+using Security.Cryptography;
+using Security.Cryptography.X509Certificates;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Library
+{
+ ///
+ /// Certificate utility methods
+ ///
+ public class CertUtils
+ {
+ public const string MsEnhancedProv = "Microsoft Enhanced Cryptographic Provider v1.0";
+ public const string DefaultIssuer = "CN=Windows Azure Tools";
+
+ public const string DefaultPassword = "";
+ public const string OIDClientAuthValue = "1.3.6.1.5.5.7.3.2";
+ public const string OIDClientAuthFriendlyName = "Client Authentication";
+ public const int KeySize2048 = 2048;
+
+ ///
+ /// Windows Azure Service Management API requires 2048bit RSA keys.
+ /// The private key needs to be exportable so we can save it to .pfx for sharing with team members.
+ ///
+ /// A 2048 bit RSA key
+ private static CngKey Create2048RsaKey()
+ {
+ var keyCreationParameters = new CngKeyCreationParameters
+ {
+ ExportPolicy = CngExportPolicies.AllowExport,
+ KeyCreationOptions = CngKeyCreationOptions.None,
+ KeyUsage = CngKeyUsages.AllUsages,
+ Provider = new CngProvider(MsEnhancedProv)
+ };
+
+ keyCreationParameters.Parameters.Add(new CngProperty("Length", BitConverter.GetBytes(KeySize2048), CngPropertyOptions.None));
+
+ return CngKey.Create(CngAlgorithm2.Rsa, null, keyCreationParameters);
+ }
+
+ ///
+ /// Creates a new self-signed X509 certificate
+ ///
+ /// The certificate issuer
+ /// Human readable name
+ /// The certificate's password
+ /// Certificate creation date & time
+ /// Certificate expiry date & time
+ /// An X509Certificate2
+ public static X509Certificate2 CreateSelfSignedCert(string issuer, string friendlyName, string password, DateTime startTime, DateTime endTime)
+ {
+ string distinguishedNameString = issuer;
+ var key = Create2048RsaKey();
+
+ var creationParams = new X509CertificateCreationParameters(new X500DistinguishedName(distinguishedNameString))
+ {
+ TakeOwnershipOfKey = true,
+ StartTime = startTime,
+ EndTime = endTime
+ };
+
+ // adding client authentication, -eku = 1.3.6.1.5.5.7.3.2,
+ // This is mandatory for the upload to be successful
+ OidCollection oidCollection = new OidCollection();
+ oidCollection.Add(new Oid(OIDClientAuthValue, OIDClientAuthFriendlyName));
+ creationParams.Extensions.Add(new X509EnhancedKeyUsageExtension(oidCollection, false));
+
+ // Documentation of CreateSelfSignedCertificate states:
+ // If creationParameters have TakeOwnershipOfKey set to true, the certificate
+ // generated will own the key and the input CngKey will be disposed to ensure
+ // that the caller doesn't accidentally use it beyond its lifetime (which is
+ // now controlled by the certificate object).
+ // We don't dispose it ourselves in this case.
+ var cert = key.CreateSelfSignedCertificate(creationParams);
+ key = null;
+ cert.FriendlyName = friendlyName;
+
+ // X509 certificate needs PersistKeySet flag set.
+ // Reload a new X509Certificate2 instance from exported bytes in order to set the PersistKeySet flag.
+ var bytes = cert.Export(X509ContentType.Pfx, password);
+
+ // NOTE: PfxValidation is not done here because these are newly created certs and assumed valid.
+
+ ICommonEventSource evtSource = null;
+ return X509Certificate2Helper.NewX509Certificate2(bytes, password, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable, evtSource, doPfxValidation: false);
+ }
+
+ ///
+ /// Returns serialized certificate - Base64 encoded based on the content type
+ ///
+ /// The certificate provided
+ /// Cert content type
+ /// The serialized cert value in string
+ public static string SerializeCert(X509Certificate2 cert, X509ContentType contentType)
+ {
+ return Convert.ToBase64String(cert.Export(contentType));
+ }
+
+ ///
+ /// Generates friendly name
+ ///
+ /// Subscription id
+ /// Prefix, likely resource name
+ /// Friendly name
+ public static string GenerateCertFriendlyName(string subscriptionId, string prefix = "")
+ {
+ return string.Format("{0}{1}-{2}-vaultcredentials", prefix, subscriptionId, DateTime.Now.ToString("M-d-yyyy"));
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/MSSharedLibKey.snk b/src/ResourceManager/AzureBackup/Commands.AzureBackup/MSSharedLibKey.snk
new file mode 100644
index 000000000000..695f1b38774e
Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/MSSharedLibKey.snk differ
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.psd1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.psd1
new file mode 100644
index 000000000000..7abd2c521bb9
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.psd1
@@ -0,0 +1,88 @@
+#
+# Module manifest for module 'Microsoft.WindowsAzure.Commands.AzureBackup'
+#
+# Generated by: Microsoft Corporation
+#
+# Generated on: 1/18/2015
+#
+
+@{
+
+# Version number of this module.
+ModuleVersion = '1.0'
+
+# ID used to uniquely identify this module
+GUID = 'bbe363aa-27da-4af9-9cd4-b9bad23bd58d'
+
+# Author of this module
+Author = 'Microsoft Corporation'
+
+# Company or vendor of this module
+CompanyName = 'Microsoft Corporation'
+
+# Copyright statement for this module
+Copyright = '© Microsoft Corporation. All rights reserved.'
+
+# Description of the functionality provided by this module
+Description = ''
+
+# Minimum version of the Windows PowerShell engine required by this module
+PowerShellVersion = '3.0'
+
+# Name of the Windows PowerShell host required by this module
+PowerShellHostName = ''
+
+# Minimum version of the Windows PowerShell host required by this module
+PowerShellHostVersion = ''
+
+# Minimum version of the .NET Framework required by this module
+DotNetFrameworkVersion = '4.0'
+
+# Minimum version of the common language runtime (CLR) required by this module
+CLRVersion='4.0'
+
+# Processor architecture (None, X86, Amd64, IA64) required by this module
+ProcessorArchitecture = 'None'
+
+# Modules that must be imported into the global environment prior to importing this module
+RequiredModules = @()
+
+# Assemblies that must be loaded prior to importing this module
+RequiredAssemblies = @()
+
+# Script files (.ps1) that are run in the caller's environment prior to importing this module
+ScriptsToProcess = @()
+
+# Type files (.ps1xml) to be loaded when importing this module
+TypesToProcess = @()
+
+# Format files (.ps1xml) to be loaded when importing this module
+FormatsToProcess = @()
+
+# Modules to import as nested modules of the module specified in ModuleToProcess
+NestedModules = @(
+ '..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureBackup\Microsoft.Azure.Commands.AzureBackup.dll'
+)
+
+# Functions to export from this module
+FunctionsToExport = '*'
+
+# Cmdlets to export from this module
+CmdletsToExport = '*'
+
+# Variables to export from this module
+VariablesToExport = '*'
+
+# Aliases to export from this module
+AliasesToExport = @()
+
+# List of all modules packaged with this module
+ModuleList = @()
+
+# List of all files packaged with this module
+FileList = @()
+
+# Private data to pass to the module specified in ModuleToProcess
+PrivateData = ''
+
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.xml b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.xml
new file mode 100644
index 000000000000..732d973175bf
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.dll-help.xml
@@ -0,0 +1,884 @@
+
+
+
+
+ Get-AzureBackupVault
+
+ Retrieves one or more vault objects based on the parameters that are specified.
+
+
+
+
+ Get
+ AzureBackupVault
+
+
+
+ The Get-AzureBackupVault commandlet retrieves existing Azure Backup vaults and returns objects of type AzurePSBackupVault. The vault object is used in some Azure Backup commandlets as a mandatory parameter.
+
+
+
+ Get-AzureBackupVault
+
+ ResourceGroupName
+
+ The Azure resource group under which the vault was created.
+
+ String
+
+
+ Name
+
+ The name of the specific Azure Backup vault that needs to be retrieved. If no name is specified, then the commandlet returns all the vaults created by the subscription. If there is more than 1 backup vault with the same name then the commandlet returns all the vaults that match the name. Use the -ResourceGroupName parameter to filter results and get a unique vault.
+
+ String
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ ResourceGroupName
+
+ The Azure resource group under which the vault was created.
+
+ String
+
+ String
+
+
+
+
+
+ Name
+
+ The name of the specific Azure Backup vault that needs to be retrieved. If no name is specified, then the commandlet returns all the vaults created by the subscription. If there is more than 1 backup vault with the same name then the commandlet returns all the vaults that match the name. Use the -ResourceGroupName parameter to filter results and get a unique vault.
+
+ String
+
+ String
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ Vault name as [String]
+
+
+
+
+ This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+ This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- View all the Azure Backup vaults created --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Get a list of all vaults created in West US --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault | Where-Object { $_.Region -eq "westus" }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Get a reference to a specific vault --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault -Name "myvault"
+
+
+
+
+ ResourceId : /subscriptions/4bfbe168-f42a-4a06-8f5a-331cad1f497e/resourceGroups/rg1/providers/Microsoft.Backup
+ /BackupVault/myvault
+Name : myvault
+ResourceGroupName : rg1
+Region : westus
+Storage : GeoRedundant
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Count the number of vaults having Locally Redundant Storage --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault | Where-Object { $_.Storage –match ‘LocallyRedundant’ } | Measure-Object
+
+
+
+
+ Count : 4
+Average :
+Sum :
+Maximum :
+Minimum :
+Property :
+
+
+
+
+
+
+
+
+
+
+
+
+ New-AzureBackupVault
+
+
+
+ Set-AzureBackupVault
+
+
+
+ Remove-AzureBackupVault
+
+
+
+ Get-AzureBackupContainer
+
+
+
+
+
+
+
+ Get-AzureBackupVaultCredentials
+
+ Downloads the Vault Credentials file to a specified location.
+
+
+
+
+ Get
+ AzureBackupVaultCredentials
+
+
+
+ To enable hybrid backup scenarios the Vault Credentials file is a critical component. The vault credential file is used to connect a server to the Azure Backup vault and register it. Only after registration can backup data be sent to the vault. The Get-AzureBackupVaultCredentials commandlet downloads and places a vault credential file at the location specified by the user.
+
+
+
+ Get-AzureBackupVaultCredentials
+
+ TargetLocation
+
+ The destination path where the Vault Credentials file should be placed.
+
+ String
+
+
+ Vault
+
+ The specific Azure Backup vault object for which the Vault Credential file is generated.
+
+ AzurePSBackupVault
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ TargetLocation
+
+ The destination path where the Vault Credentials file should be placed.
+
+ String
+
+ String
+
+
+
+
+
+ Vault
+
+ The specific Azure Backup vault object for which the Vault Credential file is generated.
+
+ AzurePSBackupVault
+
+ AzurePSBackupVault
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+
+This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ Vault Credentials file name as [String]
+
+
+
+
+
+This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- Download a Vault Credentials file --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVaultCredentials -Vault $vaultobj -TargetLocation "C:\users\admin\Desktop"
+
+ This will place the vault credentials file at the user-specified location.
+
+
+ f5303a0b-fae4-4cdb-b44d-0e4c032dde26_backuprg_backuprn_2015-06-7--06-22-35.VaultCredentials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ New-AzureBackupVault
+
+ Creates a new Azure Backup vault based on the parameters that are specified. A vault is the start point for all backup operations with Azure Backup.
+
+
+
+
+ New
+ AzureBackupVault
+
+
+
+ The New-AzureBackupVault commandlet creates and Azure Backup vault and returns an object of type AzurePSBackupVault that acts as a reference to the vault entity. The vault has some important properties that define the scope of backup – the region and the storage type.
+
+
+
+ New-AzureBackupVault
+
+ ResourceGroupName
+
+ Specifies the name of an existing resource group. In order to create a resource group, use the New-AzureResourceGroup commandlet. There is no requirement that the Azure ResourceGroup and the Azure Backup vault be in the same region.
+
+ String
+
+
+ Name
+
+ Specifies the name of the Azure Backup vault. The combination of ResourceGroupName and Name must be unique. You cannot create two vaults with the same name under the same ResourceGroup, but two vaults with the same name can be placed under two different Resource Groups.
+
+ String
+
+
+ Region
+
+ The region parameter places the vault object into a specific Azure region. For hybrid backup scenarios, it is advised to create a vault in a region close to the on-premise server to reduce latency. For backup of Azure IaaS virtual machines, the vault becomes the point of discovery for local virtual machines.
+
+ String
+
+
+ Storage
+
+ Backup storage is billed at Azure Storage rates and users can choose between LocallyRedundant and GeoRedundant as the storage for the backup data. Since this is an optional parameter, if it is not specified then the vault is created with the GeoRedundant Storage option.
+
+ AzureBackupVaultStorageType
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ ResourceGroupName
+
+ Specifies the name of an existing resource group. In order to create a resource group, use the New-AzureResourceGroup commandlet. There is no requirement that the Azure ResourceGroup and the Azure Backup vault be in the same region.
+
+ String
+
+ String
+
+
+
+
+
+ Name
+
+ Specifies the name of the Azure Backup vault. The combination of ResourceGroupName and Name must be unique. You cannot create two vaults with the same name under the same ResourceGroup, but two vaults with the same name can be placed under two different Resource Groups.
+
+ String
+
+ String
+
+
+
+
+
+ Region
+
+ The region parameter places the vault object into a specific Azure region. For hybrid backup scenarios, it is advised to create a vault in a region close to the on-premise server to reduce latency. For backup of Azure IaaS virtual machines, the vault becomes the point of discovery for local virtual machines.
+
+ String
+
+ String
+
+
+
+
+
+ Storage
+
+ Backup storage is billed at Azure Storage rates and users can choose between LocallyRedundant and GeoRedundant as the storage for the backup data. Since this is an optional parameter, if it is not specified then the vault is created with the GeoRedundant Storage option.
+
+ AzureBackupVaultStorageType
+
+ AzureBackupVaultStorageType
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+ This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- Create a new backup vault --------------------------
+
+ PS C:\>
+
+ New-AzureBackupVault –ResourceGroupName “rg1” –Name “vault1” –Region “westus”
+
+
+
+
+ ResourceId : /subscriptions/4bfbe168-f42a-4a06-8f5a-331cad1f497e/resourceGroups/rg1/providers/Microsoft.Backup
+ /BackupVault/vault1
+Name : vault1
+ResourceGroupName : rg1
+Region : westus
+Storage : GeoRedundant
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Create a new backup vault with Locally Redundant Storage --------------------------
+
+ PS C:\>
+
+ New-AzureBackupVault –ResourceGroupName “rg2” –Name “vault2” –Region “westus” –Storage LocallyRedundant
+
+
+
+
+ ResourceId : /subscriptions/4bfbe168-f42a-4a06-8f5a-331cad1f497e/resourceGroups/rg2/providers/Microsoft.Backup
+ /BackupVault/vault2
+Name : vault2
+ResourceGroupName : rg2
+Region : westus
+Storage : LocallyRedundant
+
+
+
+
+
+
+
+
+
+
+
+
+ New-AzureResourceGroup
+ https://msdn.microsoft.com/en-us/library/dn654594.aspx
+
+
+ Get-AzureBackupVault
+
+
+
+ Set-AzureBackupVault
+
+
+
+ Remove-AzureBackupVault
+
+
+
+
+
+
+
+ Remove-AzureBackupVault
+
+ Deletes the Azure Backup vault object based on the parameters that are specified.
+
+
+
+
+ Remove
+ AzureBackupVault
+
+
+
+ The Remove-AzureBackupVault commandlet deletes the backup vault. However, before a vault can be removed, it must first be empty – it must contain no backup data or protected items or registered servers. This ensures that a vault cannot be deleted inadvertently; the deletion of a backup vault is a planned operation.
+ Use the Remove-AzureBackupContainer commandlet to clear up IaaS VM backup data from the vault, or use the Delete-RegisteredServer commandlet to clear up other registered servers and backup data.
+
+
+
+ Remove-AzureBackupVault
+
+ Vault
+
+ The specific Azure Backup vault object which needs to be removed.
+
+ AzurePSBackupVault
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ Vault
+
+ The specific Azure Backup vault object which needs to be removed.
+
+ AzurePSBackupVault
+
+ AzurePSBackupVault
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+ This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ None
+
+
+
+
+ This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- Delete an Azure Backup vault --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault -Name "myvault" | Remove-AzureBackupVault
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Remove-AzureBackupContainer
+
+
+
+ Delete-RegisteredServer
+
+
+
+ New-AzureBackupVault
+
+
+
+ Get-AzureBackupVault
+
+
+
+ Set-AzureBackupVault
+
+
+
+
+
+
+
+ Set-AzureBackupVault
+
+ Changes the properties of the Azure Backup vault object based on the parameters that are specified.
+
+
+
+
+ Set
+ AzureBackupVault
+
+
+
+ The Set-AzureBackupVault commandlet allows you to change the storage type of the backup vault. The other parameters like Region, Name, and ResourceGroupName are not editable.
+
+
+
+ Set-AzureBackupVault
+
+ Storage
+
+ Users can choose between LocallyRedundant and GeoRedundant as the storage for the backup data.
+
+ AzureBackupVaultStorageType
+
+
+ Vault
+
+ The specific Azure Backup vault object for which the properties need to be updated.
+
+ AzurePSBackupVault
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ Storage
+
+ Users can choose between LocallyRedundant and GeoRedundant as the storage for the backup data.
+
+ AzureBackupVaultStorageType
+
+ AzureBackupVaultStorageType
+
+
+
+
+
+ Vault
+
+ The specific Azure Backup vault object for which the properties need to be updated.
+
+ AzurePSBackupVault
+
+ AzurePSBackupVault
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+
+This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ None
+
+
+
+
+
+This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ The storage type is locked on the registration of the first server or virtual machine, and cannot be changed afterwards.
+
+
+
+
+ -------------------------- Change the storage for an existing vault --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupVault –Name “myvault” | Set-AzureBackupVault –Storage LocallyRedundant
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ New-AzureBackupVault
+
+
+
+ Get-AzureBackupVault
+
+
+
+ Remove-AzureBackupVault
+
+
+
+ Set-AzureBackupVaultStorageType
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
new file mode 100644
index 000000000000..ab415da71864
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
@@ -0,0 +1,42 @@
+
+
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzurePSBackupVault
+
+
+
+
+
+ 18
+
+
+
+ 18
+
+
+
+ 18
+
+
+
+
+
+
+ Name
+
+
+ Region
+
+
+ Storage
+
+
+
+
+
+
+
+
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs
new file mode 100644
index 000000000000..f427757a46b8
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs
@@ -0,0 +1,46 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.
+// ----------------------------------------------------------------------------------
+
+namespace Microsoft.Azure.Commands.AzureBackup.Models
+{
+ public class AzureBackupVaultContextObject
+ {
+ ///
+ /// ResourceGroupName of the azurebackup object
+ ///
+ public string ResourceGroupName { get; set; }
+
+ ///
+ /// ResourceName of the azurebackup object
+ ///
+ public string ResourceName { get; set; }
+
+ ///
+ /// ResourceName of the azurebackup object
+ ///
+ public string Location { get; set; }
+
+ public AzureBackupVaultContextObject() { }
+
+ public AzureBackupVaultContextObject(string resourceGroupName, string resourceName, string locationName)
+ {
+ ResourceGroupName = resourceGroupName;
+ ResourceName = resourceName;
+ Location = locationName;
+ }
+
+ public AzureBackupVaultContextObject(AzurePSBackupVault vault)
+ : this(vault.ResourceGroupName, vault.Name, vault.Region) { }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs
new file mode 100644
index 000000000000..79cc0f9b20c0
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs
@@ -0,0 +1,22 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.
+// ----------------------------------------------------------------------------------
+
+namespace Microsoft.Azure.Commands.AzureBackup.Models
+{
+ public enum AzureBackupVaultStorageType
+ {
+ GeoRedundant = 1,
+ LocallyRedundant,
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzurePSBackupVault.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzurePSBackupVault.cs
new file mode 100644
index 000000000000..62324a3a36ea
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzurePSBackupVault.cs
@@ -0,0 +1,58 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Models
+{
+ ///
+ /// Represents Azure Backup vault
+ ///
+ public class AzurePSBackupVault
+ {
+ public string ResourceId { get; set; }
+
+ public string Name { get; set; }
+
+ public string ResourceGroupName { get; set; }
+
+ public string Region { get; set; }
+
+ // public Hashtable[] Tags { get; protected set; }
+
+ public string Storage { get; set; }
+
+ public AzurePSBackupVault() : base() { }
+
+ public AzurePSBackupVault(string resourceGroupName, string resourceName, string region)
+ {
+ ResourceGroupName = resourceGroupName;
+ Name = resourceName;
+ Region = region;
+ }
+
+ internal void Validate()
+ {
+ if (String.IsNullOrEmpty(ResourceGroupName))
+ {
+ throw new ArgumentException("AzureBackupVault.ResourceGroupName");
+ }
+
+ if (String.IsNullOrEmpty(Name))
+ {
+ throw new ArgumentException("AzureBackupVault.Name");
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/VaultCredentials.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/VaultCredentials.cs
new file mode 100644
index 000000000000..54b533565d1e
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/VaultCredentials.cs
@@ -0,0 +1,178 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System.Diagnostics.CodeAnalysis;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Models
+{
+ ///
+ /// Class to define vault credentials
+ ///
+ [DataContract]
+ internal class VaultCreds
+ {
+ #region Properties
+
+ ///
+ /// Gets or sets the key name for SubscriptionId entry
+ ///
+ [DataMember(Order = 0)]
+ public string SubscriptionId { get; set; }
+
+ ///
+ /// Gets or sets the key name for ResourceType entry
+ ///
+ [DataMember(Order = 1)]
+ public string ResourceType { get; set; }
+
+ ///
+ /// Gets or sets the key name for ResourceName entry
+ ///
+ [DataMember(Order = 2)]
+ public string ResourceName { get; set; }
+
+ ///
+ /// Gets or sets the key name for ManagementCert entry
+ ///
+ [DataMember(Order = 3)]
+ public string ManagementCert { get; set; }
+
+ ///
+ /// Gets or sets the key name for AcsNamespace entry
+ ///
+ [DataMember(Order = 4)]
+ public AcsNamespace AcsNamespace { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the VaultCreds class
+ ///
+ public VaultCreds() { }
+
+ ///
+ /// Initializes a new instance of the VaultCreds class
+ ///
+ /// subscription id
+ /// resource type
+ /// resource name
+ /// management cert
+ /// acs namespace
+ public VaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace)
+ {
+ SubscriptionId = subscriptionId;
+ ResourceType = resourceType;
+ ResourceName = resourceName;
+ ManagementCert = managementCert;
+ AcsNamespace = acsNamespace;
+ }
+
+ #endregion
+ }
+
+ ///
+ /// Class to define backup vault credentials
+ ///
+ [SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Grouping classes based on entity")]
+ [DataContract]
+ internal class BackupVaultCreds : VaultCreds
+ {
+ ///
+ /// Gets or sets the agent links
+ ///
+ [DataMember(Order = 0)]
+ public string AgentLinks { get; set; }
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the BackupVaultCreds class
+ ///
+ public BackupVaultCreds() { }
+
+ ///
+ /// Initializes a new instance of the BackupVaultCreds class
+ ///
+ /// subscription Id
+ /// resource type
+ /// resource name
+ /// management cert
+ /// acs namespace
+ public BackupVaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace)
+ : base(subscriptionId, resourceType, resourceName, managementCert, acsNamespace) { }
+
+ ///
+ /// Initializes a new instance of the BackupVaultCreds class
+ ///
+ /// subscription Id
+ /// resource type
+ /// resource name
+ /// management cert
+ /// acs namespace
+ /// agent links
+ public BackupVaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace, string agentLinks)
+ : this(subscriptionId, resourceType, resourceName, managementCert, acsNamespace)
+ {
+ AgentLinks = agentLinks;
+ }
+
+ #endregion
+ }
+
+ ///
+ /// AcsNamespace is where the certificate is uploaded into
+ ///
+ [DataContract]
+ internal class AcsNamespace
+ {
+ ///
+ /// Gets or sets the key name for HostName entry
+ ///
+ [DataMember(Order = 0)]
+ public string HostName { get; set; }
+
+ ///
+ /// Gets or sets the key name for Namespace entry
+ ///
+ [DataMember(Order = 1)]
+ public string Namespace { get; set; }
+
+ ///
+ /// Gets or sets the value for ResourceProviderRealm entry
+ ///
+ [DataMember(Order = 2)]
+ public string ResourceProviderRealm { get; set; }
+
+ ///
+ /// Initializes a new instance of the AcsNamespace class
+ ///
+ public AcsNamespace() { }
+
+ ///
+ /// Initializes a new instance of the AcsNamespace class.
+ ///
+ /// host name
+ /// acs namespace
+ /// rp realm
+ public AcsNamespace(string hostName, string acsNmespace, string resourceProviderRealm)
+ {
+ this.HostName = hostName;
+ this.Namespace = acsNmespace;
+ this.ResourceProviderRealm = resourceProviderRealm;
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/AssemblyInfo.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000000..9cea209aa6cd
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Microsoft Azure Powershell")]
+[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
+[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
+[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+[assembly: CLSCompliant(false)]
+
+[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)]
+[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)]
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs
new file mode 100644
index 000000000000..58372d895579
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs
@@ -0,0 +1,81 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Microsoft.Azure.Commands.AzureBackup.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.AzureBackup.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The specified Azure Virtual Machine Not Found..
+ ///
+ internal static string AzureVMNotFound {
+ get {
+ return ResourceManager.GetString("AzureVMNotFound", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The specified resource does not exist..
+ ///
+ internal static string ResourceNotFoundMessage {
+ get {
+ return ResourceManager.GetString("ResourceNotFoundMessage", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx
new file mode 100644
index 000000000000..73ab213136b1
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ The specified Azure Virtual Machine Not Found.
+
+
+ The specified resource does not exist.
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll
new file mode 100644
index 000000000000..247f5d1a8c3e
Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll differ
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll
new file mode 100644
index 000000000000..6fe3849e1d73
Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll differ
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config
new file mode 100644
index 000000000000..7cf80c93199a
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
index ad3324c6e4bf..389e535075f2 100644
--- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
+++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1
@@ -1,4 +1,4 @@
-#
+#
# Module manifest for module 'Microsoft.Azure.Commands.Resources'
#
# Generated by: Microsoft Corporation
@@ -73,7 +73,8 @@ FormatsToProcess = @(
'.\Network\Microsoft.Azure.Commands.Network.format.ps1xml',
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml',
'.\StorageManagement\Microsoft.Azure.Commands.Management.Storage.format.ps1xml',
- '.\OperationalInsights\Microsoft.Azure.Commands.OperationalInsights.format.ps1xml'
+ '.\OperationalInsights\Microsoft.Azure.Commands.OperationalInsights.format.ps1xml',
+ '.\AzureBackup\Microsoft.Azure.Commands.AzureBackup.format.ps1xml'
)
# Modules to import as nested modules of the module specified in ModuleToProcess
@@ -100,7 +101,8 @@ NestedModules = @(
'.\StorageManagement\Microsoft.Azure.Commands.Management.Storage.dll',
'.\OperationalInsights\Microsoft.Azure.Commands.OperationalInsights.dll',
'.\UsageAggregates\Microsoft.Azure.Commands.UsageAggregates.dll',
- '.\ApiManagement\Microsoft.Azure.Commands.ApiManagement.ServiceManagement.dll'
+ '.\ApiManagement\Microsoft.Azure.Commands.ApiManagement.ServiceManagement.dll',
+ '.\AzureBackup\Microsoft.Azure.Commands.AzureBackup.dll'
)
# Functions to export from this module
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/app.config b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/App.config
similarity index 100%
rename from src/ServiceManagement/StorSimple/Commands.StorSimple.Test/app.config
rename to src/ServiceManagement/StorSimple/Commands.StorSimple.Test/App.config