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 a2052acae503..112f7e9e16df 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -39,9 +39,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll - False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -129,10 +126,15 @@ - + + + + {38a6741c-77a3-42a8-a846-83373be57c7f} + BackupServicesManagment + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common @@ -168,17 +170,26 @@ Always - Always + + + + + Always + + + Always + PreserveNewest + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs similarity index 71% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs index 98f8572f2e74..6289e8cd69bf 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs @@ -12,13 +12,25 @@ // 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 AzureBackupContainerTest : AzureBackupTestsBase + public class AzureBackupContainerTests : AzureBackupTestsBase { + [Fact] + public void GetAzureBackupContainerTests() + { + this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers"); + + this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer"); + } + [Fact] public void RegisterAzureBackupContainerTest() { 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..a7a1bb39118d --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 @@ -0,0 +1,56 @@ +# ---------------------------------------------------------------------------------- +# +# 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 = "backuprn" +$Location = "SouthEast Asia" +$ContainerResourceGroupName = "dev01Testing" +$ContainerResourceName = "dev01Testing" + +<# +.SYNOPSIS +Tests to test list containers +#> +function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers +{ + $containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location + Assert-NotNull $containers 'Container list should not be null'; +} + +function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer +{ + $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName + Assert-NotNull $container 'Container should not be null'; + Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name'; + Assert-AreEqual $container.ResourceGroupName $ContainerResourceGroupName -CaseSensitive 'Returned container resource group name (a.k.a parent friendly name) does not match the test VM resource group name'; +} + +<# +.SYNOPSIS +Tests to register the container +#> +function Test-RegisterAzureBackupContainer +{ + $jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $ContainerResourceName -ServiceName $ContainerResourceGroupName + + Assert-NotNull $jobId 'JobID should not be null'; +} + +function Test-UnregisterAzureBackupContainer +{ + $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $ContainerResourceName -ContainerResourceGroupName $ContainerResourceGroupName + $jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container + + Assert-NotNull $jobId 'JobID should not be null'; +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 index 090ee228aff6..75e03eaa73a5 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 @@ -15,6 +15,8 @@ $ResourceGroupName = "backuprg" $ResourceName = "backuprn" $ContainerName = "iaasvmcontainer;dev01testing;dev01testing" +$ContainerResourceGroupName = "dev01Testing" +$ContainerResourceName = "dev01Testing" $ContainerType = "IaasVMContainer" $DataSourceType = "VM" $DataSourceId = "17593283453810" 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..b947043300e2 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs @@ -0,0 +1,40 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests +{ + public class AzureBackupVaultTests : AzureBackupTestsBase + { + [Fact] + public void GetAzureBackupVaultCredentialsTests() + { + this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); + } + + [Fact] + public void SetAzureBackupVaultStorageTypeTests() + { + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException"); + + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException"); + } + } +} 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..42fc08c4f601 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1 @@ -0,0 +1,48 @@ +# ---------------------------------------------------------------------------------- +# +# 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 = "backuprn" +$Location = "SouthEast Asia" +$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; + +function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert +{ + $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation + Assert-NotNull $fileName 'File name should not be null'; + $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); + Assert-True {{ Test-Path $certFileFullPath }} +} + +function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException +{ + # TODO: Create a new resource and use it for these calls. At the end, delete it. + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant +} + +function Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException +{ + # One of them is bound to fail + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant } + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 deleted file mode 100644 index bb2c01db7921..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# ---------------------------------------------------------------------------------- -# -# 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 = "backuprn" -$Name = "dev01testing" -$VMServiceName = "dev01testing" -$ContainerType = "IaasVMContainer" -$Location = "westus" - -<# -.SYNOPSIS -Tests to register the container -#> -function Test-RegisterAzureBackupContainer -{ - $jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $VMName -ServiceName $VMServiceName - - Assert-NotNull $jobId 'JobID should not be null'; -} - -function Test-UnregisterAzureBackupContainer -{ - $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $VMName -ContainerResourceGroupName $VMServiceName - $jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container - - Assert-NotNull $jobId 'JobID should not be null'; -} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json new file mode 100644 index 000000000000..5ac9d61bc7c5 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json @@ -0,0 +1,72 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkZyaWVuZGx5TmFtZSUzRGRldjAxVGVzdGluZw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMServiceContainer\",\r\n \"ParentContainerName\": null,\r\n \"ParentContainerFriendlyName\": null,\r\n \"RegistrationStatus\": \"NotRegistered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": \"\",\r\n \"InstanceId\": null,\r\n \"Name\": \"dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 2,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "763" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" + ], + "x-ms-client-request-id": [ + "0482c73c-7196-49f8-96a0-3dcd0ccdaa90", + "0482c73c-7196-49f8-96a0-3dcd0ccdaa90" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-correlation-request-id": [ + "ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T170930Z:ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:09:30 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "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/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json new file mode 100644 index 000000000000..17c12738a42f --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json @@ -0,0 +1,142 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26ContainerType%3DIaasVMContainer%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkNvbnRhaW5lclR5cGUlM0RJYWFzVk1Db250YWluZXIlMjZGcmllbmRseU5hbWUlM0RkZXYwMVRlc3Rpbmc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 1,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "425" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "440a2de2-c516-4b57-87ee-74839064470b" + ], + "x-ms-client-request-id": [ + "cdc53ea3-207a-4d07-b535-32e8e48f5b14", + "cdc53ea3-207a-4d07-b535-32e8e48f5b14" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-correlation-request-id": [ + "440a2de2-c516-4b57-87ee-74839064470b" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172637Z:440a2de2-c516-4b57-87ee-74839064470b" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:26:37 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/register?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9yZWdpc3Rlcj9hcGktdmVyc2lvbj0yMDE0LTA5LTAx", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"ContainerUniqueNameList\": [\r\n \"iaasvmcontainer;dev01testing;dev01testing\"\r\n ],\r\n \"ContainerType\": \"IaasVMContainer\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "129" + ], + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "\"4a6fddd3-bdfc-482e-b7db-446cf9d729bc\"", + "ResponseHeaders": { + "Content-Length": [ + "38" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "e6efbb84-1593-4db6-b064-31838096cc99" + ], + "x-ms-client-request-id": [ + "d208a9ee-2876-4dc5-98e9-ed753b5a9014", + "d208a9ee-2876-4dc5-98e9-ed753b5a9014" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-correlation-request-id": [ + "e6efbb84-1593-4db6-b064-31838096cc99" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172639Z:e6efbb84-1593-4db6-b064-31838096cc99" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:26:39 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json new file mode 100644 index 000000000000..fb251975358b --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json @@ -0,0 +1,139 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkZyaWVuZGx5TmFtZSUzRGRldjAxVGVzdGluZw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registering\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMServiceContainer\",\r\n \"ParentContainerName\": null,\r\n \"ParentContainerFriendlyName\": null,\r\n \"RegistrationStatus\": \"NotRegistered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": \"\",\r\n \"InstanceId\": null,\r\n \"Name\": \"dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 2,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "764" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "x-ms-client-request-id": [ + "341c6fb9-6b4c-4773-8450-32cf85173c91", + "341c6fb9-6b4c-4773-8450-32cf85173c91" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172721Z:de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:27:21 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAx", + "RequestMethod": "DELETE", + "RequestBody": "{\r\n \"ContainerUniqueName\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"ContainerType\": \"IaasVMContainer\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "113" + ], + "Accept-Language": [ + "en-us" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "\"8386018b-db83-4f50-b496-a4e4e1ad1824\"", + "ResponseHeaders": { + "Content-Length": [ + "38" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "x-ms-client-request-id": [ + "75d2fb2f-daf1-4c97-865f-2a2f6230ee34", + "75d2fb2f-daf1-4c97-865f-2a2f6230ee34" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1193" + ], + "x-ms-correlation-request-id": [ + "9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172722Z:9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:27:22 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json new file mode 100644 index 000000000000..ecffd4ab1460 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json @@ -0,0 +1,75 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/certificates/IdMgmtInternalCert?api-version=2015-03-15", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY2VydGlmaWNhdGVzL0lkTWdtdEludGVybmFsQ2VydD9hcGktdmVyc2lvbj0yMDE1LTAzLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQaa4WR+3Ra7pPjIzudnuuQTANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNzE3MDAwM1oXDTE1MDYxOTE3MTAwM1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJhjKYhKBkE9TN6WLn8mlvkg3nCgbYwWJSuyMpcE2NH3B/rxndF1a/Mz3MJ5s3+EB9FJpuh5W2ZoqcZ2fpA3nSd+L1zrXY9gOqKqrLmRI3TwSF8X4UVXlA3eFu2QV18FfaNyDE6eBX9Rf0cDTWvNraCW/31fVGs+66d1qDhiEevPo6B9JXXauAN4NgA6uI8rwY/UOQY+3hIVjWJ/FZOAgN/T6Jb/hglCqVcyBn5bxJa3Zz49P3YSBwauf2uyiJlU64B3xmrT75Qo/+cRk5BpkWsBh57PxZhfgwL6IXSezcGTEBl5S3LEMeo+T0To6d+f/F38g2PLqteWHrtTWu+SGYkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAEspmwyUvBmbX97gwA3mMFiHyZXFL5MgcA0qjZWy7tUS3gcrLZRSv8SMmX8Yv9F4wMy1oe/H4PxCM2IX8cuQLZ2NfAo2sGVlmhdP12ksW/rKimHpnUTfSnslzqFg4sExu4WIkRn6AJMeqAjOul+A1a6UWKa+RRoRQc6MU/tvBAiEnlRAzFpv/4Ri3yS+KXD0gkOMpoJABkOEtdrgbyFICjfsaku4q1q8LycusFpbE+GEL5TWbUG9wwLZl/IPoy8NBtrv/7Dz8t8a6j/LUxvcChNSj4sID98uasBzOJ8I65xixv+XZXl76a0Q2J4icGkmomktz3TCd7yTVykjgyAbP8c=\"\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\": \"MIIC3TCCAcWgAwIBAgIQaa4WR+3Ra7pPjIzudnuuQTANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNzE3MDAwM1oXDTE1MDYxOTE3MTAwM1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJhjKYhKBkE9TN6WLn8mlvkg3nCgbYwWJSuyMpcE2NH3B/rxndF1a/Mz3MJ5s3+EB9FJpuh5W2ZoqcZ2fpA3nSd+L1zrXY9gOqKqrLmRI3TwSF8X4UVXlA3eFu2QV18FfaNyDE6eBX9Rf0cDTWvNraCW/31fVGs+66d1qDhiEevPo6B9JXXauAN4NgA6uI8rwY/UOQY+3hIVjWJ/FZOAgN/T6Jb/hglCqVcyBn5bxJa3Zz49P3YSBwauf2uyiJlU64B3xmrT75Qo/+cRk5BpkWsBh57PxZhfgwL6IXSezcGTEBl5S3LEMeo+T0To6d+f/F38g2PLqteWHrtTWu+SGYkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAEspmwyUvBmbX97gwA3mMFiHyZXFL5MgcA0qjZWy7tUS3gcrLZRSv8SMmX8Yv9F4wMy1oe/H4PxCM2IX8cuQLZ2NfAo2sGVlmhdP12ksW/rKimHpnUTfSnslzqFg4sExu4WIkRn6AJMeqAjOul+A1a6UWKa+RRoRQc6MU/tvBAiEnlRAzFpv/4Ri3yS+KXD0gkOMpoJABkOEtdrgbyFICjfsaku4q1q8LycusFpbE+GEL5TWbUG9wwLZl/IPoy8NBtrv/7Dz8t8a6j/LUxvcChNSj4sID98uasBzOJ8I65xixv+XZXl76a0Q2J4icGkmomktz3TCd7yTVykjgyAbP8c=\",\r\n \"resourceId\": 3420983535961922368,\r\n \"globalAcsNamespace\": \"seadev01rp1users\",\r\n \"globalAcsHostName\": \"accesscontrol.windows.net\",\r\n \"globalAcsRPRealm\": \"http://windowscloudbackup/m3\",\r\n \"subject\": \"CN=Windows Azure Tools\",\r\n \"validFrom\": \"2015-06-17T22:30:03+05:30\",\r\n \"validTo\": \"2015-06-19T22:40:03+05:30\",\r\n \"thumbprint\": \"39D0915AC95DFD234575A54502AEBC78E344B3E8\",\r\n \"friendlyName\": \"\",\r\n \"issuer\": \"CN=Windows Azure Tools\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1409" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "x-ms-client-request-id": [ + "773dc534-8d14-4812-912f-d2834a9e8c05", + "773dc534-8d14-4812-912f-d2834a9e8c05" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T171018Z:c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:10:17 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ 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 70c112b4309e..dc9f0e9d2e74 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs @@ -21,7 +21,7 @@ internal static class AzureBackupCmdletHelpMessage public const string ResourceGroupName = "The ResourceGroup name."; public const string ResourceName = "The Resource name."; public const string Location = "Location."; - public const string TargetLocation = "The directory where the credentials file will be saved."; + public const string TargetLocation = "The directory where the credentials file will be saved. This must be an absolute path."; public const string ContainerResourceName = "The container resource name aka friendly name."; public const string ContainerId = "The container ID."; public const string ContainerRegistrationStatus = "The container registration status."; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs index ebeb8f0748eb..fbe7b1ad1604 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs @@ -75,10 +75,10 @@ public override void ExecuteCmdlet() List containers = containerInfos.ConvertAll(containerInfo => { - return new AzureBackupContainer(containerInfo, ResourceGroupName, ResourceName, Location); + return new AzureBackupContainer(containerInfo, containerInfo.ParentContainerName, containerInfo.FriendlyName, Location); }); - if (!string.IsNullOrEmpty(ResourceName) & !string.IsNullOrEmpty(ResourceGroupName)) + if (!string.IsNullOrEmpty(ContainerResourceName) & !string.IsNullOrEmpty(ContainerResourceGroupName)) { if (containers.Any()) { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index 6b71dcb49e9f..b36222267916 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -65,9 +65,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -175,6 +172,10 @@ + + {38a6741c-77a3-42a8-a846-83373be57c7f} + BackupServicesManagment + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common