diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/RMProfileClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/RMProfileClient.cs index 5b0ba40b17e1..159ede44f4ae 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/RMProfileClient.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/RMProfileClient.cs @@ -151,6 +151,19 @@ public bool TryGetSubscription(string tenantId, string subscriptionId, out Azure tenantId, subscriptionId, out subscription, out tenant); } + public bool TryGetSubscriptionByName(string tenantId, string subscriptionName, out AzureSubscription subscription) + { + if (string.IsNullOrWhiteSpace(tenantId)) + { + throw new ArgumentNullException("Please provide a valid tenant Id."); + } + + IEnumerable subscriptionList = ListSubscriptions(tenantId); + subscription = subscriptionList.FirstOrDefault(s => s.Name.Equals(subscriptionName, StringComparison.OrdinalIgnoreCase)); + + return subscription != null; + } + public AzureEnvironment AddOrSetEnvironment(AzureEnvironment environment) { if (environment == null) diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs index 075d4dd0277c..3bec12e091ed 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs @@ -66,14 +66,7 @@ public EnvironmentSetupHelper() System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => true; // Set RunningMocked - if (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Playback) - { - TestMockSupport.RunningMocked = true; - } - else - { - TestMockSupport.RunningMocked = false; - } + TestMockSupport.RunningMocked = HttpMockServer.GetCurrentMode() == HttpRecorderMode.Playback; } /// @@ -103,32 +96,29 @@ public void SetupEnvironment(AzureModule mode) private void SetupAzureEnvironmentFromEnvironmentVariables(AzureModule mode) { - TestEnvironment rdfeEnvironment = new RDFETestEnvironmentFactory().GetTestEnvironment(); - TestEnvironment csmEnvironment = new CSMTestEnvironmentFactory().GetTestEnvironment(); - TestEnvironment currentEnvironment = (mode == AzureModule.AzureResourceManager ? csmEnvironment : rdfeEnvironment); + TestEnvironment currentEnvironment = null; + if (mode == AzureModule.AzureResourceManager) + { + currentEnvironment = new CSMTestEnvironmentFactory().GetTestEnvironment(); + } + else + { + currentEnvironment = new RDFETestEnvironmentFactory().GetTestEnvironment(); + } if (currentEnvironment.UserName == null) { currentEnvironment.UserName = "fakeuser@microsoft.com"; } - SetAuthenticationFactory(mode, rdfeEnvironment, csmEnvironment); + SetAuthenticationFactory(mode, currentEnvironment); AzureEnvironment environment = new AzureEnvironment { Name = testEnvironmentName }; Debug.Assert(currentEnvironment != null); environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory] = currentEnvironment.Endpoints.AADAuthUri.AbsoluteUri; environment.Endpoints[AzureEnvironment.Endpoint.Gallery] = currentEnvironment.Endpoints.GalleryUri.AbsoluteUri; - - if (csmEnvironment != null) - { - environment.Endpoints[AzureEnvironment.Endpoint.ResourceManager] = csmEnvironment.BaseUri.AbsoluteUri; - } - - if (rdfeEnvironment != null) - { - environment.Endpoints[AzureEnvironment.Endpoint.ServiceManagement] = rdfeEnvironment.BaseUri.AbsoluteUri; - } + environment.Endpoints[AzureEnvironment.Endpoint.ServiceManagement] = currentEnvironment.BaseUri.AbsoluteUri; if (!ProfileClient.Profile.Environments.ContainsKey(testEnvironmentName)) { @@ -169,44 +159,29 @@ private void SetupAzureEnvironmentFromEnvironmentVariables(AzureModule mode) } } - private void SetAuthenticationFactory(AzureModule mode, TestEnvironment rdfeEnvironment, TestEnvironment csmEnvironment) + private void SetAuthenticationFactory(AzureModule mode, TestEnvironment environment) { string jwtToken = null; X509Certificate2 certificate = null; - TestEnvironment currentEnvironment = (mode == AzureModule.AzureResourceManager ? csmEnvironment : rdfeEnvironment); - if (mode == AzureModule.AzureServiceManagement) + if (environment.Credentials is TokenCloudCredentials) { - if (rdfeEnvironment.Credentials is TokenCloudCredentials) - { - jwtToken = ((TokenCloudCredentials)rdfeEnvironment.Credentials).Token; - } - if (rdfeEnvironment.Credentials is CertificateCloudCredentials) - { - certificate = ((CertificateCloudCredentials)rdfeEnvironment.Credentials).ManagementCertificate; - } + jwtToken = ((TokenCloudCredentials)environment.Credentials).Token; } - else + if (environment.Credentials is CertificateCloudCredentials) { - if (csmEnvironment.Credentials is TokenCloudCredentials) - { - jwtToken = ((TokenCloudCredentials)csmEnvironment.Credentials).Token; - } - if (csmEnvironment.Credentials is CertificateCloudCredentials) - { - certificate = ((CertificateCloudCredentials)csmEnvironment.Credentials).ManagementCertificate; - } + certificate = ((CertificateCloudCredentials)environment.Credentials).ManagementCertificate; } if (jwtToken != null) { - AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(currentEnvironment.UserName, + AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(environment.UserName, jwtToken); } else if (certificate != null) { - AzureSession.AuthenticationFactory = new MockCertificateAuthenticationFactory(currentEnvironment.UserName, + AzureSession.AuthenticationFactory = new MockCertificateAuthenticationFactory(environment.UserName, certificate); } } diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json b/src/ResourceManager/Profile/Commands.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json index 6e40e34f6a17..3c38ad3c0d5f 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json +++ b/src/ResourceManager/Profile/Commands.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json @@ -10,10 +10,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/tenants/72f988bf-86f1-41af-91ab-2d7cd011db47\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n {\r\n \"id\": \"/tenants/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a\",\r\n \"tenantId\": \"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a\"\r\n },\r\n {\r\n \"id\": \"/tenants/d5f34e25-06f2-42eb-bbe1-0efebece6ed5\",\r\n \"tenantId\": \"d5f34e25-06f2-42eb-bbe1-0efebece6ed5\"\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/tenants/72f988bf-86f1-41af-91ab-2d7cd011db47\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "326" + "116" ], "Content-Type": [ "application/json; charset=utf-8" @@ -25,16 +25,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14994" + "14997" ], "x-ms-request-id": [ - "dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + "a42eba50-f499-4291-96ed-4d11c704ad59" ], "x-ms-correlation-request-id": [ - "dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + "a42eba50-f499-4291-96ed-4d11c704ad59" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092920Z:dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + "WESTUS:20150923T220350Z:a42eba50-f499-4291-96ed-4d11c704ad59" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -43,7 +43,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:19 GMT" + "Wed, 23 Sep 2015 22:03:49 GMT" ] }, "StatusCode": 200 @@ -58,10 +58,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"subscriptionId\": \"279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"displayName\": \"Azure SDK CI\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"subscriptionId\": \"69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"displayName\": \"WebStackAndEF_TestInfra\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"subscriptionId\": \"9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"displayName\": \"FISMA Pen Testing Subscription\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"subscriptionId\": \"c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"displayName\": \"Azure SDK Powershell Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"subscriptionId\": \"d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"displayName\": \"Test Subscription 1 for Migration\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"subscriptionId\": \"3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"displayName\": \"WindowsOnDevices\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "3016" + "1370" ], "Content-Type": [ "application/json; charset=utf-8" @@ -73,16 +73,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14993" + "14996" ], "x-ms-request-id": [ - "3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + "ab82b219-a56e-47b5-9841-4decccd44c31" ], "x-ms-correlation-request-id": [ - "3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + "ab82b219-a56e-47b5-9841-4decccd44c31" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092921Z:3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + "WESTUS:20150923T220350Z:ab82b219-a56e-47b5-9841-4decccd44c31" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -91,7 +91,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:20 GMT" + "Wed, 23 Sep 2015 22:03:50 GMT" ] }, "StatusCode": 200 @@ -106,10 +106,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"subscriptionId\": \"279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"displayName\": \"Azure SDK CI\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"subscriptionId\": \"69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"displayName\": \"WebStackAndEF_TestInfra\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"subscriptionId\": \"9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"displayName\": \"FISMA Pen Testing Subscription\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"subscriptionId\": \"c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"displayName\": \"Azure SDK Powershell Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"subscriptionId\": \"d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"displayName\": \"Test Subscription 1 for Migration\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"subscriptionId\": \"3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"displayName\": \"WindowsOnDevices\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "3016" + "1370" ], "Content-Type": [ "application/json; charset=utf-8" @@ -121,16 +121,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14992" + "14995" ], "x-ms-request-id": [ - "f59628b0-b505-47bd-8662-b362f1585fcc" + "434fa678-e760-47de-bee6-be4db7f9e93f" ], "x-ms-correlation-request-id": [ - "f59628b0-b505-47bd-8662-b362f1585fcc" + "434fa678-e760-47de-bee6-be4db7f9e93f" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092922Z:f59628b0-b505-47bd-8662-b362f1585fcc" + "WESTUS:20150923T220351Z:434fa678-e760-47de-bee6-be4db7f9e93f" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -139,7 +139,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:21 GMT" + "Wed, 23 Sep 2015 22:03:50 GMT" ] }, "StatusCode": 200 @@ -154,10 +154,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"subscriptionId\": \"279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"displayName\": \"Azure SDK CI\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"subscriptionId\": \"69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"displayName\": \"WebStackAndEF_TestInfra\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"subscriptionId\": \"9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"displayName\": \"FISMA Pen Testing Subscription\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"subscriptionId\": \"c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"displayName\": \"Azure SDK Powershell Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"subscriptionId\": \"d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"displayName\": \"Test Subscription 1 for Migration\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"subscriptionId\": \"3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"displayName\": \"WindowsOnDevices\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "3016" + "1370" ], "Content-Type": [ "application/json; charset=utf-8" @@ -169,16 +169,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14991" + "14994" ], "x-ms-request-id": [ - "c6440f00-0988-475d-94da-24d45117ed6f" + "1d2c19cc-dd12-4833-bbd1-4f545dc718a9" ], "x-ms-correlation-request-id": [ - "c6440f00-0988-475d-94da-24d45117ed6f" + "1d2c19cc-dd12-4833-bbd1-4f545dc718a9" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092923Z:c6440f00-0988-475d-94da-24d45117ed6f" + "WESTUS:20150923T220351Z:1d2c19cc-dd12-4833-bbd1-4f545dc718a9" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -187,7 +187,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:23 GMT" + "Wed, 23 Sep 2015 22:03:51 GMT" ] }, "StatusCode": 200 @@ -202,10 +202,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"subscriptionId\": \"279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"displayName\": \"Azure SDK CI\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"subscriptionId\": \"69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"displayName\": \"WebStackAndEF_TestInfra\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"subscriptionId\": \"9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"displayName\": \"FISMA Pen Testing Subscription\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"subscriptionId\": \"c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"displayName\": \"Azure SDK Powershell Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"subscriptionId\": \"d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"displayName\": \"Test Subscription 1 for Migration\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"subscriptionId\": \"3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"displayName\": \"WindowsOnDevices\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "3016" + "1370" ], "Content-Type": [ "application/json; charset=utf-8" @@ -217,16 +217,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14990" + "14993" ], "x-ms-request-id": [ - "821067d5-0dda-4c06-896c-d05adda670be" + "5f375daa-bb7a-4186-9289-62e70bf6ef39" ], "x-ms-correlation-request-id": [ - "821067d5-0dda-4c06-896c-d05adda670be" + "5f375daa-bb7a-4186-9289-62e70bf6ef39" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092941Z:821067d5-0dda-4c06-896c-d05adda670be" + "WESTUS:20150923T220352Z:5f375daa-bb7a-4186-9289-62e70bf6ef39" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -235,7 +235,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:40 GMT" + "Wed, 23 Sep 2015 22:03:51 GMT" ] }, "StatusCode": 200 @@ -250,10 +250,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"subscriptionId\": \"279b0675-cf67-467f-98f0-67ae31eb540f\",\r\n \"displayName\": \"Azure SDK CI\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"subscriptionId\": \"69801886-4b2b-493b-ba5b-3b26dabadadc\",\r\n \"displayName\": \"WebStackAndEF_TestInfra\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"subscriptionId\": \"9ed7cca5-c306-4f66-9d1c-2766e67013d8\",\r\n \"displayName\": \"FISMA Pen Testing Subscription\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"subscriptionId\": \"c9cbd920-c00c-427c-852b-8aaf38badaeb\",\r\n \"displayName\": \"Azure SDK Powershell Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"subscriptionId\": \"d1e52cbc-b073-42e2-a0a0-c2f547118a6e\",\r\n \"displayName\": \"Test Subscription 1 for Migration\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"subscriptionId\": \"3028579c-d25b-4ab8-87fc-455abc9bb7fb\",\r\n \"displayName\": \"WindowsOnDevices\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "3016" + "1370" ], "Content-Type": [ "application/json; charset=utf-8" @@ -265,16 +265,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-tenant-reads": [ - "14989" + "14992" ], "x-ms-request-id": [ - "41377497-013c-4147-a578-899a8c738e7c" + "868cd3dc-7db3-4762-a9db-51270e66e80f" ], "x-ms-correlation-request-id": [ - "41377497-013c-4147-a578-899a8c738e7c" + "868cd3dc-7db3-4762-a9db-51270e66e80f" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092941Z:41377497-013c-4147-a578-899a8c738e7c" + "WESTUS:20150923T220352Z:868cd3dc-7db3-4762-a9db-51270e66e80f" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -283,14 +283,14 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:41 GMT" + "Wed, 23 Sep 2015 22:03:52 GMT" ] }, "StatusCode": 200 }, { - "RequestUri": "/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d?api-version=2014-04-01-preview", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDA5NzdjZGItMTYzZi00MzVmLTljMzItMzllYzhhZTYxZjRkP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { @@ -298,10 +298,58 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"subscriptionId\": \"6b085460-5f21-477e-ba44-1035046e9101\",\r\n \"displayName\": \"Azure SDK Infrastructure\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"subscriptionId\": \"db1ab6f0-4769-4b27-930e-01e2ef9c123c\",\r\n \"displayName\": \"Azure SDK sandbox\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"subscriptionId\": \"d03b04c7-d1d4-467b-aaaa-87b6fcb38b38\",\r\n \"displayName\": \"AppInsight Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"subscriptionId\": \"b6b78feb-3074-4129-8748-42cee6c73020\",\r\n \"displayName\": \"XFD Data Systems - Public\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n }\r\n ]\r\n}", "ResponseHeaders": { "Content-Length": [ - "256" + "1370" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14991" + ], + "x-ms-request-id": [ + "fd52e14b-1d8e-413f-909b-9566de157fa3" + ], + "x-ms-correlation-request-id": [ + "fd52e14b-1d8e-413f-909b-9566de157fa3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150923T220352Z:fd52e14b-1d8e-413f-909b-9566de157fa3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 23 Sep 2015 22:03:52 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMmMyMjRlN2UtM2VmNS00MzFkLWE1N2ItZTcxZjQ2NjJlM2E2P2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "265" ], "Content-Type": [ "application/json; charset=utf-8" @@ -313,16 +361,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14998" + "14936" ], "x-ms-request-id": [ - "0b257a33-7f01-4a98-8d98-1bc654be1159" + "42a18419-bd3f-4e9f-9c78-ce3be611213c" ], "x-ms-correlation-request-id": [ - "0b257a33-7f01-4a98-8d98-1bc654be1159" + "42a18419-bd3f-4e9f-9c78-ce3be611213c" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092923Z:0b257a33-7f01-4a98-8d98-1bc654be1159" + "WESTUS:20150923T220350Z:42a18419-bd3f-4e9f-9c78-ce3be611213c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -331,14 +379,14 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:23 GMT" + "Wed, 23 Sep 2015 22:03:50 GMT" ] }, "StatusCode": 200 }, { - "RequestUri": "/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d?api-version=2014-04-01-preview", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDA5NzdjZGItMTYzZi00MzVmLTljMzItMzllYzhhZTYxZjRkP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestUri": "/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMmMyMjRlN2UtM2VmNS00MzFkLWE1N2ItZTcxZjQ2NjJlM2E2P2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { @@ -346,10 +394,10 @@ "Microsoft.Azure.Subscriptions.SubscriptionClient/2.0.0.0" ] }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"subscriptionId\": \"00977cdb-163f-435f-9c32-39ec8ae61f4d\",\r\n \"displayName\": \"node\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n}", + "ResponseBody": "{\r\n \"id\": \"/subscriptions/2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"subscriptionId\": \"2c224e7e-3ef5-431d-a57b-e71f4662e3a6\",\r\n \"displayName\": \"Node CLI Test\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\"\r\n }\r\n}", "ResponseHeaders": { "Content-Length": [ - "256" + "265" ], "Content-Type": [ "application/json; charset=utf-8" @@ -361,16 +409,16 @@ "no-cache" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14997" + "14935" ], "x-ms-request-id": [ - "ad76a94a-cb03-494f-853e-7c0a68a7766a" + "eb25825e-45d8-4e13-8dcc-6fb4479760e1" ], "x-ms-correlation-request-id": [ - "ad76a94a-cb03-494f-853e-7c0a68a7766a" + "eb25825e-45d8-4e13-8dcc-6fb4479760e1" ], "x-ms-routing-request-id": [ - "WESTUS:20150917T092936Z:ad76a94a-cb03-494f-853e-7c0a68a7766a" + "WESTUS:20150923T220350Z:eb25825e-45d8-4e13-8dcc-6fb4479760e1" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" @@ -379,7 +427,7 @@ "no-cache" ], "Date": [ - "Thu, 17 Sep 2015 09:29:36 GMT" + "Wed, 23 Sep 2015 22:03:50 GMT" ] }, "StatusCode": 200 diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.cs index 19c5917699ad..3316ba3e3230 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.cs @@ -35,7 +35,7 @@ public class SubscriptionCmdletTests [Trait(Category.AcceptanceType, Category.CheckIn)] public void AllParameterSetsSucceed() { - ProfileController.NewInstance.RunPsTest("72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-GetSubscriptionsEndToEnd"); + ProfileController.NewInstance.RunPsTest("db1ab6f0-4769-4b27-930e-01e2ef9c123c", "Test-GetSubscriptionsEndToEnd"); } } } diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.ps1 b/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.ps1 index 8f2face12e47..c83c618bd526 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.ps1 +++ b/src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.ps1 @@ -21,6 +21,7 @@ function Test-GetSubscriptionsEndToEnd $allSubscriptions = Get-AzureRmSubscription -All $firstSubscription = $allSubscriptions[0] $id = $firstSubscription.Id + $name = $firstSubscription.Name $tenant = $firstSubscription.GetProperty([Microsoft.Azure.Common.Authentication.Models.AzureSubscription+Property]::Tenants) $subscription = Get-AzureRmSubscription -SubscriptionId $id -Tenant $tenant Assert-True { $subscription -ne $null } @@ -28,6 +29,15 @@ function Test-GetSubscriptionsEndToEnd $subscription = Get-AzureRmSubscription -SubscriptionId $id Assert-True { $subscription -ne $null } Assert-AreEqual $id $subscription.Id + $subscription = Get-AzureRmSubscription -SubscriptionName $name -Tenant $tenant + Assert-True { $subscription -ne $null } + Assert-AreEqual $name $subscription.Name + $subscription = Get-AzureRmSubscription -SubscriptionName $name + Assert-True { $subscription -ne $null } + Assert-AreEqual $name $subscription.Name + $subscription = Get-AzureRmSubscription -SubscriptionName $name.ToUpper() + Assert-True { $subscription -ne $null } + Assert-AreEqual $name $subscription.Name $mostSubscriptions = Get-AzureRmSubscription Assert-True {$mostSubscriptions.Count -gt 0} $tenantSubscriptions = Get-AzureRmSubscription -Tenant $tenant diff --git a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs index e95e905f75d8..232c0b7b835a 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs @@ -19,19 +19,24 @@ namespace Microsoft.Azure.Commands.Profile { - [Cmdlet(VerbsCommon.Get, "AzureRmSubscription", DefaultParameterSetName = ListInTenantParameterSet), + [Cmdlet(VerbsCommon.Get, "AzureRmSubscription", DefaultParameterSetName = ListByIdInTenantParameterSet), OutputType(typeof(AzureSubscription))] public class GetAzureRMSubscriptionCommand : AzureRMCmdlet { - public const string ListInTenantParameterSet = "ListInTenant"; + public const string ListByIdInTenantParameterSet = "ListByIdInTenant"; + public const string ListByNameInTenantParameterSet = "ListByNameInTenant"; public const string ListAllParameterSet = "ListAll"; private RMProfileClient _client; - [Parameter(ParameterSetName= ListInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory=false)] + [Parameter(ParameterSetName= ListByIdInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory=false)] public string SubscriptionId { get; set; } - [Parameter(ParameterSetName = ListInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory = false)] + [Parameter(ParameterSetName = ListByNameInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory = false)] + public string SubscriptionName { get; set; } + + [Parameter(ParameterSetName = ListByIdInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory = false)] + [Parameter(ParameterSetName = ListByNameInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory = false)] public string Tenant { get; set; } [Parameter(ParameterSetName = ListAllParameterSet, Mandatory = true)] @@ -60,6 +65,26 @@ protected override void ProcessRecord() throw new PSInvalidOperationException(string.Format(Resources.CommonTenantAuthFailed, account), exception); } } + else if (!string.IsNullOrWhiteSpace(this.SubscriptionName)) + { + var tenant = EnsureValidTenant(); + AzureSubscription result; + try + { + if (!this._client.TryGetSubscriptionByName(tenant, this.SubscriptionName, out result)) + { + ThrowSubscriptionNotFoundError(this.Tenant, this.SubscriptionName); + } + + WriteObject(result); + } + catch (AadAuthenticationException exception) + { + ThrowTenantAuthenticationError(tenant, exception); + throw; + } + + } else if (!string.IsNullOrWhiteSpace(this.SubscriptionId)) { var tenant = EnsureValidTenant();