From 0268fb057a49d686d739bebf9f47ad9b71422ce9 Mon Sep 17 00:00:00 2001 From: markcowl Date: Tue, 15 Sep 2015 11:28:28 -0700 Subject: [PATCH 01/10] Add Get-AzureRMSubscription cmdlet --- .../Commands.ResourceManager.Profile.csproj | 1 + .../GetAzureRMSubscription.cs | 48 +++++++++++++++++++ .../Profile/SaveAzureProfile.cs | 18 +++---- .../Profile/SelectAzureProfile.cs | 7 +++ 4 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs diff --git a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj index 5ff4ba4ddab5..e541485c3997 100644 --- a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj +++ b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj @@ -132,6 +132,7 @@ + diff --git a/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs new file mode 100644 index 000000000000..76fe1206b99a --- /dev/null +++ b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs @@ -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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Linq; +using Microsoft.Azure.Commands.ResourceManager.Common; +using System.Management.Automation; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using System.Security; +using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Subscriptions; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.Profile +{ + [Cmdlet(VerbsCommon.Get, "AzureRMSubscription"), OutputType(typeof(AzureSubscription))] + public class GetAzureRMSubscriptionCommand : AzureRMCmdlet + { + protected override void ProcessRecord() + { + var subscriptionClient = AzureSession.ClientFactory.CreateClient(DefaultContext, AzureEnvironment.Endpoint.ResourceManager); + var subscriptions = subscriptionClient.Subscriptions.List(); + WriteObject(subscriptions.Subscriptions.Select((s) => + { + var subscription = new AzureSubscription(); + subscription.Account = DefaultContext.Account != null? DefaultContext.Account.Id : null; + subscription.Environment = DefaultContext.Environment != null? DefaultContext.Environment.Name : EnvironmentName.AzureCloud; + subscription.Id = new Guid(s.SubscriptionId); + subscription.Name = s.DisplayName; + subscription.SetProperty(AzureSubscription.Property.Tenants, + DefaultContext.Tenant.Id.ToString()); + return subscription; + })); + } + } +} diff --git a/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureProfile.cs b/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureProfile.cs index 603ddb6a6bdc..558c2ea3d35e 100644 --- a/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureProfile.cs +++ b/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureProfile.cs @@ -17,6 +17,7 @@ using Microsoft.Azure.Common.Authentication.Models; using System; using System.Management.Automation; +using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.Profile { @@ -30,23 +31,24 @@ public class SaveAzureProfileCommand : AzureRMCmdlet public AzureRMProfile Profile { get; set; } [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] public string Path { get; set; } protected override void ProcessRecord() { - if (Profile != null) + AzureRMProfile profileToSave = Profile; + if (profileToSave == null) { - Profile.Save(Path); + profileToSave = AzureRMCmdlet.DefaultProfile; } - else + + if (profileToSave == null) { - if (AzureRMCmdlet.DefaultProfile == null) - { - throw new ArgumentException(Resources.AzureProfileMustNotBeNull); - } - AzureRMCmdlet.DefaultProfile.Save(Path); + throw new ArgumentException(Resources.AzureProfileMustNotBeNull); } + profileToSave.TokenCache = TokenCache.DefaultShared.Serialize(); + profileToSave.Save(Path); WriteVerbose(string.Format("Profile saved to: {0}.", Path)); } } diff --git a/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureProfile.cs b/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureProfile.cs index 7639f12ab319..4d39909156e0 100644 --- a/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureProfile.cs +++ b/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureProfile.cs @@ -17,6 +17,8 @@ using Microsoft.Azure.Common.Authentication.Models; using System; using System.Management.Automation; +using Microsoft.Azure.Common.Authentication; +using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.Profile { @@ -51,6 +53,11 @@ protected override void ProcessRecord() throw new ArgumentException(Resources.AzureProfileMustNotBeNull); } + if (DefaultProfile.TokenCache != null && DefaultProfile.TokenCache.Length > 0) + { + TokenCache.DefaultShared.Deserialize(DefaultProfile.TokenCache); + } + WriteObject(AzureRMCmdlet.DefaultProfile); } } From 5dfed00f5037cf131477fd3bae90fee42826fc93 Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 16 Sep 2015 15:32:14 -0700 Subject: [PATCH 02/10] [#102950504]: Add common test project and tests for RMProfileClient --- .../AzureRMProfileTests.cs | 163 +++++++++++++++ ...ommands.ResourceManager.Common.Test.csproj | 195 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../packages.config | 23 +++ .../Commands.ResourceManager.Common.csproj | 1 + .../ModelExtensions.cs | 26 +++ .../RMProfileClient.cs | 72 ++++++- .../GetAzureRMSubscription.cs | 88 ++++++-- src/ResourceManager.sln | 7 + 9 files changed, 594 insertions(+), 17 deletions(-) create mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs create mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj create mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs create mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config create mode 100644 src/Common/Commands.ResourceManager.Common/ModelExtensions.cs diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs new file mode 100644 index 000000000000..3ce786c634da --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs @@ -0,0 +1,163 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Utilities.Common; +using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using System.Linq; +using Xunit; +using System; +using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; +using Hyak.Common; +using System.Management.Automation; +using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Moq; +using Microsoft.Rest; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Subscriptions; +using Microsoft.Azure.Subscriptions.Models; + +namespace Microsoft.Azure.Commands.ResourceManager.Common.Test +{ + + public class MockSubscriptionClientFactory + { + private IDictionary> _map; + private string _currentTenant; + public MockSubscriptionClientFactory(IDictionary> tenantSubscriptionMap) + { + _map = tenantSubscriptionMap; + } + + public SubscriptionClient GetSubscriptionClient(string tenant) + { + var tenantMock = new Mock(); + tenantMock.Setup(t => t.ListAsync(It.IsAny())) + .Returns( + (CancellationToken token) => + Task.FromResult(new TenantListResult() + { + StatusCode = HttpStatusCode.OK, + RequestId = Guid.NewGuid().ToString(), + TenantIds = _map.Keys.Select((k) => new TenantIdDescription() { Id = k, TenantId = k }).ToList() + })); + var subscriptionMock = new Mock(); + subscriptionMock.Setup( + s => s.GetAsync(It.IsAny(), It.IsAny())).Returns( + (string subId, CancellationToken token) => + { + GetSubscriptionResult result = null; + if (_map.ContainsKey(_currentTenant) && _map[_currentTenant].Contains(subId)) + { + result = new GetSubscriptionResult + { + RequestId = Guid.NewGuid().ToString(), + StatusCode = HttpStatusCode.OK, + Subscription = + new Subscription + { + DisplayName = "Returned SUbscription", + Id = subId, + State = "Active", + SubscriptionId = subId + } + }; + } + + return Task.FromResult(result); + }); + subscriptionMock.Setup( + (s) => s.ListAsync(It.IsAny())).Returns( + (CancellationToken token) => + { + SubscriptionListResult result = null; + if (_map.ContainsKey(_currentTenant)) + { + result = new SubscriptionListResult + { + StatusCode = HttpStatusCode.OK, + RequestId = Guid.NewGuid().ToString(), + Subscriptions = + new List( + _map[_currentTenant].Select( + sub => + new Subscription + { + DisplayName = "Contoso Subscription", + Id = sub, + State = "Active", + SubscriptionId = sub + })) + }; + } + + return Task.FromResult(result); + }); + var client = new Mock(); + client.SetupGet(c => c.Subscriptions).Returns(subscriptionMock.Object); + client.SetupGet(c => c.Tenants).Returns(tenantMock.Object); + return client.Object; + } + } + + public class AzureRMProfileTests + { + private const string DefaultAccount = "admin@contoso.com"; + private static Guid DefaultSubscription = Guid.NewGuid(); + private static string DefaultSubscriptionName = "Contoso Subscription"; + private static string DefaultDomain = "contoso.com"; + private static Guid DefaultTenant = Guid.NewGuid(); + [Fact] + public void TestListSubscriptionWithoutTenantsThrows() + { + AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(DefaultAccount, + Guid.NewGuid().ToString()); + var clientFactory = new MockSubscriptionClientFactory(new Dictionary>()); + AzureSession.ClientFactory = new MockClientFactory( new List + { + clientFactory.GetSubscriptionClient(DefaultTenant.ToString()) + }, true); + var context = new AzureContext(new AzureSubscription() {Account=DefaultAccount, + Environment =EnvironmentName.AzureCloud, Id = DefaultSubscription, Name=DefaultSubscriptionName }, + new AzureAccount() {Id = DefaultAccount, Type = AzureAccount.AccountType.User}, + AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], + new AzureTenant() {Domain = DefaultDomain, Id = DefaultTenant}); + var profile = new AzureRMProfile(); + profile.DefaultContext = context; + RMProfileClient client = new RMProfileClient( profile); + + } + + [Fact] + public void TestListSubscriptionWithoutSubscriptionsThrows() + { + } + + [Fact] + public void TestListSubscriptionWithSingleTenantSingleSubscription() + { + } + + [Fact] + public void TestListSubscriptionWithMultipleTenantsAndSubscriptions() + { + } + } +} diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj new file mode 100644 index 000000000000..83e1b2be6bdb --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -0,0 +1,195 @@ + + + + + + Debug + AnyCPU + {26B01740-0C84-48D2-BF5E-7F0473421EB7} + Library + Properties + Microsoft.Azure.Commands.ResourceManager.Common.Test + Microsoft.Azure.Commands.ResourceManager.Common.Test + v4.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.1.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + True + + + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + True + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + True + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.2.0\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.9.3\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + + + ..\..\..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll + True + + + ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + True + + + + + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll + True + + + + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + True + + + ..\..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll + True + + + ..\..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll + True + + + + + + + + + + + + False + + + + + + + + + + + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} + Commands.ResourceManager.Common + + + {3436a126-edc9-4060-8952-9a1be34cdd95} + Commands.ScenarioTests.ResourceManager.Common + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..303985df5ede --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Commands.ResourceManager.Common.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Commands.ResourceManager.Common.Test")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("26b01740-0c84-48d2-bf5e-7f0473421eb7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config new file mode 100644 index 000000000000..ba9f4a70f99a --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj index 1d8468a9dda6..c7489686e997 100644 --- a/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj +++ b/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj @@ -183,6 +183,7 @@ Common\TestMockSupport.cs + True diff --git a/src/Common/Commands.ResourceManager.Common/ModelExtensions.cs b/src/Common/Commands.ResourceManager.Common/ModelExtensions.cs new file mode 100644 index 000000000000..e5731fc7120e --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common/ModelExtensions.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Subscriptions.Models; + +namespace Microsoft.Azure.Commands.ResourceManager.Common +{ + public static class ModelExtensions + { + + public static AzureSubscription ToAzureSubscription(this Subscription other, AzureContext context) + { + var subscription = new AzureSubscription(); + subscription.Account = context.Account != null ? context.Account.Id : null; + subscription.Environment = context.Environment != null ? context.Environment.Name : EnvironmentName.AzureCloud; + subscription.Id = new Guid(other.SubscriptionId); + subscription.Name = other.DisplayName; + subscription.SetProperty(AzureSubscription.Property.Tenants, + context.Tenant.Id.ToString()); + return subscription; + } + } +} diff --git a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs index cd3908bafca1..03cc527c0a70 100644 --- a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs +++ b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs @@ -73,6 +73,12 @@ public AzureRMProfile Login(AzureAccount account, AzureEnvironment environment, return _profile; } + public bool TryGetSubscription(string tenantId, string subscriptionId, out AzureSubscription subscription) + { + return TryGetTenantSubscription(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, + tenantId, subscriptionId, null, ShowDialog.Never, out subscription); + } + private bool TryGetTenantSubscription( AzureAccount account, AzureEnvironment environment, @@ -108,7 +114,8 @@ private bool TryGetTenantSubscription( if (subscriptions.Count > 1) { WriteWarningMessage(string.Format( - "Tenant '{0}' contains more than one subscription. First one will be selected for further use.", + "Tenant '{0}' contains more than one subscription. First one will be selected for further use. " + + "To select another subscription, use Set-AzureRMContext.", tenantId)); } subscriptionFromServer = subscriptions.First(); @@ -153,6 +160,69 @@ private string[] ListAccountTenants(AzureAccount account, AzureEnvironment envir } } + /// + /// List all tenants for the account in the profile context + /// + /// The list of tenants for the default account. + public string[] ListTenants() + { + return ListAccountTenants(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, null); + } + + private IEnumerable ListSubscriptionsForTenant(AzureAccount account, AzureEnvironment environment, + SecureString password, ShowDialog promptBehavior, string tenantId) + { + var accessToken = AzureSession.AuthenticationFactory.Authenticate( + account, + environment, + tenantId, + password, + promptBehavior); + using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient( + new TokenCloudCredentials(accessToken.AccessToken), + environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager))) + { + var subscriptions = subscriptionClient.Subscriptions.List(); + if (subscriptions != null && subscriptions.Subscriptions != null) + { + return + subscriptions.Subscriptions.Select( + (s) => + s.ToAzureSubscription(new AzureContext(_profile.DefaultContext.Subscription, account, + environment, new AzureTenant {Id = new Guid(tenantId)}))); + } + + return null; + } + } + + public IEnumerable ListSubscriptions(string tenant) + { + return ListSubscriptionsForTenant(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, null, + ShowDialog.Never, tenant); + } + + public IEnumerable ListSubscriptions() + { + List subscriptions = new List(); + foreach (var tenant in ListTenants()) + { + try + { + subscriptions.AddRange(ListSubscriptions(tenant)); + } + catch (AadAuthenticationException) + { + WriteWarningMessage(string.Format("Could not authenticate user account {0} with tenant {1}. " + + "Subscriptions in this tenant will not be listed. Please login again using Login-AzureRMAccount " + + "to view the subscriptions in this tenant.", _profile.DefaultContext.Account, tenant)); + } + + } + + return subscriptions; + } + private void WriteWarningMessage(string message) { if (WarningLog != null) diff --git a/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs index 76fe1206b99a..6dc7771b3233 100644 --- a/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs +++ b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs @@ -12,37 +12,93 @@ // ---------------------------------------------------------------------------------- using System; +using System.Collections.Generic; using System.Linq; using Microsoft.Azure.Commands.ResourceManager.Common; using System.Management.Automation; +using System.Net; using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Common.Authentication.Models; -using System.Security; +using Hyak.Common; using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Subscriptions; -using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Profile { - [Cmdlet(VerbsCommon.Get, "AzureRMSubscription"), OutputType(typeof(AzureSubscription))] + [Cmdlet(VerbsCommon.Get, "AzureRMSubscription", DefaultParameterSetName = ListInTenantParameterSet), + OutputType(typeof(AzureSubscription))] public class GetAzureRMSubscriptionCommand : AzureRMCmdlet { + public const string ListInTenantParameterSet = "ListInTenant"; + public const string ListAllParameterSet = "ListAll"; + + private RMProfileClient _client; + + [Parameter(ParameterSetName= ListInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory=false)] + public string SubscriptionId { get; set; } + + [Parameter(ParameterSetName = ListInTenantParameterSet, ValueFromPipelineByPropertyName = true, Mandatory = false)] + public string Tenant { get; set; } + + [Parameter(ParameterSetName = ListAllParameterSet, Mandatory = true)] + public SwitchParameter All { get; set; } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + _client = new RMProfileClient(DefaultProfile); + _client.WarningLog = (s) => WriteWarning(s); + } + protected override void ProcessRecord() { - var subscriptionClient = AzureSession.ClientFactory.CreateClient(DefaultContext, AzureEnvironment.Endpoint.ResourceManager); - var subscriptions = subscriptionClient.Subscriptions.List(); - WriteObject(subscriptions.Subscriptions.Select((s) => + if (this.ParameterSetName == ListAllParameterSet) + { + try + { + WriteObject(_client.ListSubscriptions()); + } + catch (AadAuthenticationException) + { + WriteErrorWithTimestamp(string.Format("Could not authenticate your user account {0} with the common tenant. " + + "Please login again using Login-AzureRMAccount.", DefaultContext.Account)); + throw; + } + } + else if (!string.IsNullOrWhiteSpace(this.SubscriptionId)) + { + AzureSubscription result; + if (!this._client.TryGetSubscription(this.Tenant, this.SubscriptionId, out result)) + { + WriteSubscriptionNotFoundError(this.Tenant, this.SubscriptionId); + } + + WriteObject( result); + } + else { - var subscription = new AzureSubscription(); - subscription.Account = DefaultContext.Account != null? DefaultContext.Account.Id : null; - subscription.Environment = DefaultContext.Environment != null? DefaultContext.Environment.Name : EnvironmentName.AzureCloud; - subscription.Id = new Guid(s.SubscriptionId); - subscription.Name = s.DisplayName; - subscription.SetProperty(AzureSubscription.Property.Tenants, - DefaultContext.Tenant.Id.ToString()); - return subscription; - })); + var tenant = this.Tenant; + if (string.IsNullOrWhiteSpace(tenant)) + { + if (DefaultContext.Tenant != null && DefaultContext.Tenant.Id != null) + { + tenant = DefaultContext.Tenant.Id.ToString(); + } + else + { + throw new PSArgumentException( + "No tenant Id was provided. Please log in using Login-AzureRMAcount, or provide a tenant in the 'Tenant' parameter."); + } + } + + WriteObject(_client.ListSubscriptions(tenant)); + } + } + + private void WriteSubscriptionNotFoundError(string subscription, string tenant) + { + throw new PSArgumentException(string.Format("Subscription {0} was not found in tenant {1}. " + + "Please verify that the subscription exists in this tenant.", subscription, tenant)); } } } diff --git a/src/ResourceManager.sln b/src/ResourceManager.sln index e550a10af0bb..848eca6a072e 100644 --- a/src/ResourceManager.sln +++ b/src/ResourceManager.sln @@ -119,6 +119,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManager.Common.Test", "Common\Commands.ResourceManager.Common.Test\Commands.ResourceManager.Common.Test\Commands.ResourceManager.Common.Test.csproj", "{26B01740-0C84-48D2-BF5E-7F0473421EB7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -341,6 +343,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -371,5 +377,6 @@ Global {13E031E4-8A43-4B87-9D72-D70180C31C11} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {3436A126-EDC9-4060-8952-9A1BE34CDD95} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {5EE72C53-1720-4309-B54B-5FB79703195F} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} + {26B01740-0C84-48D2-BF5E-7F0473421EB7} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal From df712db74be5ed291e994d72142f36c163730795 Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 16 Sep 2015 17:35:17 -0700 Subject: [PATCH 03/10] [#102950504]: merging with upstream --- .../Commands.Common.Storage.csproj | 6 +++++- .../Commands.Common.Storage/packages.config | 3 ++- src/Common/Commands.Common/Commands.Common.csproj | 2 +- src/Common/Commands.Common/packages.config | 2 +- .../Commands.ResourceManager.Common.Test.csproj | 2 +- .../packages.config | 2 +- .../Commands.ResourceManager.Common.csproj | 2 +- .../RMProfileClient.cs | 10 +++++----- .../packages.config | 2 +- .../Commands.ResourceManager.Profile.Test.csproj | 2 +- .../Commands.ResourceManager.Profile.csproj | 3 ++- ...ds.ScenarioTests.ResourceManager.Common.csproj | 2 +- ...ommands.ApiManagement.ServiceManagement.csproj | 6 +++++- .../packages.config | 3 ++- .../Commands.ApiManagement.Test.csproj | 2 +- .../Commands.ApiManagement.csproj | 4 ++++ .../Commands.ApiManagement/packages.config | 3 ++- ...ds.ApiManagement.ServiceManagement.Test.csproj | 2 +- ...ands.ResourceManagement.Automation.Test.csproj | 2 +- .../Commands.ResourceManagement.Automation.csproj | 2 +- .../Commands.AzureBackup.Test.csproj | 2 +- .../Commands.AzureBackup.csproj | 2 +- .../Commands.Batch.Test.csproj | 3 ++- .../Commands.Batch.Test/packages.config | 2 +- .../Commands.Batch/Commands.Batch.csproj | 15 ++++++++------- .../AzureBatch/Commands.Batch/packages.config | 6 +++--- .../Commands.UsageAggregates/packages.config | 2 +- .../Commands.Compute.Test.csproj | 2 +- .../Commands.Compute/Commands.Compute.csproj | 6 +++++- .../Compute/Commands.Compute/packages.config | 3 ++- .../Commands.DataFactories.Test.csproj | 2 +- .../Commands.DataFactories.Test/packages.config | 4 ++-- .../Commands.DataFactories.csproj | 4 ++++ .../Commands.DataFactories/packages.config | 5 +++-- .../Commands.Dns.Test/Commands.Dns.Test.csproj | 2 +- .../Dns/Commands.Dns/packages.config | 2 +- .../Commands.HDInsight.Test.csproj | 1 + .../Commands.HDInsight/Commands.HDInsight.csproj | 4 +++- .../HDInsight/Commands.HDInsight/packages.config | 10 +++++----- .../Commands.Insights.Test.csproj | 3 ++- .../Commands.Insights.Test/packages.config | 2 +- .../Commands.Insights/Commands.Insights.csproj | 1 + .../Insights/Commands.Insights/packages.config | 8 ++++---- .../Commands.KeyVault.Test.csproj | 4 ++-- .../Commands.KeyVault/Commands.KeyVault.csproj | 2 +- .../Commands.Network.Test.csproj | 2 +- .../Commands.Network/Commands.Network.csproj | 4 ++++ .../Network/Commands.Network/packages.config | 3 ++- .../Commands.OperationalInsights.Test.csproj | 2 +- .../Commands.RedisCache.Test.csproj | 2 +- .../Commands.Resources.Test.csproj | 5 +++-- .../Commands.Resources.Test/packages.config | 2 +- .../Commands.SiteRecovery.Test.csproj | 2 +- .../Commands.SiteRecovery/packages.config | 2 +- .../Commands.Sql.Test/Commands.Sql.Test.csproj | 8 ++++---- .../Sql/Commands.Sql.Test/packages.config | 4 ++-- .../Sql/Commands.Sql/Commands.Sql.csproj | 12 ++++++++---- .../Sql/Commands.Sql/packages.config | 3 ++- .../Commands.Management.Storage.Test.csproj | 3 ++- .../packages.config | 2 +- .../Commands.Management.Storage/packages.config | 4 ++-- .../Commands.StreamAnalytics.Test.csproj | 2 +- .../Commands.StreamAnalytics.Test/packages.config | 2 +- .../Commands.StreamAnalytics.csproj | 4 ++++ .../Commands.StreamAnalytics/packages.config | 3 ++- .../Commands.TrafficManager2.Test.csproj | 2 +- .../Commands.Websites.Test.csproj | 3 ++- .../Commands.Storage/Commands.Storage.csproj | 4 ++++ .../Storage/Commands.Storage/packages.config | 3 ++- 69 files changed, 149 insertions(+), 93 deletions(-) diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index d7c1e7e01791..588c8a15e5fc 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -57,13 +57,17 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/Common/Commands.Common.Storage/packages.config b/src/Common/Commands.Common.Storage/packages.config index 5cc9c60e8074..dad781bcb501 100644 --- a/src/Common/Commands.Common.Storage/packages.config +++ b/src/Common/Commands.Common.Storage/packages.config @@ -4,6 +4,7 @@ + @@ -21,4 +22,4 @@ - + \ No newline at end of file diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 63319dde1231..d78e6a93ba52 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -64,8 +64,8 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/Common/Commands.Common/packages.config b/src/Common/Commands.Common/packages.config index dd635905d17b..8b3394fd6012 100644 --- a/src/Common/Commands.Common/packages.config +++ b/src/Common/Commands.Common/packages.config @@ -16,4 +16,4 @@ - + \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj index 83e1b2be6bdb..040b209adb2d 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -49,7 +49,7 @@ True - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.1.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll True diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config index ba9f4a70f99a..9167521c94fe 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj index b9ae8c83037d..842522e6ed73 100644 --- a/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj +++ b/src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj @@ -61,8 +61,8 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs index 4ae96b570148..6f1054cb7abd 100644 --- a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs +++ b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs @@ -137,7 +137,7 @@ public AzureContext UpdateCurrentContext(string subscriptionId, string tenantId) public bool TryGetSubscription(string tenantId, string subscriptionId, out AzureSubscription subscription) { - return TryGetTenantSubscription(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, + return TryGetTenantSubscription(_profile.Context.Account, _profile.Context.Environment, tenantId, subscriptionId, null, ShowDialog.Never, out subscription); } @@ -234,7 +234,7 @@ private string[] ListAccountTenants(AzureAccount account, AzureEnvironment envir /// The list of tenants for the default account. public string[] ListTenants() { - return ListAccountTenants(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, null); + return ListAccountTenants(_profile.Context.Account, _profile.Context.Environment, null); } private IEnumerable ListSubscriptionsForTenant(AzureAccount account, AzureEnvironment environment, @@ -256,7 +256,7 @@ private IEnumerable ListSubscriptionsForTenant(AzureAccount a return subscriptions.Subscriptions.Select( (s) => - s.ToAzureSubscription(new AzureContext(_profile.DefaultContext.Subscription, account, + s.ToAzureSubscription(new AzureContext(_profile.Context.Subscription, account, environment, new AzureTenant {Id = new Guid(tenantId)}))); } @@ -266,7 +266,7 @@ private IEnumerable ListSubscriptionsForTenant(AzureAccount a public IEnumerable ListSubscriptions(string tenant) { - return ListSubscriptionsForTenant(_profile.DefaultContext.Account, _profile.DefaultContext.Environment, null, + return ListSubscriptionsForTenant(_profile.Context.Account, _profile.Context.Environment, null, ShowDialog.Never, tenant); } @@ -283,7 +283,7 @@ public IEnumerable ListSubscriptions() { WriteWarningMessage(string.Format("Could not authenticate user account {0} with tenant {1}. " + "Subscriptions in this tenant will not be listed. Please login again using Login-AzureRMAccount " + - "to view the subscriptions in this tenant.", _profile.DefaultContext.Account, tenant)); + "to view the subscriptions in this tenant.", _profile.Context.Account, tenant)); } } diff --git a/src/Common/Commands.ResourceManager.Common/packages.config b/src/Common/Commands.ResourceManager.Common/packages.config index dd635905d17b..8b3394fd6012 100644 --- a/src/Common/Commands.ResourceManager.Common/packages.config +++ b/src/Common/Commands.ResourceManager.Common/packages.config @@ -16,4 +16,4 @@ - + \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj index 1e45ab05550c..d249edec5964 100644 --- a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj +++ b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj @@ -58,8 +58,8 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj index 3edbd22dc7b1..4faa9da7e3d9 100644 --- a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj +++ b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj @@ -132,7 +132,8 @@ - + + diff --git a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj index 2e10370f61d9..f0b77bcd41fb 100644 --- a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj +++ b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj @@ -46,8 +46,8 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj index f1062a23ecb4..a373866a0fdf 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj @@ -60,12 +60,16 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.ApiManagement.1.0.2-preview\lib\net40\Microsoft.Azure.Management.ApiManagement.dll diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config index 1604746b7888..5fcdc5862226 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config @@ -5,6 +5,7 @@ + @@ -22,4 +23,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj index 1232efbd99c2..7c139d66825b 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj @@ -42,8 +42,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj index 0f6270c4329e..708c83de9b5a 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj @@ -65,6 +65,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.ApiManagement.1.0.2-preview\lib\net40\Microsoft.Azure.Management.ApiManagement.dll diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config index 1604746b7888..5fcdc5862226 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config @@ -5,6 +5,7 @@ + @@ -22,4 +23,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj index c60eeec824e9..a832f12d73cb 100644 --- a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj +++ b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj @@ -42,8 +42,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj index 0fce7e9967e9..8a4a1cfb65a6 100644 --- a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj +++ b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj @@ -57,8 +57,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj b/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj index afe38ea6c848..4a9eee5e2461 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj +++ b/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj @@ -60,8 +60,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False 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 9a6fa71997e5..8e06a760b7cb 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -36,8 +36,8 @@ - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.4-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index df978f1c1959..a91979be3e21 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -50,8 +50,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj index 3154f653d1b9..49f995100f15 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj @@ -51,8 +51,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -223,6 +223,7 @@ + Designer diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config b/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config index e14354c57cf3..a1b2dd645320 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config @@ -30,4 +30,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj index 4147d0850747..42aebd2c6938 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj @@ -52,8 +52,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -104,9 +104,9 @@ ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll - - False - ..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + ..\..\..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + True False @@ -139,9 +139,9 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - - False - ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + + ..\..\..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll + True @@ -286,6 +286,7 @@ + Always Designer diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/packages.config b/src/ResourceManager/AzureBatch/Commands.Batch/packages.config index 94d26a1e6c2b..15b7a9cc80ad 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/packages.config +++ b/src/ResourceManager/AzureBatch/Commands.Batch/packages.config @@ -20,6 +20,6 @@ - - - + + + \ No newline at end of file diff --git a/src/ResourceManager/Commerce/Commands.UsageAggregates/packages.config b/src/ResourceManager/Commerce/Commands.UsageAggregates/packages.config index 6dc202190a86..a95b798c8f16 100644 --- a/src/ResourceManager/Commerce/Commands.UsageAggregates/packages.config +++ b/src/ResourceManager/Commerce/Commands.UsageAggregates/packages.config @@ -1,9 +1,9 @@  - + diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj index 0b84fc0e2ab7..4a4e5d7a5b91 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj +++ b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj @@ -50,8 +50,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj index 270f69dd9e74..cc41d2f23ac4 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj +++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj @@ -59,8 +59,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,6 +72,10 @@ False ..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll True diff --git a/src/ResourceManager/Compute/Commands.Compute/packages.config b/src/ResourceManager/Compute/Commands.Compute/packages.config index 80e26de1ad16..9daf2eaa1c77 100644 --- a/src/ResourceManager/Compute/Commands.Compute/packages.config +++ b/src/ResourceManager/Compute/Commands.Compute/packages.config @@ -7,6 +7,7 @@ + @@ -25,4 +26,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj index 31eff11607e0..15d410ede3e6 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj @@ -49,8 +49,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config index bf9dde869710..41db87b08c75 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config @@ -7,10 +7,10 @@ + - @@ -30,4 +30,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 10b32e46e218..f29042ee0d5c 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -61,6 +61,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + ..\..\..\packages\Microsoft.Azure.Management.DataFactories.3.0.0\lib\net45\Microsoft.Azure.Management.DataFactories.dll True diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config index 3288ea2144f4..4f83a6b163b0 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config @@ -4,8 +4,9 @@ - + + @@ -21,4 +22,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj b/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj index e80dfe7074e3..7ba5daab3298 100644 --- a/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj +++ b/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj @@ -52,8 +52,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/ResourceManager/Dns/Commands.Dns/packages.config b/src/ResourceManager/Dns/Commands.Dns/packages.config index d860c091c453..39bd23233a55 100644 --- a/src/ResourceManager/Dns/Commands.Dns/packages.config +++ b/src/ResourceManager/Dns/Commands.Dns/packages.config @@ -19,4 +19,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj index 3e4a3ac8e2ba..4635e3883ab3 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj @@ -124,6 +124,7 @@ + PreserveNewest diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index a450d1eecc40..768b9cd0b7f4 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -82,6 +82,7 @@ + Always @@ -95,8 +96,9 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config b/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config index 9aeeef0ef5fe..71414dc901ac 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config @@ -11,15 +11,15 @@ - - - + + + - - + + \ No newline at end of file diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index 3138f2f5b409..41f8c29d07ae 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -51,8 +51,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -183,6 +183,7 @@ + diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config index 5497df631ea9..6bb50d279ba9 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config @@ -26,4 +26,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index 6d8080e7aebd..41b905974a97 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -189,6 +189,7 @@ + Designer diff --git a/src/ResourceManager/Insights/Commands.Insights/packages.config b/src/ResourceManager/Insights/Commands.Insights/packages.config index 74a28153c5eb..042cf78bd74b 100644 --- a/src/ResourceManager/Insights/Commands.Insights/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights/packages.config @@ -9,9 +9,9 @@ - - - + + + @@ -20,4 +20,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj index fc6bdee9c2a7..a90e98a7629d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj @@ -57,8 +57,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False @@ -72,7 +72,7 @@ ..\..\..\packages\Microsoft.Azure.KeyVault.1.0.0\lib\net45\Microsoft.Azure.KeyVault.dll - ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll + ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll False diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 301fb5440d58..65cc16220757 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -128,7 +128,7 @@ False - ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll + ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll False diff --git a/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj b/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj index 42c388171390..97824e1a4fbe 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj +++ b/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj @@ -50,8 +50,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj b/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj index 726066148043..d308cd89ae1f 100644 --- a/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj +++ b/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj @@ -68,6 +68,10 @@ False ..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll diff --git a/src/ResourceManager/Network/Commands.Network/packages.config b/src/ResourceManager/Network/Commands.Network/packages.config index d9b3a61ebf51..e90727ae2c78 100644 --- a/src/ResourceManager/Network/Commands.Network/packages.config +++ b/src/ResourceManager/Network/Commands.Network/packages.config @@ -7,6 +7,7 @@ + @@ -23,4 +24,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj index 1ec8476dc57e..b24c7d69ffd6 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj @@ -48,8 +48,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj index 653a2ae43b84..e2c843ed3658 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj @@ -50,8 +50,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj index c684b11a70ef..fe1441657081 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj @@ -51,8 +51,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -70,7 +70,7 @@ ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll - + ..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll @@ -242,6 +242,7 @@ + Always diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config index 1167d9f79303..5d8005f0b0fa 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config +++ b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config @@ -30,4 +30,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj index ed756783defc..15be44670fc2 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj @@ -35,8 +35,8 @@ - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Management.SiteRecovery.0.1.1-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config index 708a2e893f7c..a8552a4e8425 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config @@ -10,8 +10,8 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj index 91e7fa009f2b..7f079315abbd 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj +++ b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj @@ -47,6 +47,10 @@ ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True @@ -54,10 +58,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config index 2617e1c0d13a..0fdf81fbb685 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config @@ -5,8 +5,8 @@ - + @@ -31,4 +31,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index 4712a1dc940f..6354d244e0f8 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -242,18 +242,22 @@ False ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.1.3-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + ..\..\..\packages\Microsoft.Azure.Management.Sql.0.37.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll False diff --git a/src/ResourceManager/Sql/Commands.Sql/packages.config b/src/ResourceManager/Sql/Commands.Sql/packages.config index f527caa13bc6..19e2a9ef1301 100644 --- a/src/ResourceManager/Sql/Commands.Sql/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql/packages.config @@ -4,6 +4,7 @@ + @@ -23,4 +24,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj b/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj index c91014efcd0e..158f0c1f4c4c 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj +++ b/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj @@ -39,8 +39,9 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config b/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config index bc9c0ecd8754..5b24dce45356 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config +++ b/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config @@ -20,4 +20,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config index 815d9d2d9121..c9df8289e4c5 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config +++ b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config @@ -10,7 +10,7 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index 044c8493fac9..bebfe07a6c90 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -48,8 +48,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config index c058b8c9da60..3de3f7ab6aad 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config @@ -30,4 +30,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index 7e4a221b8c54..6c0e1ca7313b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -61,6 +61,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.1.6.0\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config index a59a830a3a99..198350208389 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -4,6 +4,7 @@ + @@ -20,4 +21,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager2.Test.csproj b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager2.Test.csproj index 6fdfd29a298d..69a231d37a77 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager2.Test.csproj +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager2.Test.csproj @@ -45,8 +45,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True False diff --git a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj index a1507f1651eb..f3efac1d2a57 100644 --- a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj +++ b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj @@ -47,8 +47,8 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -129,6 +129,7 @@ + Designer diff --git a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj index e2e254a727da..8bf56cd89953 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj @@ -57,6 +57,10 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/ServiceManagement/Storage/Commands.Storage/packages.config b/src/ServiceManagement/Storage/Commands.Storage/packages.config index 594410e77792..12121d290ef4 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/packages.config +++ b/src/ServiceManagement/Storage/Commands.Storage/packages.config @@ -4,6 +4,7 @@ + @@ -20,4 +21,4 @@ - + \ No newline at end of file From bfb0a64306634022432ca89d0c09c85211e0ae09 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 02:46:44 -0700 Subject: [PATCH 04/10] [Finish #102950504]: Added unit and scenario tests; updated test infrastructure; added user friendly errors --- .../AzureRMProfileTests.cs | 178 ++++---- ...ommands.ResourceManager.Common.Test.csproj | 9 +- .../MockSubscriptionClientFactory.cs | 120 ++++++ .../packages.config | 2 +- .../RMProfileClient.cs | 32 +- ...mmands.ResourceManager.Profile.Test.csproj | 13 + .../ProfileController.cs | 135 ++++++ .../AllParameterSetsSucceed.json | 392 ++++++++++++++++++ .../SubscriptionCmdletTests.cs | 41 ++ .../SubscriptionCmdletTests.ps1 | 35 ++ .../packages.config | 1 + .../Commands.ResourceManager.Profile.csproj | 2 + .../GetAzureRMSubscription.cs | 78 ++-- .../Profile/SaveAzureRMProfile.cs | 18 +- .../Profile/SelectAzureRMProfile.cs | 7 - .../Properties/Resources.Designer.cs | 45 ++ .../Properties/Resources.resx | 15 + .../Mocks/MockAccessToken.cs | 4 +- .../Mocks/MockTokenAuthenticationFactory.cs | 16 +- 19 files changed, 987 insertions(+), 156 deletions(-) create mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs create mode 100644 src/Common/Commands.ResourceManager.Profile.Test/ProfileController.cs create mode 100644 src/Common/Commands.ResourceManager.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json create mode 100644 src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.cs create mode 100644 src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.ps1 diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs index 3ce786c634da..0506f5d4b017 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs @@ -33,90 +33,11 @@ using System.Threading.Tasks; using Microsoft.Azure.Subscriptions; using Microsoft.Azure.Subscriptions.Models; +using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.Azure.Commands.ResourceManager.Common.Test { - public class MockSubscriptionClientFactory - { - private IDictionary> _map; - private string _currentTenant; - public MockSubscriptionClientFactory(IDictionary> tenantSubscriptionMap) - { - _map = tenantSubscriptionMap; - } - - public SubscriptionClient GetSubscriptionClient(string tenant) - { - var tenantMock = new Mock(); - tenantMock.Setup(t => t.ListAsync(It.IsAny())) - .Returns( - (CancellationToken token) => - Task.FromResult(new TenantListResult() - { - StatusCode = HttpStatusCode.OK, - RequestId = Guid.NewGuid().ToString(), - TenantIds = _map.Keys.Select((k) => new TenantIdDescription() { Id = k, TenantId = k }).ToList() - })); - var subscriptionMock = new Mock(); - subscriptionMock.Setup( - s => s.GetAsync(It.IsAny(), It.IsAny())).Returns( - (string subId, CancellationToken token) => - { - GetSubscriptionResult result = null; - if (_map.ContainsKey(_currentTenant) && _map[_currentTenant].Contains(subId)) - { - result = new GetSubscriptionResult - { - RequestId = Guid.NewGuid().ToString(), - StatusCode = HttpStatusCode.OK, - Subscription = - new Subscription - { - DisplayName = "Returned SUbscription", - Id = subId, - State = "Active", - SubscriptionId = subId - } - }; - } - - return Task.FromResult(result); - }); - subscriptionMock.Setup( - (s) => s.ListAsync(It.IsAny())).Returns( - (CancellationToken token) => - { - SubscriptionListResult result = null; - if (_map.ContainsKey(_currentTenant)) - { - result = new SubscriptionListResult - { - StatusCode = HttpStatusCode.OK, - RequestId = Guid.NewGuid().ToString(), - Subscriptions = - new List( - _map[_currentTenant].Select( - sub => - new Subscription - { - DisplayName = "Contoso Subscription", - Id = sub, - State = "Active", - SubscriptionId = sub - })) - }; - } - - return Task.FromResult(result); - }); - var client = new Mock(); - client.SetupGet(c => c.Subscriptions).Returns(subscriptionMock.Object); - client.SetupGet(c => c.Tenants).Returns(tenantMock.Object); - return client.Object; - } - } - public class AzureRMProfileTests { private const string DefaultAccount = "admin@contoso.com"; @@ -124,40 +45,105 @@ public class AzureRMProfileTests private static string DefaultSubscriptionName = "Contoso Subscription"; private static string DefaultDomain = "contoso.com"; private static Guid DefaultTenant = Guid.NewGuid(); - [Fact] - public void TestListSubscriptionWithoutTenantsThrows() + + private static RMProfileClient SetupTestEnvironment(List tenants, params List[] subscriptionLists) { AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(DefaultAccount, - Guid.NewGuid().ToString()); - var clientFactory = new MockSubscriptionClientFactory(new Dictionary>()); - AzureSession.ClientFactory = new MockClientFactory( new List + Guid.NewGuid().ToString(), DefaultTenant.ToString()); + var subscriptionList = new Queue>(subscriptionLists); + var clientFactory = new MockSubscriptionClientFactory(tenants, subscriptionList); + var mock = new MockClientFactory(new List { - clientFactory.GetSubscriptionClient(DefaultTenant.ToString()) + clientFactory.GetSubscriptionClient() }, true); - var context = new AzureContext(new AzureSubscription() {Account=DefaultAccount, - Environment =EnvironmentName.AzureCloud, Id = DefaultSubscription, Name=DefaultSubscriptionName }, - new AzureAccount() {Id = DefaultAccount, Type = AzureAccount.AccountType.User}, - AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], - new AzureTenant() {Domain = DefaultDomain, Id = DefaultTenant}); + mock.MoqClients = true; + AzureSession.ClientFactory = mock; + var context = new AzureContext(new AzureSubscription() + { + Account = DefaultAccount, + Environment = EnvironmentName.AzureCloud, + Id = DefaultSubscription, + Name = DefaultSubscriptionName + }, + new AzureAccount() { Id = DefaultAccount, Type = AzureAccount.AccountType.User }, + AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], + new AzureTenant() { Domain = DefaultDomain, Id = DefaultTenant }); var profile = new AzureRMProfile(); - profile.DefaultContext = context; - RMProfileClient client = new RMProfileClient( profile); + profile.Context = context; + return new RMProfileClient(profile); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void MultipleTenantsAndSubscriptionsSucceed() + { + var tenants = new List {Guid.NewGuid().ToString(), DefaultTenant.ToString()}; + var firstList = new List { DefaultSubscription.ToString(), Guid.NewGuid().ToString() }; + var secondList = new List { Guid.NewGuid().ToString()}; + var client = SetupTestEnvironment(tenants, firstList, secondList); + var subResults = new List(client.ListSubscriptions()); + Assert.Equal(3, subResults.Count); + var tenantResults = client.ListTenants(); + Assert.Equal(2, tenantResults.Count()); + tenantResults = client.ListTenants(DefaultTenant.ToString()); + Assert.Equal(1, tenantResults.Count()); + AzureSubscription subValue; + Assert.True(client.TryGetSubscription(DefaultTenant.ToString(), DefaultSubscription.ToString(), out subValue)); + Assert.Equal(DefaultSubscription.ToString(), subValue.Id.ToString()); + } + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void SingleTenantAndSubscriptionSucceeds() + { + var tenants = new List {DefaultTenant.ToString()}; + var subscriptions = new List {DefaultSubscription.ToString()}; + var client = SetupTestEnvironment(tenants, subscriptions); + var subResults = new List(client.ListSubscriptions()); + Assert.Equal(1, subResults.Count); + var tenantResults = client.ListTenants(); + Assert.Equal(1, tenantResults.Count()); + tenantResults = client.ListTenants(DefaultTenant.ToString()); + Assert.Equal(1, tenantResults.Count()); + AzureSubscription subValue; + Assert.True(client.TryGetSubscription(DefaultTenant.ToString(), DefaultSubscription.ToString(), out subValue)); + Assert.Equal(DefaultSubscription.ToString(), subValue.Id.ToString()); } [Fact] - public void TestListSubscriptionWithoutSubscriptionsThrows() + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void SubscriptionNotFoundDoesNotThrow() { + var tenants = new List { DefaultTenant.ToString() }; + var subscriptions = new List { Guid.NewGuid().ToString() }; + var client = SetupTestEnvironment(tenants, subscriptions); + var subResults = new List(client.ListSubscriptions()); + Assert.Equal(1, subResults.Count); + AzureSubscription subValue; + Assert.False(client.TryGetSubscription(DefaultTenant.ToString(), DefaultSubscription.ToString(), out subValue)); } [Fact] - public void TestListSubscriptionWithSingleTenantSingleSubscription() + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void NoTenantsDoesNotThrow() { + var tenants = new List { }; + var subscriptions = new List { Guid.NewGuid().ToString() }; + var client = SetupTestEnvironment(tenants, subscriptions); + Assert.Equal(0, client.ListSubscriptions().Count()); + Assert.Equal(0, client.ListTenants().Count()); } [Fact] - public void TestListSubscriptionWithMultipleTenantsAndSubscriptions() + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void NoSubscriptionsInListThrows() { + var tenants = new List { DefaultTenant.ToString() }; + var subscriptions = new List () ; + var client = SetupTestEnvironment(tenants, subscriptions); + Assert.Equal(0, client.ListSubscriptions().Count()); + AzureSubscription subValue; + Assert.False(client.TryGetSubscription(DefaultTenant.ToString(), DefaultSubscription.ToString(), out subValue)); } } } diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj index 040b209adb2d..bbeebd1196da 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -100,12 +100,12 @@ - - ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll + + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll True - - ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll + + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll True @@ -138,6 +138,7 @@ + diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs new file mode 100644 index 000000000000..6ae2407c865f --- /dev/null +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs @@ -0,0 +1,120 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Subscriptions; +using Microsoft.Azure.Subscriptions.Models; +using Moq; + +namespace Microsoft.Azure.Commands.ResourceManager.Common.Test +{ + public class MockSubscriptionClientFactory + { + private IList _tenants; + private Queue> _subscriptions; + private HashSet _subscriptionSet; + public MockSubscriptionClientFactory(List tenants, Queue> subscriptions) + { + _tenants = tenants; + _subscriptions = new Queue>(); + _subscriptionSet = new HashSet(); + foreach (var subscriptionList in subscriptions) + { + _subscriptions.Enqueue(subscriptionList); + foreach (var subscription in subscriptionList) + { + _subscriptionSet.Add(subscription); + } + } + } + + public SubscriptionClient GetSubscriptionClient() + { + var tenantMock = new Mock(); + tenantMock.Setup(t => t.ListAsync(It.IsAny())) + .Returns( + (CancellationToken token) => + Task.FromResult(new TenantListResult() + { + StatusCode = HttpStatusCode.OK, + RequestId = Guid.NewGuid().ToString(), + TenantIds = _tenants.Select((k) => new TenantIdDescription() { Id = k, TenantId = k }).ToList() + })); + var subscriptionMock = new Mock(); + subscriptionMock.Setup( + s => s.GetAsync(It.IsAny(), It.IsAny())).Returns( + (string subId, CancellationToken token) => + { + GetSubscriptionResult result = new GetSubscriptionResult + { + RequestId = Guid.NewGuid().ToString(), + StatusCode = HttpStatusCode.NotFound + }; + if (_subscriptionSet.Contains(subId)) + { + result.StatusCode = HttpStatusCode.OK; + result.Subscription = + new Subscription + { + DisplayName = "Returned Subscription", + Id = subId, + State = "Active", + SubscriptionId = subId + }; + + } + + return Task.FromResult(result); + }); + subscriptionMock.Setup( + (s) => s.ListAsync(It.IsAny())).Returns( + (CancellationToken token) => + { + SubscriptionListResult result = null; + if (_subscriptions.Count > 0) + { + var subscriptionList = _subscriptions.Dequeue(); + result = new SubscriptionListResult + { + StatusCode = HttpStatusCode.OK, + RequestId = Guid.NewGuid().ToString(), + Subscriptions = + new List( + subscriptionList.Select( + sub => + new Subscription + { + DisplayName = "Contoso Subscription", + Id = sub, + State = "Active", + SubscriptionId = sub + })) + }; + } + + return Task.FromResult(result); + }); + var client = new Mock(); + client.SetupGet(c => c.Subscriptions).Returns(subscriptionMock.Object); + client.SetupGet(c => c.Tenants).Returns(tenantMock.Object); + return client.Object; + } + } + +} diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config index 9167521c94fe..9175e2b21d7e 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config @@ -9,7 +9,7 @@ - + diff --git a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs index 26db571a4076..117941b8c88b 100644 --- a/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs +++ b/src/Common/Commands.ResourceManager.Common/RMProfileClient.cs @@ -142,8 +142,14 @@ public List ListTenants(string tenant) public bool TryGetSubscription(string tenantId, string subscriptionId, out AzureSubscription subscription) { + if (string.IsNullOrWhiteSpace(tenantId)) + { + throw new ArgumentNullException("Please provide a valid tenant Id"); + } + + AzureTenant tenant; return TryGetTenantSubscription(_profile.Context.Account, _profile.Context.Environment, - tenantId, subscriptionId, null, ShowDialog.Never, out subscription); + tenantId, subscriptionId, null, ShowDialog.Never, out subscription, out tenant); } private bool TryGetTenantSubscription( @@ -244,9 +250,9 @@ private List ListAccountTenants(AzureAccount account, AzureEnvironm /// List all tenants for the account in the profile context /// /// The list of tenants for the default account. - public string[] ListTenants() + public IEnumerable ListTenants() { - return ListAccountTenants(_profile.Context.Account, _profile.Context.Environment, null); + return ListAccountTenants(_profile.Context.Account, _profile.Context.Environment, null, ShowDialog.Never); } private IEnumerable ListSubscriptionsForTenant(AzureAccount account, AzureEnvironment environment, @@ -269,7 +275,7 @@ private IEnumerable ListSubscriptionsForTenant(AzureAccount a subscriptions.Subscriptions.Select( (s) => s.ToAzureSubscription(new AzureContext(_profile.Context.Subscription, account, - environment, new AzureTenant {Id = new Guid(tenantId)}))); + environment, CreateTenantFromString(tenantId)))); } return null; @@ -289,7 +295,7 @@ public IEnumerable ListSubscriptions() { try { - subscriptions.AddRange(ListSubscriptions(tenant)); + subscriptions.AddRange(ListSubscriptions(tenant.Id.ToString())); } catch (AadAuthenticationException) { @@ -310,5 +316,21 @@ private void WriteWarningMessage(string message) WarningLog(message); } } + + private static AzureTenant CreateTenantFromString(string tenantOrDomain) + { + AzureTenant result = new AzureTenant(); + Guid id; + if (Guid.TryParse(tenantOrDomain, out id)) + { + result.Id = id; + } + else + { + result.Domain = tenantOrDomain; + } + + return result; + } } } diff --git a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj index 61bb8955b917..46c9eccb1e2a 100644 --- a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj +++ b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj @@ -72,6 +72,10 @@ False ..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + ..\..\packages\Microsoft.Azure.Test.Framework.1.0.5715.36130-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + True + ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5715.36130-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True @@ -179,6 +183,8 @@ + + @@ -186,8 +192,14 @@ + + PreserveNewest + + + PreserveNewest + @@ -203,6 +215,7 @@ Commands.ScenarioTests.ResourceManager.Common + diff --git a/src/Common/Commands.ResourceManager.Profile.Test/ProfileController.cs b/src/Common/Commands.ResourceManager.Profile.Test/ProfileController.cs new file mode 100644 index 000000000000..742428a6a5f6 --- /dev/null +++ b/src/Common/Commands.ResourceManager.Profile.Test/ProfileController.cs @@ -0,0 +1,135 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net.Http; +using System.Net.Http.Headers; +using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Subscriptions; +using Microsoft.Azure.Test; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Microsoft.WindowsAzure.Commands.ScenarioTest; + +namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests +{ + public sealed class ProfileController + { + private CSMTestEnvironmentFactory csmTestFactory; + private EnvironmentSetupHelper helper; + private const string TenantIdKey = "TenantId"; + private const string DomainKey = "Domain"; + private const string SubscriptionIdKey = "SubscriptionId"; + + + public SubscriptionClient SubscriptionClient { get; private set; } + + public string UserDomain { get; private set; } + + public static ProfileController NewInstance + { + get { return new ProfileController(); } + } + + public ProfileController() + { + helper = new EnvironmentSetupHelper(); + } + + public void RunPsTest(string tenant, params string[] scripts) + { + var callingClassType = TestUtilities.GetCallingClass(2); + var mockName = TestUtilities.GetCurrentMethodName(2); + + RunPsTestWorkflow( + () => scripts, + // no custom initializer + null, + // no custom cleanup + null, + callingClassType, + mockName, tenant); + } + + public void RunPsTestWorkflow( + Func scriptBuilder, + Action initialize, + Action cleanup, + string callingClassType, + string mockName, string tenant) + { + using (UndoContext context = UndoContext.Current) + { + context.Start(callingClassType, mockName); + + this.csmTestFactory = new CSMTestEnvironmentFactory(); + + if (initialize != null) + { + initialize(this.csmTestFactory); + } + + SetupManagementClients(); + + helper.SetupEnvironment(AzureModule.AzureResourceManager); + var oldFactory = AzureSession.AuthenticationFactory as MockTokenAuthenticationFactory; + AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(oldFactory.Token.UserId, oldFactory.Token.AccessToken, tenant); + + var callingClassName = callingClassType + .Split(new[] {"."}, StringSplitOptions.RemoveEmptyEntries) + .Last(); + helper.SetupModulesFromCommon( + AzureModule.AzureResourceManager, + callingClassName + ".ps1"); + + try + { + if (scriptBuilder != null) + { + var psScripts = scriptBuilder(); + + if (psScripts != null) + { + helper.RunPowerShellTest(psScripts); + } + } + } + finally + { + if (cleanup != null) + { + cleanup(); + } + } + } + } + + private void SetupManagementClients() + { + SubscriptionClient = GetSubscriptionClient(); + + helper.SetupManagementClients(SubscriptionClient); + } + + + private SubscriptionClient GetSubscriptionClient() + { + return TestBase.GetServiceClient(this.csmTestFactory); + } + } +} diff --git a/src/Common/Commands.ResourceManager.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json b/src/Common/Commands.ResourceManager.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json new file mode 100644 index 000000000000..6e40e34f6a17 --- /dev/null +++ b/src/Common/Commands.ResourceManager.Profile.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json @@ -0,0 +1,392 @@ +{ + "Entries": [ + { + "RequestUri": "/tenants?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3RlbmFudHM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "326" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14994" + ], + "x-ms-request-id": [ + "dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + ], + "x-ms-correlation-request-id": [ + "dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092920Z:dfbcb8b4-79bd-4b49-98cd-2f48f03ab959" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:19 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "3016" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14993" + ], + "x-ms-request-id": [ + "3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + ], + "x-ms-correlation-request-id": [ + "3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092921Z:3bf4c9ed-5a95-47ad-b574-3d3bab512da2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:20 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "3016" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14992" + ], + "x-ms-request-id": [ + "f59628b0-b505-47bd-8662-b362f1585fcc" + ], + "x-ms-correlation-request-id": [ + "f59628b0-b505-47bd-8662-b362f1585fcc" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092922Z:f59628b0-b505-47bd-8662-b362f1585fcc" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:21 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "3016" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14991" + ], + "x-ms-request-id": [ + "c6440f00-0988-475d-94da-24d45117ed6f" + ], + "x-ms-correlation-request-id": [ + "c6440f00-0988-475d-94da-24d45117ed6f" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092923Z:c6440f00-0988-475d-94da-24d45117ed6f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:23 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "3016" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14990" + ], + "x-ms-request-id": [ + "821067d5-0dda-4c06-896c-d05adda670be" + ], + "x-ms-correlation-request-id": [ + "821067d5-0dda-4c06-896c-d05adda670be" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092941Z:821067d5-0dda-4c06-896c-d05adda670be" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:40 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "3016" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "14989" + ], + "x-ms-request-id": [ + "41377497-013c-4147-a578-899a8c738e7c" + ], + "x-ms-correlation-request-id": [ + "41377497-013c-4147-a578-899a8c738e7c" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092941Z:41377497-013c-4147-a578-899a8c738e7c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:41 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDA5NzdjZGItMTYzZi00MzVmLTljMzItMzllYzhhZTYxZjRkP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "256" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-request-id": [ + "0b257a33-7f01-4a98-8d98-1bc654be1159" + ], + "x-ms-correlation-request-id": [ + "0b257a33-7f01-4a98-8d98-1bc654be1159" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092923Z:0b257a33-7f01-4a98-8d98-1bc654be1159" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:23 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDA5NzdjZGItMTYzZi00MzVmLTljMzItMzllYzhhZTYxZjRkP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "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}", + "ResponseHeaders": { + "Content-Length": [ + "256" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-request-id": [ + "ad76a94a-cb03-494f-853e-7c0a68a7766a" + ], + "x-ms-correlation-request-id": [ + "ad76a94a-cb03-494f-853e-7c0a68a7766a" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150917T092936Z:ad76a94a-cb03-494f-853e-7c0a68a7766a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 17 Sep 2015 09:29:36 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.cs b/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.cs new file mode 100644 index 000000000000..19c5917699ad --- /dev/null +++ b/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.cs @@ -0,0 +1,41 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Utilities.Common; +using Microsoft.Azure.Commands.Profile; +using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using System.Linq; +using Xunit; +using System; +using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; +using Hyak.Common; +using System.Management.Automation; +using Microsoft.Azure.Commands.Resources.Test.ScenarioTests; + +namespace Microsoft.Azure.Commands.Profile.Test +{ + public class SubscriptionCmdletTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void AllParameterSetsSucceed() + { + ProfileController.NewInstance.RunPsTest("72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-GetSubscriptionsEndToEnd"); + } + } +} diff --git a/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.ps1 b/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.ps1 new file mode 100644 index 000000000000..6b439945edb5 --- /dev/null +++ b/src/Common/Commands.ResourceManager.Profile.Test/SubscriptionCmdletTests.ps1 @@ -0,0 +1,35 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests each of the major parts of retrieving subscriptions in ARM mode +#> +function Test-GetSubscriptionsEndToEnd +{ + $allSubscriptions = Get-AzureRMSubscription -All + $firstSubscription = $allSubscriptions[0] + $id = $firstSubscription.Id + $tenant = $firstSubscription.GetProperty([Microsoft.Azure.Common.Authentication.Models.AzureSubscription+Property]::Tenants) + $subscription = Get-AzureRMSubscription -SubscriptionId $id -Tenant $tenant + Assert-True { $subscription -ne $null } + Assert-AreEqual $id $subscription.Id + $subscription = Get-AzureRMSubscription -SubscriptionId $id + Assert-True { $subscription -ne $null } + Assert-AreEqual $id $subscription.Id + $mostSubscriptions = Get-AzureRMSubscription + Assert-True {$mostSubscriptions.Count -gt 0} + $tenantSubscriptions = Get-AzureRMSubscription -Tenant $tenant + Assert-True {$tenantSubscriptions.Count -gt 0} +} \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Profile.Test/packages.config b/src/Common/Commands.ResourceManager.Profile.Test/packages.config index 5f4f008064ef..a3082339b9ef 100644 --- a/src/Common/Commands.ResourceManager.Profile.Test/packages.config +++ b/src/Common/Commands.ResourceManager.Profile.Test/packages.config @@ -7,6 +7,7 @@ + diff --git a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj index 917f0da17a7e..4ebf0fd34546 100644 --- a/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj +++ b/src/Common/Commands.ResourceManager.Profile/Commands.ResourceManager.Profile.csproj @@ -136,6 +136,8 @@ + + True diff --git a/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs index 6dc7771b3233..8a42352a407e 100644 --- a/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs +++ b/src/Common/Commands.ResourceManager.Profile/GetAzureRMSubscription.cs @@ -11,17 +11,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Azure.Commands.ResourceManager.Common; using System.Management.Automation; -using System.Net; +using Microsoft.Azure.Commands.Profile.Properties; using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Common.Authentication.Models; -using Hyak.Common; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Subscriptions; namespace Microsoft.Azure.Commands.Profile { @@ -56,49 +50,71 @@ protected override void ProcessRecord() { try { - WriteObject(_client.ListSubscriptions()); + WriteObject(_client.ListSubscriptions(), enumerateCollection: true); } - catch (AadAuthenticationException) + catch (AadAuthenticationException exception) { - WriteErrorWithTimestamp(string.Format("Could not authenticate your user account {0} with the common tenant. " + - "Please login again using Login-AzureRMAccount.", DefaultContext.Account)); - throw; + var account = DefaultContext.Account == null || DefaultContext.Account.Id == null + ? Resources.NoAccountProvided + : DefaultContext.Account.Id; + throw new PSInvalidOperationException(string.Format(Resources.CommonTenantAuthFailed, account), exception); } } else if (!string.IsNullOrWhiteSpace(this.SubscriptionId)) { + var tenant = EnsureValidTenant(); AzureSubscription result; - if (!this._client.TryGetSubscription(this.Tenant, this.SubscriptionId, out result)) + try { - WriteSubscriptionNotFoundError(this.Tenant, this.SubscriptionId); + if (!this._client.TryGetSubscription(tenant, this.SubscriptionId, out result)) + { + ThrowSubscriptionNotFoundError(this.Tenant, this.SubscriptionId); + } + + WriteObject(result); + } + catch (AadAuthenticationException exception) + { + ThrowTenantAuthenticationError(tenant, exception); + throw; } - WriteObject( result); } else { - var tenant = this.Tenant; - if (string.IsNullOrWhiteSpace(tenant)) + var tenant = EnsureValidTenant(); + try { - if (DefaultContext.Tenant != null && DefaultContext.Tenant.Id != null) - { - tenant = DefaultContext.Tenant.Id.ToString(); - } - else - { - throw new PSArgumentException( - "No tenant Id was provided. Please log in using Login-AzureRMAcount, or provide a tenant in the 'Tenant' parameter."); - } + WriteObject(_client.ListSubscriptions(tenant), enumerateCollection: true); + } + catch (AadAuthenticationException exception) + { + ThrowTenantAuthenticationError(tenant, exception); + throw; } - - WriteObject(_client.ListSubscriptions(tenant)); } } - private void WriteSubscriptionNotFoundError(string subscription, string tenant) + private void ThrowSubscriptionNotFoundError(string tenant, string subscription) + { + throw new PSArgumentException(string.Format(Resources.SubscriptionNotFoundError, subscription, tenant)); + } + + private void ThrowTenantAuthenticationError(string tenant, AadAuthenticationException exception) { - throw new PSArgumentException(string.Format("Subscription {0} was not found in tenant {1}. " + - "Please verify that the subscription exists in this tenant.", subscription, tenant)); + throw new PSArgumentException(string.Format(Resources.TenantAuthFailed, tenant), exception); + } + + private string EnsureValidTenant() + { + var tenant = this.Tenant; + if (string.IsNullOrWhiteSpace(tenant) && (DefaultContext.Tenant == null || + DefaultContext.Tenant.Id == null)) + { + throw new PSArgumentException(Resources.NoValidTenant); + } + + return tenant ?? DefaultContext.Tenant.Id.ToString(); } } } diff --git a/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureRMProfile.cs b/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureRMProfile.cs index e21a64b0e54c..fef739b115a8 100644 --- a/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureRMProfile.cs +++ b/src/Common/Commands.ResourceManager.Profile/Profile/SaveAzureRMProfile.cs @@ -17,7 +17,6 @@ using Microsoft.Azure.Common.Authentication.Models; using System; using System.Management.Automation; -using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.Profile { @@ -31,24 +30,23 @@ public class SaveAzureRMProfileCommand : AzureRMCmdlet public AzureRMProfile Profile { get; set; } [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true)] - [ValidateNotNullOrEmpty] public string Path { get; set; } protected override void ProcessRecord() { - AzureRMProfile profileToSave = Profile; - if (profileToSave == null) + if (Profile != null) { - profileToSave = AzureRMCmdlet.DefaultProfile; + Profile.Save(Path); } - - if (profileToSave == null) + else { - throw new ArgumentException(Resources.AzureProfileMustNotBeNull); + if (AzureRMCmdlet.DefaultProfile == null) + { + throw new ArgumentException(Resources.AzureProfileMustNotBeNull); + } + AzureRMCmdlet.DefaultProfile.Save(Path); } - profileToSave.TokenCache = TokenCache.DefaultShared.Serialize(); - profileToSave.Save(Path); WriteVerbose(string.Format("Profile saved to: {0}.", Path)); } } diff --git a/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureRMProfile.cs b/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureRMProfile.cs index bf037f0a15dd..7031f1f0f7e6 100644 --- a/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureRMProfile.cs +++ b/src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureRMProfile.cs @@ -17,8 +17,6 @@ using Microsoft.Azure.Common.Authentication.Models; using System; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication; -using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.Profile { @@ -53,11 +51,6 @@ protected override void ProcessRecord() throw new ArgumentException(Resources.AzureProfileMustNotBeNull); } - if (DefaultProfile.TokenCache != null && DefaultProfile.TokenCache.Length > 0) - { - TokenCache.DefaultShared.Deserialize(DefaultProfile.TokenCache); - } - WriteObject(AzureRMCmdlet.DefaultProfile); } } diff --git a/src/Common/Commands.ResourceManager.Profile/Properties/Resources.Designer.cs b/src/Common/Commands.ResourceManager.Profile/Properties/Resources.Designer.cs index dd79754a58a3..074f68f865e5 100644 --- a/src/Common/Commands.ResourceManager.Profile/Properties/Resources.Designer.cs +++ b/src/Common/Commands.ResourceManager.Profile/Properties/Resources.Designer.cs @@ -68,5 +68,50 @@ internal static string AzureProfileMustNotBeNull { return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); } } + + /// + /// Looks up a localized string similar to Could not authenticate your user account {0} with the common tenant. Please login again using Login-AzureRMAccount.. + /// + internal static string CommonTenantAuthFailed { + get { + return ResourceManager.GetString("CommonTenantAuthFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (no account provided). + /// + internal static string NoAccountProvided { + get { + return ResourceManager.GetString("NoAccountProvided", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a valid tenant Id on the command line or execute Login-AzureRMAccount.. + /// + internal static string NoValidTenant { + get { + return ResourceManager.GetString("NoValidTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription {0} was not found in tenant {1}. Please verify that the subscription exists in this tenant.. + /// + internal static string SubscriptionNotFoundError { + get { + return ResourceManager.GetString("SubscriptionNotFoundError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not authenticate with tenant {0}. Please ensure that your account has access to this tenant and log in with Login-AzureRMAccount. + /// + internal static string TenantAuthFailed { + get { + return ResourceManager.GetString("TenantAuthFailed", resourceCulture); + } + } } } diff --git a/src/Common/Commands.ResourceManager.Profile/Properties/Resources.resx b/src/Common/Commands.ResourceManager.Profile/Properties/Resources.resx index c868836664ff..59a19b8d2483 100644 --- a/src/Common/Commands.ResourceManager.Profile/Properties/Resources.resx +++ b/src/Common/Commands.ResourceManager.Profile/Properties/Resources.resx @@ -120,4 +120,19 @@ Selected profile must not be null. + + Could not authenticate your user account {0} with the common tenant. Please login again using Login-AzureRMAccount. + + + (no account provided) + + + Please provide a valid tenant Id on the command line or execute Login-AzureRMAccount. + + + Subscription {0} was not found in tenant {1}. Please verify that the subscription exists in this tenant. + + + Could not authenticate with tenant {0}. Please ensure that your account has access to this tenant and log in with Login-AzureRMAccount + \ No newline at end of file diff --git a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs index 4acccb09d00f..47bf4b27e527 100644 --- a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs +++ b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs @@ -19,6 +19,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { public class MockAccessToken : IAccessToken { + private string _tenantId = String.Empty; public void AuthorizeRequest(Action authTokenSetter) { authTokenSetter("Bearer", AccessToken); @@ -30,7 +31,8 @@ public void AuthorizeRequest(Action authTokenSetter) public string TenantId { - get { return string.Empty; } + get { return _tenantId; } + set { _tenantId = value; } } } } diff --git a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs index da443729d35b..db1e257ff57f 100644 --- a/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs +++ b/src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs @@ -50,12 +50,26 @@ public MockTokenAuthenticationFactory(string userId, string accessToken) { UserId = userId, LoginType = LoginType.OrgId, - AccessToken = accessToken + AccessToken = accessToken, }; TokenProvider = ((account, environment, tenant) => Token); } + public MockTokenAuthenticationFactory(string userId, string accessToken, string tenantId) + { + Token = new MockAccessToken + { + UserId = userId, + LoginType = LoginType.OrgId, + AccessToken = accessToken, + TenantId = tenantId + }; + + TokenProvider = ((account, environment, tenant) => Token); + } + + public IAccessToken Authenticate( AzureAccount account, AzureEnvironment environment, From 464b5aa22caa5749e73500aff37547b7357810bc Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 03:07:22 -0700 Subject: [PATCH 05/10] Fixing test project and adding new projects to test targets --- AzurePowershell.Test.targets | 2 ++ ...ommands.ResourceManager.Common.Test.csproj | 19 ------------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index 93506ce9c63c..fa66074d578c 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -67,6 +67,8 @@ + + diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj index bbeebd1196da..4a321e62ab88 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -154,25 +154,6 @@ - - - - - False - - - False - - - False - - - False - - - - - From ae65e64e3df2612862903873d8f68970a8135a91 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 03:11:02 -0700 Subject: [PATCH 06/10] removing unnecessary app.config files --- .../AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj | 1 - .../AzureBatch/Commands.Batch/Commands.Batch.csproj | 1 - .../Commands.HDInsight.Test/Commands.HDInsight.Test.csproj | 1 - .../HDInsight/Commands.HDInsight/Commands.HDInsight.csproj | 1 - .../Commands.Insights.Test/Commands.Insights.Test.csproj | 1 - .../Insights/Commands.Insights/Commands.Insights.csproj | 1 - .../Commands.Resources.Test/Commands.Resources.Test.csproj | 1 - .../Commands.Websites.Test/Commands.Websites.Test.csproj | 1 - 8 files changed, 8 deletions(-) diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj index 49f995100f15..fde04cfa7403 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj @@ -223,7 +223,6 @@ - Designer diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj index 42aebd2c6938..ccc67aab8f93 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj @@ -286,7 +286,6 @@ - Always Designer diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj index 4635e3883ab3..3e4a3ac8e2ba 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj @@ -124,7 +124,6 @@ - PreserveNewest diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index 768b9cd0b7f4..211c1209b06a 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -82,7 +82,6 @@ - Always diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index 41f8c29d07ae..fd680c6a1243 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -183,7 +183,6 @@ - diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index 41b905974a97..6d8080e7aebd 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -189,7 +189,6 @@ - Designer diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj index fe1441657081..cf2da5ac2723 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj @@ -242,7 +242,6 @@ - Always diff --git a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj index f3efac1d2a57..783d79316968 100644 --- a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj +++ b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj @@ -129,7 +129,6 @@ - Designer From 11f272917b402fd564e4028f460cf1dbd55ef8be Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 03:15:59 -0700 Subject: [PATCH 07/10] More fixes to test prohect file --- .../Commands.ResourceManager.Common.Test.csproj | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj index 4a321e62ab88..767aa2d3b621 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -122,20 +122,6 @@ True - - - - - - - - - - False - - - - From 255991c88b32621f9deb0a7cc977bf21b6380279 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 03:26:23 -0700 Subject: [PATCH 08/10] Minor fixes to test project --- .../Commands.ResourceManager.Common.Test.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj index 767aa2d3b621..365a27d4f49e 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj @@ -1,5 +1,5 @@  - + @@ -160,4 +160,4 @@ --> - \ No newline at end of file + From fcca13191b6bb22f1e244a2679aa522ddfbe962d Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 03:50:14 -0700 Subject: [PATCH 09/10] removing sparse test project --- AzurePowershell.Test.targets | 1 - ...ommands.ResourceManager.Common.Test.csproj | 163 ------------------ .../Properties/AssemblyInfo.cs | 36 ---- .../packages.config | 23 --- .../AzureRMProfileTests.cs | 14 -- ...mmands.ResourceManager.Profile.Test.csproj | 2 + .../MockSubscriptionClientFactory.cs | 0 src/ResourceManager.sln | 12 +- 8 files changed, 5 insertions(+), 246 deletions(-) delete mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj delete mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config rename src/Common/{Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test => Commands.ResourceManager.Profile.Test}/AzureRMProfileTests.cs (93%) rename src/Common/{Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test => Commands.ResourceManager.Profile.Test}/MockSubscriptionClientFactory.cs (100%) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index fa66074d578c..b6a29272efef 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -67,7 +67,6 @@ - diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj deleted file mode 100644 index 365a27d4f49e..000000000000 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test.csproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - Debug - AnyCPU - {26B01740-0C84-48D2-BF5E-7F0473421EB7} - Library - Properties - Microsoft.Azure.Commands.ResourceManager.Common.Test - Microsoft.Azure.Commands.ResourceManager.Common.Test - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll - True - - - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - True - - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - - - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - True - - - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - True - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - True - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.2.0\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.9.3\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - - - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll - True - - - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll - True - - - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - True - - - ..\..\..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll - True - - - ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll - True - - - - - - - ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll - True - - - ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - True - - - - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True - - - ..\..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll - True - - - ..\..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll - True - - - - - - - - - - {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} - Commands.ResourceManager.Common - - - {3436a126-edc9-4060-8952-9a1be34cdd95} - Commands.ScenarioTests.ResourceManager.Common - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index 303985df5ede..000000000000 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Commands.ResourceManager.Common.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Commands.ResourceManager.Common.Test")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("26b01740-0c84-48d2-bf5e-7f0473421eb7")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config b/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config deleted file mode 100644 index 9175e2b21d7e..000000000000 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/packages.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs b/src/Common/Commands.ResourceManager.Profile.Test/AzureRMProfileTests.cs similarity index 93% rename from src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs rename to src/Common/Commands.ResourceManager.Profile.Test/AzureRMProfileTests.cs index 0506f5d4b017..8ca2d32b944a 100644 --- a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/AzureRMProfileTests.cs +++ b/src/Common/Commands.ResourceManager.Profile.Test/AzureRMProfileTests.cs @@ -12,27 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Common.Authentication.Models; using System.Linq; using Xunit; using System; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Hyak.Common; -using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Moq; -using Microsoft.Rest; using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Subscriptions; -using Microsoft.Azure.Subscriptions.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.Azure.Commands.ResourceManager.Common.Test diff --git a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj index 46c9eccb1e2a..569b8415698a 100644 --- a/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj +++ b/src/Common/Commands.ResourceManager.Profile.Test/Commands.ResourceManager.Profile.Test.csproj @@ -182,7 +182,9 @@ + + diff --git a/src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs b/src/Common/Commands.ResourceManager.Profile.Test/MockSubscriptionClientFactory.cs similarity index 100% rename from src/Common/Commands.ResourceManager.Common.Test/Commands.ResourceManager.Common.Test/MockSubscriptionClientFactory.cs rename to src/Common/Commands.ResourceManager.Profile.Test/MockSubscriptionClientFactory.cs diff --git a/src/ResourceManager.sln b/src/ResourceManager.sln index 52e9ca283714..3ef450e2e4cb 100644 --- a/src/ResourceManager.sln +++ b/src/ResourceManager.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject @@ -121,8 +121,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "Common\C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "ServiceManagement\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManager.Common.Test", "Common\Commands.ResourceManager.Common.Test\Commands.ResourceManager.Common.Test\Commands.ResourceManager.Common.Test.csproj", "{26B01740-0C84-48D2-BF5E-7F0473421EB7}" -EndProjectGlobal +Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -348,10 +347,6 @@ EndProjectGlobal {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Debug|Any CPU.Build.0 = Debug|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.ActiveCfg = Release|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.Build.0 = Release|Any CPU - {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26B01740-0C84-48D2-BF5E-7F0473421EB7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -381,6 +376,5 @@ EndProjectGlobal {F220C306-29A3-4511-8518-A58A55C60D07} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {13E031E4-8A43-4B87-9D72-D70180C31C11} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {3436A126-EDC9-4060-8952-9A1BE34CDD95} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} - {26B01740-0C84-48D2-BF5E-7F0473421EB7} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal From 668d267e08cc5a376f43f928f54b2a64658f9340 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 17 Sep 2015 09:25:15 -0700 Subject: [PATCH 10/10] Correcting name of test project for resource manager profile tests --- AzurePowershell.Test.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index b6a29272efef..aaff65dc4fb9 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -67,7 +67,7 @@ - +