diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi
index 381c13af438d..403104afdfa9 100644
--- a/setup/azurecmdfiles.wxi
+++ b/setup/azurecmdfiles.wxi
@@ -44,15 +44,6 @@
-
-
-
-
-
-
-
-
-
@@ -98,9 +89,6 @@
-
-
-
@@ -159,6 +147,15 @@
+
+
+
+
+
+
+
+
+
@@ -189,6 +186,9 @@
+
+
+
@@ -198,24 +198,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -225,6 +288,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -257,15 +533,6 @@
-
-
-
-
-
-
-
-
-
@@ -305,9 +572,6 @@
-
-
-
@@ -418,15 +682,6 @@
-
-
-
-
-
-
-
-
-
@@ -514,9 +769,6 @@
-
-
-
@@ -759,15 +1011,6 @@
-
-
-
-
-
-
-
-
-
@@ -822,9 +1065,6 @@
-
-
-
@@ -857,15 +1097,6 @@
-
-
-
-
-
-
-
-
-
@@ -893,9 +1124,6 @@
-
-
-
@@ -922,15 +1150,6 @@
-
-
-
-
-
-
-
-
-
@@ -952,9 +1171,6 @@
-
-
-
@@ -1023,15 +1239,6 @@
-
-
-
-
-
-
-
-
-
@@ -1074,9 +1281,6 @@
-
-
-
@@ -1426,15 +1630,6 @@
-
-
-
-
-
-
-
-
-
@@ -1489,9 +1684,6 @@
-
-
-
@@ -1518,15 +1710,6 @@
-
-
-
-
-
-
-
-
-
@@ -1563,9 +1746,6 @@
-
-
-
@@ -1583,15 +1763,6 @@
-
-
-
-
-
-
-
-
-
@@ -1655,9 +1826,6 @@
-
-
-
@@ -1794,15 +1962,6 @@
-
-
-
-
-
-
-
-
-
@@ -1848,9 +2007,6 @@
-
-
-
@@ -1877,15 +2033,6 @@
-
-
-
-
-
-
-
-
-
@@ -1937,9 +2084,6 @@
-
-
-
@@ -2212,15 +2356,6 @@
-
-
-
-
-
-
-
-
-
@@ -2362,9 +2497,6 @@
-
-
-
@@ -2450,15 +2582,6 @@
-
-
-
-
-
-
-
-
-
@@ -2522,9 +2645,6 @@
-
-
-
@@ -2578,15 +2698,6 @@
-
-
-
-
-
-
-
-
-
@@ -2698,9 +2809,6 @@
-
-
-
@@ -2727,15 +2835,6 @@
-
-
-
-
-
-
-
-
-
@@ -2859,9 +2958,6 @@
-
-
-
@@ -3162,15 +3258,6 @@
-
-
-
-
-
-
-
-
-
@@ -3225,9 +3312,6 @@
-
-
-
@@ -3275,15 +3359,6 @@
-
-
-
-
-
-
-
-
-
@@ -3404,9 +3479,6 @@
-
-
-
@@ -3667,15 +3739,6 @@
-
-
-
-
-
-
-
-
-
@@ -3817,9 +3880,6 @@
-
-
-
@@ -3837,15 +3897,6 @@
-
-
-
-
-
-
-
-
-
@@ -3909,9 +3960,6 @@
-
-
-
@@ -3997,15 +4045,6 @@
-
-
-
-
-
-
-
-
-
@@ -4051,9 +4090,6 @@
-
-
-
@@ -4074,9 +4110,6 @@
-
-
-
@@ -4092,7 +4125,6 @@
-
@@ -4111,6 +4143,9 @@
+
+
+
@@ -4121,18 +4156,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4143,9 +4261,6 @@
-
-
-
@@ -4159,7 +4274,6 @@
-
@@ -4196,9 +4310,6 @@
-
-
-
@@ -4228,7 +4339,6 @@
-
@@ -4299,9 +4409,6 @@
-
-
-
@@ -4320,7 +4427,6 @@
-
@@ -4331,9 +4437,6 @@
-
-
-
@@ -4343,7 +4446,6 @@
-
@@ -4352,9 +4454,6 @@
-
-
-
@@ -4362,7 +4461,6 @@
-
@@ -4385,9 +4483,6 @@
-
-
-
@@ -4402,7 +4497,6 @@
-
@@ -4516,9 +4610,6 @@
-
-
-
@@ -4537,7 +4628,6 @@
-
@@ -4546,9 +4636,6 @@
-
-
-
@@ -4561,15 +4648,11 @@
-
-
-
-
@@ -4591,7 +4674,6 @@
-
@@ -4636,9 +4718,6 @@
-
-
-
@@ -4654,7 +4733,6 @@
-
@@ -4663,9 +4741,6 @@
-
-
-
@@ -4683,7 +4758,6 @@
-
@@ -4770,9 +4844,6 @@
-
-
-
@@ -4820,7 +4891,6 @@
-
@@ -4848,9 +4918,6 @@
-
-
-
@@ -4872,7 +4939,6 @@
-
@@ -4890,9 +4956,6 @@
-
-
-
@@ -4930,7 +4993,6 @@
-
@@ -4939,9 +5001,6 @@
-
-
-
@@ -4983,7 +5042,6 @@
-
@@ -5072,9 +5130,6 @@
-
-
-
@@ -5093,7 +5148,6 @@
-
@@ -5109,9 +5163,6 @@
-
-
-
@@ -5152,7 +5203,6 @@
-
@@ -5229,9 +5279,6 @@
-
-
-
@@ -5279,15 +5326,11 @@
-
-
-
-
@@ -5309,7 +5352,6 @@
-
@@ -5337,9 +5379,6 @@
-
-
-
@@ -5355,7 +5394,6 @@
-
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
index 12977a420ca1..06cfc0e401b5 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
@@ -41,7 +41,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.0-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll
+ ..\Commands.AzureBackup\Resources\Microsoft.Azure.Management.BackupServicesManagement.dll
False
@@ -124,6 +124,7 @@
+
@@ -154,9 +155,15 @@
Designer
+
+ Always
+
Always
+
+ Always
+
Always
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs
new file mode 100644
index 000000000000..7c461caf5071
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.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.WindowsAzure.Commands.ScenarioTest;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
+{
+ public class AzureBackupContainerTests : AzureBackupTestsBase
+ {
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void AzureBackupMarsContainerScenarioTests()
+ {
+ this.RunPowerShellTest("Test-AzureBackupMarsContainerScenario");
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1
new file mode 100644
index 000000000000..466e97accd08
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1
@@ -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.
+# ----------------------------------------------------------------------------------
+
+$ResourceGroupName = "backuprg"
+$ResourceName = "backuprn1"
+$ContainerName = "DPMDRSCALEINT1.DPMDOM02.SELFHOST.CORP.MICROSOFT.COM"
+$ContainerType = "Windows"
+$ContainerId = "10034"
+$ContainerStatus = "Registered"
+
+function Test-AzureBackupMarsContainerScenario
+{
+ $vault = Get-AzureBackupVault -ResourceGroupName $ResourceGroupName -Name $ResourceName
+
+ $containers = Get-AzureBackupContainer -vault $vault -type $ContainerType
+ Assert-AreEqual $containers[0].ContainerType $ContainerType;
+ Assert-AreEqual $containers[0].Id $ContainerId;
+ Assert-AreEqual $containers[0].Location $vault.Region;
+ Assert-AreEqual $containers[0].Name $ContainerName;
+ Assert-AreEqual $containers[0].ResourceGroupName $vault.ResourceGroupName;
+ Assert-AreEqual $containers[0].ResourceName $vault.Name;
+ Assert-AreEqual $containers[0].Status $ContainerStatus;
+
+ $namedContainers = Get-AzureBackupContainer -vault $vault -type $ContainerType -name $ContainerName
+ $container = $namedContainers[0];
+ Assert-AreEqual $container.ContainerType $ContainerType;
+ Assert-AreEqual $container.Id $ContainerId;
+ Assert-AreEqual $container.Location $vault.Region;
+ Assert-AreEqual $container.Name $ContainerName;
+ Assert-AreEqual $container.ResourceGroupName $vault.ResourceGroupName;
+ Assert-AreEqual $container.ResourceName $vault.Name;
+ Assert-AreEqual $container.Status $ContainerStatus;
+
+ Unregister-AzureBackupContainer -Container $container -Force
+
+ $unregContainers = Get-AzureBackupContainer -vault $vault -type $ContainerType -name $ContainerName
+ Assert-AreEqual $unregContainers.Count 0;
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/AzureBackupMarsContainerScenarioTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/AzureBackupMarsContainerScenarioTests.json
new file mode 100644
index 000000000000..503061a5b70f
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/AzureBackupMarsContainerScenarioTests.json
@@ -0,0 +1,358 @@
+{
+ "Entries": [
+ {
+ "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": [
+ "3bde4861-d6c7-4785-b954-c2fb7498260c-2015-07-17 19:46:07Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"backuprn1\",\r\n \"etag\": \"327fe758-7f7b-4879-b708-4d5366d2c687\",\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": [
+ "650d6914-a58c-4610-90c4-578f43f4194a"
+ ],
+ "x-ms-client-request-id": [
+ "3bde4861-d6c7-4785-b954-c2fb7498260c-2015-07-17 19:46:07Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14995"
+ ],
+ "x-ms-correlation-request-id": [
+ "650d6914-a58c-4610-90c4-578f43f4194a"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194610Z:650d6914-a58c-4610-90c4-578f43f4194a"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:10 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": [
+ "3bde4861-d6c7-4785-b954-c2fb7498260c-2015-07-17 19:46:07Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"resourceId\": 8395314960984740771,\r\n \"properties\": {\r\n \"storageType\": \"GeoRedundant\",\r\n \"storageTypeState\": \"Locked\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "106"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "f28b0d83-8805-4900-92db-90809a187048"
+ ],
+ "x-ms-client-request-id": [
+ "3bde4861-d6c7-4785-b954-c2fb7498260c-2015-07-17 19:46:07Z-PS",
+ "3bde4861-d6c7-4785-b954-c2fb7498260c-2015-07-17 19:46:07Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14994"
+ ],
+ "x-ms-correlation-request-id": [
+ "f28b0d83-8805-4900-92db-90809a187048"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194611Z:f28b0d83-8805-4900-92db-90809a187048"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:11 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/backupContainers?api-version=2015-03-15&$filter=type%20eq%20'Machine'",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9iYWNrdXBDb250YWluZXJzP2FwaS12ZXJzaW9uPTIwMTUtMDMtMTUmJGZpbHRlcj10eXBlJTIwZXElMjAnTWFjaGluZSc=",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"uniqueName\": \"dpmdrscaleint1.dpmdom02.selfhost.corp.microsoft.com\",\r\n \"containerType\": \"Machine\",\r\n \"properties\": {\r\n \"containerId\": 10034,\r\n \"friendlyName\": \"DPMDRSCALEINT1.DPMDOM02.SELFHOST.CORP.MICROSOFT.COM\",\r\n \"containerStampId\": \"eaf33dbc-a5b5-411a-a6af-1976a3f94602\",\r\n \"containerStampUri\": \"https://sea-dev01-prot-4bodw.ext.trafficmanager.net\",\r\n \"canReRegister\": false,\r\n \"customerType\": \"OBS\"\r\n }\r\n }\r\n ],\r\n \"nextLink\": null\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "401"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "46a1fbfd-6e8b-4ab0-835b-1dcbe559162f"
+ ],
+ "x-ms-client-request-id": [
+ "012da3f2-c253-475c-9f1a-516b11d3a906",
+ "012da3f2-c253-475c-9f1a-516b11d3a906"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14993"
+ ],
+ "x-ms-correlation-request-id": [
+ "46a1fbfd-6e8b-4ab0-835b-1dcbe559162f"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194612Z:46a1fbfd-6e8b-4ab0-835b-1dcbe559162f"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:11 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/backupContainers?api-version=2015-03-15&$filter=type%20eq%20'Machine'%20and%20friendlyName%20eq%20'DPMDRSCALEINT1.DPMDOM02.SELFHOST.CORP.MICROSOFT.COM'",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9iYWNrdXBDb250YWluZXJzP2FwaS12ZXJzaW9uPTIwMTUtMDMtMTUmJGZpbHRlcj10eXBlJTIwZXElMjAnTWFjaGluZSclMjBhbmQlMjBmcmllbmRseU5hbWUlMjBlcSUyMCdEUE1EUlNDQUxFSU5UMS5EUE1ET00wMi5TRUxGSE9TVC5DT1JQLk1JQ1JPU09GVC5DT00n",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"uniqueName\": \"dpmdrscaleint1.dpmdom02.selfhost.corp.microsoft.com\",\r\n \"containerType\": \"Machine\",\r\n \"properties\": {\r\n \"containerId\": 10034,\r\n \"friendlyName\": \"DPMDRSCALEINT1.DPMDOM02.SELFHOST.CORP.MICROSOFT.COM\",\r\n \"containerStampId\": \"eaf33dbc-a5b5-411a-a6af-1976a3f94602\",\r\n \"containerStampUri\": \"https://sea-dev01-prot-4bodw.ext.trafficmanager.net\",\r\n \"canReRegister\": false,\r\n \"customerType\": \"OBS\"\r\n }\r\n }\r\n ],\r\n \"nextLink\": null\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "401"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "95e616a7-bb6a-434b-876d-8dc9271a9375"
+ ],
+ "x-ms-client-request-id": [
+ "add32202-8b85-48cd-bf42-76899a482387",
+ "add32202-8b85-48cd-bf42-76899a482387"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14992"
+ ],
+ "x-ms-correlation-request-id": [
+ "95e616a7-bb6a-434b-876d-8dc9271a9375"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194612Z:95e616a7-bb6a-434b-876d-8dc9271a9375"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:12 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/backupContainers?api-version=2015-03-15&$filter=type%20eq%20'Machine'%20and%20friendlyName%20eq%20'DPMDRSCALEINT1.DPMDOM02.SELFHOST.CORP.MICROSOFT.COM'",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9iYWNrdXBDb250YWluZXJzP2FwaS12ZXJzaW9uPTIwMTUtMDMtMTUmJGZpbHRlcj10eXBlJTIwZXElMjAnTWFjaGluZSclMjBhbmQlMjBmcmllbmRseU5hbWUlMjBlcSUyMCdEUE1EUlNDQUxFSU5UMS5EUE1ET00wMi5TRUxGSE9TVC5DT1JQLk1JQ1JPU09GVC5DT00n",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"value\": [],\r\n \"nextLink\": null\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "28"
+ ],
+ "Content-Type": [
+ "application/json"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "ad8d0c5f-7388-48d1-8079-8cee7573cf09"
+ ],
+ "x-ms-client-request-id": [
+ "7af25c88-040a-4ce3-9728-8f94fe64d42f",
+ "7af25c88-040a-4ce3-9728-8f94fe64d42f"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14991"
+ ],
+ "x-ms-correlation-request-id": [
+ "ad8d0c5f-7388-48d1-8079-8cee7573cf09"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194618Z:ad8d0c5f-7388-48d1-8079-8cee7573cf09"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:17 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.0"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backup/BackupVault/backuprn1/backupContainers/10034/UnRegisterContainer?api-version=2015-03-15",
+ "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3VwL0JhY2t1cFZhdWx0L2JhY2t1cHJuMS9iYWNrdXBDb250YWluZXJzLzEwMDM0L1VuUmVnaXN0ZXJDb250YWluZXI/YXBpLXZlcnNpb249MjAxNS0wMy0xNQ==",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "Accept-Language": [
+ "en-us"
+ ],
+ "x-ms-client-request-id": [
+ "3a02406f-4fc3-48b6-9621-c05d9d1c3cdb-2015-07-17 19:46:12Z-PS"
+ ],
+ "User-Agent": [
+ "Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "0"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "3577d465-9453-43bc-93ec-93603396aa9f"
+ ],
+ "x-ms-client-request-id": [
+ "3a02406f-4fc3-48b6-9621-c05d9d1c3cdb-2015-07-17 19:46:12Z-PS",
+ "3a02406f-4fc3-48b6-9621-c05d9d1c3cdb-2015-07-17 19:46:12Z-PS"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "3577d465-9453-43bc-93ec-93603396aa9f"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20150717T194617Z:3577d465-9453-43bc-93ec-93603396aa9f"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Fri, 17 Jul 2015 19:46:17 GMT"
+ ]
+ },
+ "StatusCode": 204
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs
new file mode 100644
index 000000000000..26376ea2dda3
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Management.Automation;
+using System.Collections.Generic;
+using System.Xml;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Microsoft.Azure.Common.Authentication;
+using Microsoft.Azure.Common.Authentication.Models;
+using System.Threading;
+using Hyak.Common;
+using Microsoft.Azure.Commands.AzureBackup.Properties;
+using System.Net;
+using System.Linq;
+using Microsoft.WindowsAzure.Management.Scheduler;
+using Microsoft.Azure.Management.BackupServices;
+using Microsoft.Azure.Management.BackupServices.Models;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+
+namespace Microsoft.Azure.Commands.AzureBackup.ClientAdapter
+{
+ public partial class AzureBackupClientAdapter
+ {
+ ///
+ /// Gets all MARS containers in the vault
+ ///
+ ///
+ public IEnumerable ListMachineContainers()
+ {
+ var listResponse = AzureBackupVaultClient.Container.ListMarsContainersByType(MarsContainerType.Machine, GetCustomRequestHeaders());
+ return listResponse.ListMarsContainerResponse.Value;
+ }
+
+ ///
+ /// Gets all MARS containers in the vault which match the friendly name
+ ///
+ /// The friendly name of the container
+ ///
+ public IEnumerable ListMachineContainers(string friendlyName)
+ {
+ var listResponse = AzureBackupVaultClient.Container.ListMarsContainersByTypeAndFriendlyName(MarsContainerType.Machine, friendlyName, GetCustomRequestHeaders());
+ return listResponse.ListMarsContainerResponse.Value;
+ }
+
+ ///
+ /// UnRegister container
+ ///
+ ///
+ ///
+ public void UnregisterMachineContainer(long containerId)
+ {
+ AzureBackupVaultClient.Container.UnregisterMarsContainer(containerId.ToString(), GetCustomRequestHeaders());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs
index 9d2719413564..7d8dd45e1b4b 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs
@@ -22,5 +22,10 @@ internal static class AzureBackupCmdletHelpMessage
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.";
+ public const string ManagedResourceName = "The resource name of the resource being managed by the Azure Backup service (ex: resource name of the VM).";
+ public const string ManagedResourceGroupName = "The resource group name of the resource being managed by the Azure Backup service (ex: resource group name of the VM).";
+ public const string ContainerRegistrationStatus = "The container registration status.";
+ public const string ContainerType = "The container type.";
+ public const string AzureBackupContainer = "Azure Backup Container for Azure Backup Item.";
}
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs
new file mode 100644
index 000000000000..b1b623d832c6
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs
@@ -0,0 +1,45 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Management.Automation;
+using System.Collections.Generic;
+using System.Xml;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Microsoft.Azure.Common.Authentication;
+using Microsoft.Azure.Common.Authentication.Models;
+using System.Threading;
+using Hyak.Common;
+using Microsoft.Azure.Commands.AzureBackup.Properties;
+using System.Net;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ public abstract class AzureBackupContainerCmdletBase : AzureBackupCmdletBase
+ {
+ [Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackupContainer, ValueFromPipeline = true)]
+ [ValidateNotNullOrEmpty]
+ public AzureBackupContainer Container { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+
+ WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}, Location: {2}", Container.ResourceGroupName, Container.ResourceName, Container.Location));
+
+ InitializeAzureBackupCmdlet(Container.ResourceGroupName, Container.ResourceName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs
new file mode 100644
index 000000000000..fd5bcb2d6b3c
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs
@@ -0,0 +1,82 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Library;
+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;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Get list of containers
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureBackupContainer"), OutputType(typeof(List))]
+ public class GetAzureBackupContainer : AzureBackupVaultCmdletBase
+ {
+ [Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ManagedResourceName)]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.ContainerType)]
+ [ValidateNotNullOrEmpty]
+ public AzureBackupContainerType Type { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+
+ List containers = new List();
+
+ switch (Type)
+ {
+ case AzureBackupContainerType.Windows:
+ case AzureBackupContainerType.SCDPM:
+ containers.AddRange(GetMachineContainers());
+ break;
+ default:
+ break;
+ }
+
+ WriteObject(containers);
+ });
+ }
+
+ private List GetMachineContainers()
+ {
+ List marsContainerResponses = new List();
+ if (string.IsNullOrEmpty(Name))
+ {
+ marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers());
+ }
+ else
+ {
+ marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers(Name));
+ }
+
+ return marsContainerResponses.ConvertAll(marsContainerResponse =>
+ {
+ return new AzureBackupContainer(Vault, marsContainerResponse);
+ }).Where(container => container.ContainerType == Type.ToString()).ToList();
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureBackupContainer.cs
new file mode 100644
index 000000000000..9b02d0e5530a
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureBackupContainer.cs
@@ -0,0 +1,77 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Web;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Management.Automation;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.BackupServices.Models;
+using MBS = Microsoft.Azure.Management.BackupServices;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using Microsoft.WindowsAzure.Commands.Utilities.Store;
+using Microsoft.Azure.Commands.AzureBackup.Properties;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
+{
+ ///
+ /// Get list of containers
+ ///
+ [Cmdlet(VerbsLifecycle.Unregister, "AzureBackupContainer")]
+ public class UnregisterAzureBackupContainer : AzureBackupContainerCmdletBase
+ {
+ private PowerShellCustomConfirmation customerConfirmation;
+
+ [Parameter(Position = 1, Mandatory = false, HelpMessage = "Confirm unregistration and deletion of server")]
+ public SwitchParameter Force { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ ExecutionBlock(() =>
+ {
+ base.ExecuteCmdlet();
+
+ AzureBackupContainerType containerType = (AzureBackupContainerType)Enum.Parse(typeof(AzureBackupContainerType), Container.ContainerType);
+ switch (containerType)
+ {
+ case AzureBackupContainerType.Windows:
+ case AzureBackupContainerType.SCDPM:
+ DeleteServer();
+ break;
+ default:
+ break;
+ }
+ });
+ }
+
+ private void DeleteServer()
+ {
+ bool shouldUnregister = true;
+
+ if (!Force.IsPresent)
+ {
+ customerConfirmation = customerConfirmation ?? new PowerShellCustomConfirmation(Host);
+ shouldUnregister = customerConfirmation.ShouldProcess(Resources.UnregisterServerCaption, Resources.UnregisterServerMessage);
+ }
+
+ if (shouldUnregister)
+ {
+ AzureBackupClient.UnregisterMachineContainer(Container.Id);
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
index b581a19ef2a3..b7a89c251bc2 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj
@@ -56,9 +56,9 @@
..\..\..\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
+ Resources\Microsoft.Azure.Management.BackupServicesManagement.dll
..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
@@ -116,18 +116,24 @@
+
+
+
+
+
+
@@ -160,6 +166,7 @@
Always
+
@@ -168,6 +175,13 @@
{5ee72c53-1720-4309-b54b-5fb79703195f}
Commands.Common
+
+ {4900ec4e-8deb-4412-9108-0bc52f81d457}
+ Commands.Utilities
+
+
+
+
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs
new file mode 100644
index 000000000000..65678f8542da
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs
@@ -0,0 +1,71 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Management.Automation;
+using System.Collections.Generic;
+using System.Xml;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Microsoft.Azure.Common.Authentication;
+using Microsoft.Azure.Common.Authentication.Models;
+using System.Threading;
+using Hyak.Common;
+using Microsoft.Azure.Commands.AzureBackup.Properties;
+using System.Net;
+using Microsoft.Azure.Management.BackupServices.Models;
+using Microsoft.Azure.Commands.AzureBackup.Cmdlets;
+using System.Linq;
+using Microsoft.Azure.Commands.AzureBackup.Models;
+using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models;
+using System.Collections.Specialized;
+using System.Web;
+using System.Text.RegularExpressions;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Helpers
+{
+ internal class ContainerHelpers
+ {
+ internal static AzureBackupContainerType GetContainerType(string customerType)
+ {
+ CustomerType type = (CustomerType)Enum.Parse(typeof(CustomerType), customerType);
+
+ AzureBackupContainerType containerType = 0;
+
+ switch (type)
+ {
+ case CustomerType.DPM:
+ containerType = AzureBackupContainerType.SCDPM;
+ break;
+ case CustomerType.InMage:
+ break;
+ case CustomerType.Invalid:
+ break;
+ case CustomerType.ManagedContainer:
+ break;
+ case CustomerType.OBS:
+ containerType = AzureBackupContainerType.Windows;
+ break;
+ case CustomerType.SBS:
+ containerType = AzureBackupContainerType.Windows;
+ break;
+ case CustomerType.SqlPaaS:
+ break;
+ default:
+ break;
+ }
+
+ return containerType;
+ }
+ }
+}
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
index 732d973175bf..3308e22c0faa 100644
--- 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
@@ -1,5 +1,211 @@
+
+
+ Get-AzureBackupContainer
+
+ Retrieves one or more Azure Backup containers that match the filter criteria specified.
+
+
+
+
+ Get
+ AzureBackupContainer
+
+
+
+ An AzureBackupContainer is an object that encapsulates datasources, protected items, and recovery points. An AzureBackupContainer can be one of three:
+- a Windows server
+- a System Center Data Protection Manager server (SCDPM)
+- an Azure IaaS virtual machine
+ Before a datasource or item can be backed-up, the container holding it must be registered with the Azure Backup service and be authenticated to send backup data to the backup vault. For Windows and SCDPM servers, the registration is held with the FQDN of the server.
+
+
+
+ Get-AzureBackupContainer
+
+ Name
+
+ The name of the AzureBackupContainer for which an object reference will be returned.
+
+ String
+
+
+ Type
+
+ This determines the Type of the container that has been registered.
+- For Windows servers using the Azure Backup agent directly, the type will be "Windows"
+- For SCDPM servers using the Azure Backup agent in conjunction with SCDPM, the type will be "DPM"
+
+ AzureBackupContainerType
+
+
+ Vault
+
+ A filter for the vault object, under which the container needs to be found.
+
+ AzurePSBackupVault
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ Name
+
+ The name of the AzureBackupContainer for which an object reference will be returned.
+
+ String
+
+ String
+
+
+
+
+
+ Type
+
+ This determines the Type of the container that has been registered.
+- For Windows servers using the Azure Backup agent directly, the type will be "Windows"
+- For SCDPM servers using the Azure Backup agent in conjunction with SCDPM, the type will be "DPM"
+
+ AzureBackupContainerType
+
+ AzureBackupContainerType
+
+
+
+
+
+ Vault
+
+ A filter for the vault object, under which the container needs to be found.
+
+ AzurePSBackupVault
+
+ AzurePSBackupVault
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+ ManagedResourceName
+
+ The name of the container that is specified as a filter.
+
+ string
+
+ string
+
+
+
+
+
+
+
+
+ AzureBackupVault
+
+
+
+
+
+This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ AzureBackupContainer
+
+
+
+
+
+This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- List of all Windows servers registered to the vault --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupContainer -vault $v -type Windows
+
+ Gets a list of all containers of type "Windows" from the specified vault.
+
+
+ Name Type Status
+---- ---- ------
+SERVER1.CONTOSO.COM Windows Registered
+SERVER2.CONTOSO.COM Windows Registered
+
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Retrieve a specific container --------------------------
+
+ PS C:\>
+
+ Get-AzureBackupContainer -vault $v -type SCDPM -name "DPMSERVER.CONTOSO.COM"
+
+ Gets the container representing a specific DPM server registered to the specified vault.
+
+
+ Name Type Status
+---- ---- ------
+DPMSERVER.CONTOSO.COM SCDPM Registered
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get-AzureBackupVault
@@ -88,7 +294,8 @@
- This section details out the type of the objects that you can pipe to the cmdlet.
+
+This section details out the type of the objects that you can pipe to the cmdlet.
@@ -100,7 +307,8 @@
- This section details out the type of the objects that the cmdlet emits.
+
+This section details out the type of the objects that the cmdlet emits.
@@ -312,8 +520,7 @@ Property :
-
-This section details out the type of the objects that you can pipe to the cmdlet.
+ This section details out the type of the objects that you can pipe to the cmdlet.
@@ -325,8 +532,7 @@ This section details out the type of the objects that you can pipe to the cmdlet
-
-This section details out the type of the objects that the cmdlet emits.
+ This section details out the type of the objects that the cmdlet emits.
@@ -490,7 +696,8 @@ This section details out the type of the objects that the cmdlet emits.
- This section details out the type of the objects that you can pipe to the cmdlet.
+
+This section details out the type of the objects that you can pipe to the cmdlet.
@@ -502,7 +709,8 @@ This section details out the type of the objects that the cmdlet emits.
- This section details out the type of the objects that the cmdlet emits.
+
+This section details out the type of the objects that the cmdlet emits.
@@ -656,7 +864,8 @@ Storage : LocallyRedundant
- This section details out the type of the objects that you can pipe to the cmdlet.
+
+This section details out the type of the objects that you can pipe to the cmdlet.
@@ -668,7 +877,8 @@ Storage : LocallyRedundant
- This section details out the type of the objects that the cmdlet emits.
+
+This section details out the type of the objects that the cmdlet emits.
@@ -814,8 +1024,7 @@ Storage : LocallyRedundant
-
-This section details out the type of the objects that you can pipe to the cmdlet.
+ This section details out the type of the objects that you can pipe to the cmdlet.
@@ -827,8 +1036,7 @@ This section details out the type of the objects that you can pipe to the cmdlet
-
-This section details out the type of the objects that the cmdlet emits.
+ This section details out the type of the objects that the cmdlet emits.
@@ -881,4 +1089,170 @@ This section details out the type of the objects that the cmdlet emits.
+
+
+
+ Unregister-AzureBackupContainer
+
+ Unregisters the specified Windows Server or Azure virtual machine from the Azure Backup vault.
+
+
+
+
+ Unregister
+ AzureBackupContainer
+
+
+
+ The Unregister command works on an Container object. It removes references of this container from the Azure Backup vault. Before you can Unregister a Container, any protected data associated with the Container needs to be deleted.
+
+
+
+ Unregister-AzureBackupContainer
+
+ Force
+
+ When applied to an AzureBackupContainer of type Windows, this will not prompt the user for explicit consent before deleting data from the Azure Backup vault.
+
+ SwitchParameter
+
+
+ Container
+
+ The Windows Server or Azure virtual machine that should be unregistered.
+
+ AzureBackupContainer
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+
+
+
+
+ Force
+
+ When applied to an AzureBackupContainer of type Windows, this will not prompt the user for explicit consent before deleting data from the Azure Backup vault.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+
+
+
+ Container
+
+ The Windows Server or Azure virtual machine that should be unregistered.
+
+ AzureBackupContainer
+
+ AzureBackupContainer
+
+
+
+
+
+ Profile
+
+ Non-mandatory AzureProfile input object
+
+ AzureProfile
+
+ AzureProfile
+
+
+
+
+
+
+
+
+ Container of type [AzureBackupContainer]
+
+
+
+
+ This section details out the type of the objects that you can pipe to the cmdlet.
+
+
+
+
+
+
+ AzureBackupJob
+- For containers of type Windows, the return value is $null
+
+
+
+
+ This section details out the type of the objects that the cmdlet emits.
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ -------------------------- Unregister a Windows Server with user prompt --------------------------
+
+ PS C:\>
+
+ $c = Get-AzureBackupContainer -vault $v -type Windows -name "server1.contoso.com"
+PS C:\> Unregister-AzureBackupContainer -container $c[0]
+
+ The user first gets the container that needs to be unregistered using the Get-AzureBackupContainer commandlet. This container object is passed to the unregister commandlet. This unregisters the specified Windows Server from the Azure Backup vault.
+
+
+ Unregister Server
+This operation will delete all data in the backup vault that is associated with the server. Are you sure you want to unregister the server?
+[] Yes [] No [?] Help (default is "No"): Yes
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Unregister a Windows Server without confirmation prompt --------------------------
+
+ PS C:\>
+
+ Unregister-AzureBackupContainer -container $c –force
+
+ The -Force option does not ask the user for confirmation before deleting the data and unregistering the server.
+
+
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+ Get-AzureBackupContainer
+
+
+
+
\ 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
index ab415da71864..500adb8d49be 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
@@ -37,6 +37,43 @@
-
+
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupContainer
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupContainer
+
+
+
+
+
+ 60
+
+
+
+ 18
+
+
+
+ 18
+
+
+
+
+
+
+ Name
+
+
+ ContainerType
+
+
+ Status
+
+
+
+
+
+
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs
index f427757a46b8..ff6434c7eab8 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs
@@ -12,6 +12,10 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using Microsoft.Azure.Commands.AzureBackup.Helpers;
+using Microsoft.Azure.Management.BackupServices.Models;
+using System;
+
namespace Microsoft.Azure.Commands.AzureBackup.Models
{
public class AzureBackupVaultContextObject
@@ -43,4 +47,28 @@ public AzureBackupVaultContextObject(string resourceGroupName, string resourceNa
public AzureBackupVaultContextObject(AzurePSBackupVault vault)
: this(vault.ResourceGroupName, vault.Name, vault.Region) { }
}
+
+ ///
+ /// This class encapsulates all the properties of the container object
+ /// that are needed by higher level objects (data source, recovery point etc).
+ ///
+ public class AzureBackupContainerContextObject : AzureBackupVaultContextObject
+ {
+ ///
+ /// Type of the Azure Backup container
+ ///
+ public string ContainerType { get; set; }
+
+ public AzureBackupContainerContextObject()
+ : base()
+ {
+ }
+
+ public AzureBackupContainerContextObject(AzurePSBackupVault vault, MarsContainerResponse marsContainerResponse)
+ : base(vault)
+ {
+ ContainerType = ContainerHelpers.GetContainerType(marsContainerResponse.Properties.CustomerType).ToString();
+ //ContainerUniqueName = marsContainerResponse.UniqueName;
+ }
+ }
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainer.cs
new file mode 100644
index 000000000000..eba87adff331
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainer.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.Management.BackupServices.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Models
+{
+ ///
+ /// Represents Azure Backup Container
+ ///
+ public class AzureBackupContainer : AzureBackupContainerContextObject
+ {
+ ///
+ /// Resource name of the resource (ex: resource name of the VM) being managed by the Azure Backup service.
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Id of the container
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// Status of registration of the container
+ ///
+ public string Status { get; set; }
+
+ public AzureBackupContainer() : base() { }
+
+ public AzureBackupContainer(AzurePSBackupVault vault, MarsContainerResponse marsContainerResponse)
+ : base(vault, marsContainerResponse)
+ {
+ Name = marsContainerResponse.Properties.FriendlyName;
+ Id = marsContainerResponse.Properties.ContainerId;
+ Status = AzureBackupContainerRegistrationStatus.Registered.ToString();
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs
index 79cc0f9b20c0..332fb487024c 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs
@@ -19,4 +19,21 @@ public enum AzureBackupVaultStorageType
GeoRedundant = 1,
LocallyRedundant,
}
+
+ public enum AzureBackupContainerType
+ {
+ Windows = 1,
+ SCDPM,
+ }
+
+ public enum AzureBackupContainerStatusInput
+ {
+ Registering = 1,
+ Registered,
+ }
+
+ public enum AzureBackupContainerRegistrationStatus
+ {
+ Registered = 1,
+ }
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs
index 58372d895579..515623e43787 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18449
+// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -61,20 +61,29 @@ internal Resources() {
}
///
- /// Looks up a localized string similar to The specified Azure Virtual Machine Not Found..
+ /// Looks up a localized string similar to The specified resource does not exist..
///
- internal static string AzureVMNotFound {
+ internal static string ResourceNotFoundMessage {
get {
- return ResourceManager.GetString("AzureVMNotFound", resourceCulture);
+ return ResourceManager.GetString("ResourceNotFoundMessage", resourceCulture);
}
}
///
- /// Looks up a localized string similar to The specified resource does not exist..
+ /// Looks up a localized string similar to Unregister Server.
///
- internal static string ResourceNotFoundMessage {
+ internal static string UnregisterServerCaption {
get {
- return ResourceManager.GetString("ResourceNotFoundMessage", resourceCulture);
+ return ResourceManager.GetString("UnregisterServerCaption", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to This operation will delete all data in the backup vault that is associated with the server. Are you sure you want to unregister the server?.
+ ///
+ internal static string UnregisterServerMessage {
+ get {
+ return ResourceManager.GetString("UnregisterServerMessage", resourceCulture);
}
}
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx
index 73ab213136b1..3abfe5b400d9 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Properties/Resources.resx
@@ -117,10 +117,13 @@
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.
+
+ Unregister Server
+
+
+ This operation will delete all data in the backup vault that is associated with the server. Are you sure you want to unregister the server?
+
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.Azure.Management.BackupServicesManagement.dll b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.Azure.Management.BackupServicesManagement.dll
new file mode 100644
index 000000000000..d686b576b1bc
Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.Azure.Management.BackupServicesManagement.dll differ