diff --git a/build.proj b/build.proj index f9b9a39c8122..71eab86ca827 100644 --- a/build.proj +++ b/build.proj @@ -90,24 +90,12 @@ - - - - - - - - + + - - - - - diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 05a52b0633ba..d78db5c29e82 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -20,12 +20,12 @@ + + + - - - @@ -82,12 +82,12 @@ + + + - - - @@ -97,15 +97,6 @@ - - - - - - - - - @@ -177,30 +168,18 @@ + + + - - - - - - - - - - - - - - - @@ -210,9 +189,6 @@ - - - @@ -222,9 +198,6 @@ - - - @@ -239,12 +212,12 @@ + + + - - - @@ -293,9 +266,6 @@ - - - @@ -310,12 +280,12 @@ + + + - - - @@ -438,12 +408,12 @@ + + + - - - @@ -474,15 +444,6 @@ - - - - - - - - - @@ -543,9 +504,6 @@ - - - @@ -557,12 +515,12 @@ + + + - - - @@ -634,12 +592,12 @@ + + + - - - @@ -649,15 +607,6 @@ - - - - - - - - - @@ -703,9 +652,6 @@ - - - @@ -720,12 +666,12 @@ + + + - - - @@ -813,18 +759,15 @@ + + + - - - - - - @@ -846,6 +789,9 @@ + + + @@ -929,12 +875,12 @@ + + + - - - @@ -1102,12 +1048,12 @@ + + + - - - @@ -1164,12 +1110,12 @@ + + + - - - @@ -1316,12 +1262,12 @@ + + + - - - @@ -1468,12 +1414,12 @@ + + + - - - @@ -1545,12 +1491,12 @@ + + + - - - @@ -1652,12 +1598,12 @@ + + + - - - @@ -2114,12 +2060,12 @@ + + + - - - @@ -2281,12 +2227,12 @@ + + + - - - @@ -2370,18 +2316,15 @@ + + + - - - - - - @@ -2432,12 +2375,12 @@ + + + - - - @@ -2513,8 +2456,8 @@ + - @@ -2533,14 +2476,11 @@ + - - - - @@ -2564,28 +2504,22 @@ + - - - - - - - + - @@ -2602,13 +2536,12 @@ - + - @@ -2649,8 +2582,8 @@ + - @@ -2661,9 +2594,6 @@ - - - @@ -2684,12 +2614,11 @@ - + - @@ -2713,14 +2642,11 @@ + - - - - @@ -2736,13 +2662,12 @@ - + - @@ -2770,10 +2695,9 @@ + - - @@ -2781,6 +2705,7 @@ + @@ -2808,8 +2733,8 @@ + - @@ -2865,8 +2790,8 @@ + - @@ -2885,8 +2810,8 @@ + - @@ -2935,8 +2860,8 @@ + - @@ -2985,8 +2910,8 @@ + - @@ -3010,8 +2935,8 @@ + - @@ -3045,8 +2970,8 @@ + - @@ -3187,8 +3112,8 @@ + - @@ -3242,8 +3167,8 @@ + - @@ -3271,10 +3196,9 @@ + - - @@ -3291,8 +3215,8 @@ + - diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index 7c7db64eb253..8ca5d7337b7c 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -50,19 +50,19 @@ False - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll False - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -77,12 +77,12 @@ ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs index 9e9294f98d9b..0ba9d67a5da3 100644 --- a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs +++ b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs @@ -15,11 +15,11 @@ using System; using System.Collections.Generic; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Storage; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { @@ -27,14 +27,14 @@ public static class WindowsAzureSubscriptionExtensions { private static Dictionary storageAccountCache = new Dictionary(); - public static CloudStorageAccount GetCloudStorageAccount(this AzureSubscription subscription) + public static CloudStorageAccount GetCloudStorageAccount(this AzureSubscription subscription, AzureProfile profile) { if (subscription == null) { return null; } - using (var storageClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement)) + using (var storageClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement)) { return StorageUtilities.GenerateCloudStorageAccount( storageClient, subscription.GetProperty(AzureSubscription.Property.StorageAccount)); diff --git a/src/Common/Commands.Common.Storage/packages.config b/src/Common/Commands.Common.Storage/packages.config index 3b37ad98079a..04635ae33785 100644 --- a/src/Common/Commands.Common.Storage/packages.config +++ b/src/Common/Commands.Common.Storage/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/Common/Commands.Common.Test/Commands.Common.Test.csproj b/src/Common/Commands.Common.Test/Commands.Common.Test.csproj index 72de007a39a1..f19e4cd484ed 100644 --- a/src/Common/Commands.Common.Test/Commands.Common.Test.csproj +++ b/src/Common/Commands.Common.Test/Commands.Common.Test.csproj @@ -49,24 +49,24 @@ - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll False - ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll @@ -77,13 +77,13 @@ ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False @@ -156,7 +156,6 @@ - diff --git a/src/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs b/src/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs index 1c40dff9da38..787e2da883bc 100644 --- a/src/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs +++ b/src/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs @@ -15,10 +15,10 @@ using System.Collections.Generic; using Xunit; using System; -using Microsoft.Azure.Common.Extensions.Factories; +using Microsoft.Azure.Common.Authentication.Factories; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { @@ -34,10 +34,16 @@ public void VerifySubscriptionTokenCacheRemove() var subscriptionId = Guid.NewGuid(); - var credential = authFactory.GetSubscriptionCloudCredentials(new AzureContext - { - Environment = AzureEnvironment.PublicEnvironments["AzureCloud"], - Account = new AzureAccount + var credential = authFactory.GetSubscriptionCloudCredentials(new AzureContext( + new AzureSubscription + { + Id = subscriptionId, + Properties = new Dictionary + { + { AzureSubscription.Property.Tenants, "123"} + } + }, + new AzureAccount { Id = "testuser", Type = AzureAccount.AccountType.User, @@ -46,16 +52,9 @@ public void VerifySubscriptionTokenCacheRemove() { AzureAccount.Property.Tenants, "123" } } }, - Subscription = new AzureSubscription - { - Id = subscriptionId, - Properties = new Dictionary - { - { AzureSubscription.Property.Tenants, "123"} - } - } + AzureEnvironment.PublicEnvironments["AzureCloud"] - }); + )); Assert.True(credential is AccessTokenCredential); Assert.Equal(subscriptionId, new Guid(((AccessTokenCredential)credential).SubscriptionId)); diff --git a/src/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs b/src/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs index 68cf9479d686..72d0961ad985 100644 --- a/src/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs +++ b/src/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test { diff --git a/src/Common/Commands.Common.Test/Common/Data.cs b/src/Common/Commands.Common.Test/Common/Data.cs index 18c6d3189341..65a7e521ebbd 100644 --- a/src/Common/Commands.Common.Test/Common/Data.cs +++ b/src/Common/Commands.Common.Test/Common/Data.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { @@ -66,7 +66,7 @@ public static class Data static Data() { - AzureAppDir = Path.Combine(Directory.GetCurrentDirectory(), Resources.AzureDirectoryName); + AzureAppDir = AzureSession.ProfileDirectory; AzureSdkAppDir = Path.Combine(Directory.GetCurrentDirectory(), "Microsoft Azure PowerShell"); TestResultDirectory = FileUtilities.GetAssemblyDirectory(); diff --git a/src/Common/Commands.Common.Test/Common/GeneralTests.cs b/src/Common/Commands.Common.Test/Common/GeneralTests.cs index 52c47af4e469..a6497020f8c5 100644 --- a/src/Common/Commands.Common.Test/Common/GeneralTests.cs +++ b/src/Common/Commands.Common.Test/Common/GeneralTests.cs @@ -16,7 +16,7 @@ using System.IO; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { diff --git a/src/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs b/src/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs index 9d01c351e8e7..bb6345ef2b3d 100644 --- a/src/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs +++ b/src/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs @@ -19,7 +19,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { diff --git a/src/Common/Commands.Common.Test/Common/ProfileClientTests.cs b/src/Common/Commands.Common.Test/Common/ProfileClientTests.cs deleted file mode 100644 index 334469eefacf..000000000000 --- a/src/Common/Commands.Common.Test/Common/ProfileClientTests.cs +++ /dev/null @@ -1,1692 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.Azure.Subscriptions.Models; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.WindowsAzure.Commands.Profile; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions.Authentication; -using Xunit; -using Microsoft.Azure.Common.Extensions; - -namespace Microsoft.WindowsAzure.Commands.Common.Test.Common -{ - public class ProfileClientTests - { - private string oldProfileData; - private string oldProfileDataBadSubscription; - private string oldProfileDataCorruptedFile; - private string oldProfileDataPath; - private string oldProfileDataPathError; - private string newProfileDataPath; - private string jsonProfileWithoutAccount; - private string jsonProfileWithBadData; - private string defaultSubscription = "06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F"; - private WindowsAzure.Subscriptions.Models.SubscriptionListOperationResponse.Subscription rdfeSubscription1; - private WindowsAzure.Subscriptions.Models.SubscriptionListOperationResponse.Subscription rdfeSubscription2; - private Azure.Subscriptions.Models.Subscription csmSubscription1; - private Azure.Subscriptions.Models.Subscription csmSubscription1withDuplicateId; - private Azure.Subscriptions.Models.Subscription csmSubscription2; - private AzureSubscription azureSubscription1; - private AzureSubscription azureSubscription2; - private AzureSubscription azureSubscription3withoutUser; - private AzureEnvironment azureEnvironment; - private AzureAccount azureAccount; - private TenantIdDescription commonTenant; - private TenantIdDescription guestTenant; - private Subscriptions.Models.SubscriptionListOperationResponse.Subscription guestRdfeSubscription; - private Subscription guestCsmSubscription; - - public ProfileClientTests() - { - SetMockData(); - AzureSession.SetCurrentContext(null, null, null); - } - - [Fact] - public void ProfileGetsCreatedWithNonExistingFile() - { - ProfileClient.DataStore = new MockDataStore(); - ProfileClient client = new ProfileClient(); - } - - [Fact] - public void ProfileMigratesOldData() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - Assert.False(dataStore.FileExists(oldProfileDataPath)); - Assert.True(dataStore.FileExists(newProfileDataPath)); - } - - [Fact] - public void ProfileMigratesOldDataOnce() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client1 = new ProfileClient(); - - Assert.False(dataStore.FileExists(oldProfileDataPath)); - Assert.True(dataStore.FileExists(newProfileDataPath)); - - ProfileClient client2 = new ProfileClient(); - - Assert.False(dataStore.FileExists(oldProfileDataPath)); - Assert.True(dataStore.FileExists(newProfileDataPath)); - } - - [Fact] - public void ProfileMigratesAccountsAndDefaultSubscriptions() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - // Verify Environment migration - Assert.Equal(4, client.Profile.Environments.Count); - Assert.Equal("Current", client.Profile.Environments["Current"].Name); - Assert.Equal("Dogfood", client.Profile.Environments["Dogfood"].Name); - Assert.Equal("https://login.windows-ppe.net/", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.AdTenant]); - Assert.Equal("https://management.core.windows.net/", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId]); - Assert.Equal("https://df.gallery.azure-test.net", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.Gallery]); - Assert.Equal("https://windows.azure-test.net", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.ManagementPortalUrl]); - Assert.Equal("https://auxnext.windows.azure-test.net/publishsettings/index", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl]); - Assert.Equal("https://api-dogfood.resources.windows-int.net", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.ResourceManager]); - Assert.Equal("https://management-preview.core.windows-int.net/", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.ServiceManagement]); - Assert.Equal(".database.windows.net", client.Profile.Environments["Dogfood"].Endpoints[AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix]); - - // Verify subscriptions - Assert.Equal(3, client.Profile.Subscriptions.Count); - Assert.False(client.Profile.Subscriptions.ContainsKey(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E"))); - Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F"))); - Assert.Equal("Test 2", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Name); - Assert.True(client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].IsPropertySet(AzureSubscription.Property.Default)); - Assert.Equal("test@mail.com", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Account); - Assert.Equal("Dogfood", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Environment); - Assert.Equal("123", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Properties[AzureSubscription.Property.Tenants]); - Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f"))); - Assert.Equal("Test 3", client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Name); - Assert.False(client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].IsPropertySet(AzureSubscription.Property.Default)); - Assert.Equal("test@mail.com", client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Account); - Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Properties[AzureSubscription.Property.Tenants]); - Assert.Equal(EnvironmentName.AzureCloud, client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Environment); - Assert.Equal(EnvironmentName.AzureChinaCloud, client.Profile.Subscriptions[new Guid("c14d7dc5-ed4d-4346-a02f-9f1bcf78fb66")].Environment); - - // Verify accounts - Assert.Equal(2, client.Profile.Accounts.Count); - Assert.Equal("test@mail.com", client.Profile.Accounts["test@mail.com"].Id); - Assert.Equal(AzureAccount.AccountType.User, client.Profile.Accounts["test@mail.com"].Type); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F").ToString())); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString())); - Assert.True(client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E09"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString())); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Tenants) - .Contains("72f988bf-86f1-41af-91ab-2d7cd011db47")); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Tenants) - .Contains("123")); - Assert.Equal("3AF24D48B97730E5C4C9CCB12397B5E046F79E09", client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E09"].Id); - Assert.Equal(AzureAccount.AccountType.Certificate, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E09"].Type); - Assert.Equal(0, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E09"].GetPropertyAsArray(AzureAccount.Property.Tenants).Length); - Assert.Equal(2, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E09"].GetPropertyAsArray(AzureAccount.Property.Subscriptions).Length); - } - - [Fact] - public void ProfileMigratesAccountsSkipsBadOnesAndBacksUpFile() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileDataBadSubscription; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - // Verify Environment migration - Assert.Equal(2, client.Profile.Environments.Count); - - // Verify subscriptions - Assert.Equal(3, client.Profile.Subscriptions.Count); - Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F"))); - Assert.Equal("Test Bad Management Endpoint", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Name); - Assert.Equal(EnvironmentName.AzureCloud, client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Environment); - Assert.Equal("Test Null Management Endpoint", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2ADFF")].Name); - Assert.Equal(EnvironmentName.AzureCloud, client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2ADFF")].Environment); - - Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f"))); - Assert.Equal("Test Bad Cert", client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Name); - - // Verify accounts - Assert.Equal(2, client.Profile.Accounts.Count); - Assert.Equal("test@mail.com", client.Profile.Accounts["test@mail.com"].Id); - Assert.Equal(AzureAccount.AccountType.User, client.Profile.Accounts["test@mail.com"].Type); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F").ToString())); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString())); - Assert.True(client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Subscriptions) - .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString())); - Assert.True(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Tenants) - .Contains("72f988bf-86f1-41af-91ab-2d7cd011db47")); - Assert.False(client.Profile.Accounts["test@mail.com"].GetPropertyAsArray(AzureAccount.Property.Tenants) - .Contains("123")); - Assert.Equal("3AF24D48B97730E5C4C9CCB12397B5E046F79E99", client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].Id); - Assert.Equal(AzureAccount.AccountType.Certificate, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].Type); - Assert.Equal(0, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Tenants).Length); - Assert.Equal(1, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Subscriptions).Length); - - // Verify backup file - Assert.True(dataStore.FileExists(oldProfileDataPathError)); - Assert.False(dataStore.FileExists(oldProfileDataPath)); - Assert.Equal(oldProfileDataBadSubscription, dataStore.ReadFileAsText(oldProfileDataPathError)); - } - - [Fact] - public void ProfileMigratesCorruptedFileAndCreatedBackup() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileDataCorruptedFile; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - // Verify Environment migration - Assert.Equal(2, client.Profile.Environments.Count); - - // Verify subscriptions - Assert.Equal(0, client.Profile.Subscriptions.Count); - - // Verify accounts - Assert.Equal(0, client.Profile.Accounts.Count); - - // Verify backup file - Assert.True(dataStore.FileExists(oldProfileDataPathError)); - Assert.False(dataStore.FileExists(oldProfileDataPath)); - Assert.Equal(oldProfileDataCorruptedFile, dataStore.ReadFileAsText(oldProfileDataPathError)); - } - - [Fact] - public void CmdletStartsWithCorruptedJson() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[newProfileDataPath] = jsonProfileWithBadData; - ProfileClient.DataStore = dataStore; - - GetAzureSubscriptionCommand cmdlt = new GetAzureSubscriptionCommand(); - - ProfileClient client = new ProfileClient(); - - Assert.Equal(0, client.Profile.Subscriptions.Count); - Assert.Null(AzureSession.CurrentContext.Subscription); - Assert.Null(AzureSession.CurrentContext.Account); - } - - [Fact] - public void CmdletStartsWithJsonWithoutAccounts() - { - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[newProfileDataPath] = jsonProfileWithoutAccount; - ProfileClient.DataStore = dataStore; - - GetAzureSubscriptionCommand cmdlt = new GetAzureSubscriptionCommand(); - - ProfileClient client = new ProfileClient(); - - Assert.Equal(1, client.Profile.Subscriptions.Count); - Assert.Null(AzureSession.CurrentContext.Subscription); - Assert.Null(AzureSession.CurrentContext.Account); - } - - [Fact] - public void AddAzureAccountReturnsAccountWithAllSubscriptionsInRdfeMode() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1 }.ToList()); - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var account = client.AddAccountAndLoadSubscriptions(new AzureAccount { Id = "test", Type = AzureAccount.AccountType.User }, AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], null); - - Assert.Equal("test", account.Id); - Assert.Equal(3, account.GetSubscriptions(client.Profile).Count); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId))); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId))); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(csmSubscription1.SubscriptionId))); - } - - [Fact] - public void AddAzureAccountReturnsAccountWithAllSubscriptionsInCsmMode() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1 }.ToList()); - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var account = client.AddAccountAndLoadSubscriptions(new AzureAccount { Id = "test", Type = AzureAccount.AccountType.User }, AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], null); - - Assert.Equal("test", account.Id); - Assert.Equal(3, account.GetSubscriptions(client.Profile).Count); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId))); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId))); - Assert.True(account.GetSubscriptions(client.Profile).Any(s => s.Id == new Guid(csmSubscription1.SubscriptionId))); - } - - /// - /// Verify that if a user has a different identity in one tenant, the identity is not added if it has no - /// access to subscriptions - /// - [Fact] - public void AddAzureAccountWithImpersonatedGuestWithNoSubscriptions() - { - SetMocks(new[] { rdfeSubscription1 }.ToList(), new List(), - new[] { commonTenant, guestTenant }.ToList(), - (userAccount, environment, tenant) => - { - var token = new MockAccessToken - { - UserId = tenant == commonTenant.TenantId ? userAccount.Id : "UserB", - AccessToken = "def", - LoginType = LoginType.OrgId - }; - userAccount.Id = token.UserId; - return token; - }); - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var account = client.AddAccountAndLoadSubscriptions(new AzureAccount { Id = "UserA", Type = AzureAccount.AccountType.User }, AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], null); - - Assert.Equal("UserA", account.Id); - Assert.Equal(1, account.GetSubscriptions(client.Profile).Count); - var subrdfe1 = account.GetSubscriptions(client.Profile).FirstOrDefault(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)); - var userA = client.GetAccount("UserA"); - var userB = client.GetAccount("UserB"); - Assert.NotNull(userA); - Assert.NotNull(userB); - Assert.Contains(rdfeSubscription1.SubscriptionId, userA.GetPropertyAsArray(AzureAccount.Property.Subscriptions), StringComparer.OrdinalIgnoreCase); - Assert.False(userB.HasSubscription(new Guid(rdfeSubscription1.SubscriptionId))); - Assert.NotNull(subrdfe1); - Assert.Equal("UserA", subrdfe1.Account); - } - - /// - /// Verify that multiple accounts can be added if a user has different identitities in different domains, linked to the same login - /// Verify that subscriptions with admin access forall accounts are added - /// - [Fact] - public void AddAzureAccountWithImpersonatedGuestWithSubscriptions() - { - SetMocks(new[] { rdfeSubscription1, guestRdfeSubscription }.ToList(), new List(), new[] { commonTenant, guestTenant }.ToList(), - (userAccount, environment, tenant) => - { - var token = new MockAccessToken - { - UserId = tenant == commonTenant.TenantId ? userAccount.Id : "UserB", - AccessToken = "def", - LoginType = LoginType.OrgId - }; - userAccount.Id = token.UserId; - return token; - }); - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var account = client.AddAccountAndLoadSubscriptions(new AzureAccount { Id = "UserA", Type = AzureAccount.AccountType.User }, - AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], null); - - Assert.Equal("UserA", account.Id); - Assert.Equal(1, account.GetSubscriptions(client.Profile).Count); - var subrdfe1 = account.GetSubscriptions(client.Profile).FirstOrDefault(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)); - var userA = client.GetAccount("UserA"); - var userB = client.GetAccount("UserB"); - var subGuest = userB.GetSubscriptions(client.Profile).FirstOrDefault(s => s.Id == new Guid(guestRdfeSubscription.SubscriptionId)); - Assert.NotNull(userA); - Assert.NotNull(userB); - Assert.Contains(rdfeSubscription1.SubscriptionId, userA.GetPropertyAsArray(AzureAccount.Property.Subscriptions), StringComparer.OrdinalIgnoreCase); - Assert.Contains(guestRdfeSubscription.SubscriptionId, userB.GetPropertyAsArray(AzureAccount.Property.Subscriptions), StringComparer.OrdinalIgnoreCase); - Assert.NotNull(subrdfe1); - Assert.NotNull(subGuest); - Assert.Equal("UserA", subrdfe1.Account); - Assert.Equal("UserB", subGuest.Account); - } - /// - /// Test that when account is added more than once with different capitalization, only a single account is added - /// and that accounts can be retrieved case-insensitively - /// - [Fact] - public void AddAzureAccountIsCaseInsensitive() - { - SetMocks(new[] { rdfeSubscription1, guestRdfeSubscription }.ToList(), new List(), new[] { commonTenant, guestTenant }.ToList(), - (userAccount, environment, tenant) => - { - var token = new MockAccessToken - { - UserId = tenant == commonTenant.TenantId ? userAccount.Id : "USERA", - AccessToken = "def", - LoginType = LoginType.OrgId - }; - userAccount.Id = token.UserId; - return token; - }); - MockDataStore dataStore = new MockDataStore(); - dataStore.VirtualStore[oldProfileDataPath] = oldProfileData; - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var account = client.AddAccountAndLoadSubscriptions(new AzureAccount { Id = "UserA", Type = AzureAccount.AccountType.User }, - AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud], null); - - var userA = client.GetAccount("UserA"); - var secondUserA = client.GetAccount("USERA"); - Assert.NotNull(userA); - Assert.NotNull(secondUserA); - Assert.Equal(userA.Id, secondUserA.Id); - } - - [Fact] - public void GetAzureAccountReturnsAccountWithSubscriptions() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - - var account = client.ListAccounts("test").ToList(); - - Assert.Equal(1, account.Count); - Assert.Equal("test", account[0].Id); - Assert.Equal(2, account[0].GetSubscriptions(client.Profile).Count); - Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription1.Id)); - Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription2.Id)); - } - - [Fact] - public void GetAzureAccountWithoutEnvironmentReturnsAccount() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - - var account = client.ListAccounts("test").ToList(); - - Assert.Equal(1, account.Count); - Assert.Equal("test", account[0].Id); - Assert.Equal(2, account[0].GetSubscriptions(client.Profile).Count); - Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription1.Id)); - Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription2.Id)); - } - - [Fact] - public void GetAzureAccountReturnsEmptyEnumerationForNonExistingUser() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - - var account = client.ListAccounts("test2").ToList(); - - Assert.Equal(1, account.Count); - } - - [Fact] - public void GetAzureAccountReturnsAllAccountsWithNullUser() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription3withoutUser.Account = "test2"; - client.Profile.Accounts["test2"] = new AzureAccount - { - Id = "test2", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - {AzureAccount.Property.Subscriptions, azureSubscription3withoutUser.Id.ToString()} - } - }; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - - var account = client.ListAccounts(null).ToList(); - - Assert.Equal(2, account.Count); - } - - [Fact] - public void RemoveAzureAccountRemovesSubscriptions() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription3withoutUser.Account = "test2"; - client.Profile.Accounts["test2"] = new AzureAccount - { - Id = "test2", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - {AzureAccount.Property.Subscriptions, azureSubscription3withoutUser.Id.ToString()} - } - }; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - List log = new List(); - client.WarningLog = log.Add; - - Assert.Equal(3, client.Profile.Subscriptions.Count); - - client.RemoveAccount("test2"); - - Assert.Equal(2, client.Profile.Subscriptions.Count); - Assert.Equal(0, log.Count); - } - - [Fact] - public void RemoveAzureAccountRemovesDefaultSubscriptionAndWritesWarning() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription3withoutUser.Account = "test2"; - client.Profile.Accounts["test2"] = new AzureAccount - { - Id = "test2", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - {AzureAccount.Property.Subscriptions, azureSubscription3withoutUser.Id.ToString()} - } - }; - client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - List log = new List(); - client.WarningLog = log.Add; - - Assert.Equal(3, client.Profile.Subscriptions.Count); - - var account = client.RemoveAccount("test"); - - Assert.Equal(1, client.Profile.Subscriptions.Count); - Assert.Equal("test", account.Id); - Assert.Equal(2, account.GetPropertyAsArray(AzureAccount.Property.Subscriptions).Length); - Assert.Equal(1, log.Count); - Assert.Equal( - "The default subscription is being removed. Use Select-AzureSubscription -Default to select a new default subscription.", - log[0]); - } - - [Fact] - public void RemoveAzureAccountRemovesDefaultAccountFromSubscription() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription3withoutUser.Account = "test2"; - client.Profile.Accounts["test2"] = new AzureAccount - { - Id = "test2", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - {AzureAccount.Property.Subscriptions, azureSubscription1.Id.ToString()} - } - }; - client.Profile.Subscriptions[azureSubscription1.Id].Account = azureAccount.Id; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - - var account = client.RemoveAccount(azureAccount.Id); - - Assert.Equal("test2", client.Profile.Subscriptions[azureSubscription1.Id].Account); - } - - [Fact] - public void RemoveAzureAccountRemovesInMemoryAccount() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription3withoutUser.Account = "test2"; - client.Profile.Accounts["test2"] = new AzureAccount - { - Id = "test2", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - {AzureAccount.Property.Subscriptions, azureSubscription1.Id.ToString()} - } - }; - client.Profile.Subscriptions[azureSubscription1.Id].Account = azureAccount.Id; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - AzureSession.SetCurrentContext(azureSubscription1, azureEnvironment, azureAccount); - - client.RemoveAccount(azureAccount.Id); - - Assert.Equal("test2", AzureSession.CurrentContext.Account.Id); - Assert.Equal("test2", AzureSession.CurrentContext.Subscription.Account); - Assert.Equal(azureSubscription1.Id, AzureSession.CurrentContext.Subscription.Id); - - client.RemoveAccount("test2"); - - Assert.Null(AzureSession.CurrentContext.Account); - Assert.Null(AzureSession.CurrentContext.Subscription); - Assert.Equal(EnvironmentName.AzureCloud, AzureSession.CurrentContext.Environment.Name); - } - - [Fact] - public void AddAzureEnvironmentAddsEnvironment() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - Assert.Equal(2, client.Profile.Environments.Count); - - Assert.Throws(() => client.AddOrSetEnvironment(null)); - var env = client.AddOrSetEnvironment(azureEnvironment); - - Assert.Equal(3, client.Profile.Environments.Count); - Assert.Equal(env, azureEnvironment); - } - - [Fact] - public void GetAzureEnvironmentsListsEnvironments() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var env1 = client.ListEnvironments(null); - - Assert.Equal(2, env1.Count); - - var env2 = client.ListEnvironments("bad"); - - Assert.Equal(0, env2.Count); - - var env3 = client.ListEnvironments(EnvironmentName.AzureCloud); - - Assert.Equal(1, env3.Count); - } - - [Fact] - public void RemoveAzureEnvironmentRemovesEnvironmentSubscriptionsAndAccounts() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.Profile.Environments[azureEnvironment.Name] = azureEnvironment; - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - - Assert.Equal(2, client.Profile.Subscriptions.Values.Count(s => s.Environment == "Test")); - Assert.Equal(3, client.Profile.Environments.Count); - Assert.Equal(1, client.Profile.Accounts.Count); - - Assert.Throws(() => client.RemoveEnvironment(null)); - Assert.Throws(() => client.RemoveEnvironment("bad")); - - var env = client.RemoveEnvironment(azureEnvironment.Name); - - Assert.Equal(azureEnvironment.Name, env.Name); - Assert.Equal(0, client.Profile.Subscriptions.Values.Count(s => s.Environment == "Test")); - Assert.Equal(2, client.Profile.Environments.Count); - Assert.Equal(0, client.Profile.Accounts.Count); - } - - [Fact] - public void RemoveAzureEnvironmentDoesNotRemoveEnvironmentSubscriptionsAndAccountsForAzureCloudOrChinaCloud() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.Profile.Accounts[azureAccount.Id] = azureAccount; - azureSubscription1.Environment = EnvironmentName.AzureCloud; - azureSubscription2.Environment = EnvironmentName.AzureChinaCloud; - client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1; - client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2; - - Assert.Equal(1, client.Profile.Subscriptions.Values.Count(s => s.Environment == EnvironmentName.AzureCloud)); - Assert.Equal(1, client.Profile.Subscriptions.Values.Count(s => s.Environment == EnvironmentName.AzureChinaCloud)); - Assert.Equal(2, client.Profile.Environments.Count); - Assert.Equal(1, client.Profile.Accounts.Count); - - Assert.Throws(() => client.RemoveEnvironment(EnvironmentName.AzureCloud)); - Assert.Throws(() => client.RemoveEnvironment(EnvironmentName.AzureChinaCloud)); - - Assert.Equal(1, client.Profile.Subscriptions.Values.Count(s => s.Environment == EnvironmentName.AzureCloud)); - Assert.Equal(1, client.Profile.Subscriptions.Values.Count(s => s.Environment == EnvironmentName.AzureChinaCloud)); - Assert.Equal(2, client.Profile.Environments.Count); - Assert.Equal(1, client.Profile.Accounts.Count); - } - - [Fact] - public void SetAzureEnvironmentUpdatesEnvironment() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - Assert.Equal(2, client.Profile.Environments.Count); - - Assert.Throws(() => client.AddOrSetEnvironment(null)); - - var env2 = client.AddOrSetEnvironment(azureEnvironment); - Assert.Equal(env2.Name, azureEnvironment.Name); - Assert.NotNull(env2.Endpoints[AzureEnvironment.Endpoint.ServiceManagement]); - AzureEnvironment newEnv = new AzureEnvironment - { - Name = azureEnvironment.Name - }; - newEnv.Endpoints[AzureEnvironment.Endpoint.Graph] = "foo"; - env2 = client.AddOrSetEnvironment(newEnv); - Assert.Equal("foo", env2.Endpoints[AzureEnvironment.Endpoint.Graph]); - Assert.NotNull(env2.Endpoints[AzureEnvironment.Endpoint.ServiceManagement]); - } - - [Fact] - public void GetAzureEnvironmentReturnsCorrectValue() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetEnvironment(azureEnvironment); - - Assert.Equal(EnvironmentName.AzureCloud, AzureSession.CurrentContext.Environment.Name); - - var defaultEnv = client.GetEnvironmentOrDefault(null); - - Assert.Equal(EnvironmentName.AzureCloud, defaultEnv.Name); - - var newEnv = client.GetEnvironmentOrDefault(azureEnvironment.Name); - - Assert.Equal(azureEnvironment.Name, newEnv.Name); - - Assert.Throws(() => client.GetEnvironmentOrDefault("bad")); - } - - [Fact] - public void GetCurrentEnvironmentReturnsCorrectValue() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - AzureSession.SetCurrentContext(azureSubscription1, azureEnvironment, azureAccount); - - var newEnv = client.GetEnvironmentOrDefault(azureEnvironment.Name); - - Assert.Equal(azureEnvironment.Name, newEnv.Name); - } - - [Fact] - public void AddOrSetAzureSubscriptionChecksAndUpdates() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - - Assert.Equal(1, client.Profile.Subscriptions.Count); - - var subscription = client.AddOrSetSubscription(azureSubscription1); - - Assert.Equal(1, client.Profile.Subscriptions.Count); - Assert.Equal(1, client.Profile.Accounts.Count); - Assert.Equal(subscription, azureSubscription1); - Assert.Throws(() => client.AddOrSetSubscription(null)); - Assert.Throws(() => client.AddOrSetSubscription( - new AzureSubscription { Id = new Guid(), Environment = null, Name = "foo" })); - } - - [Fact] - public void AddOrSetAzureSubscriptionUpdatesInMemory() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - AzureSession.SetCurrentContext(azureSubscription1, azureEnvironment, azureAccount); - azureSubscription1.Properties[AzureSubscription.Property.StorageAccount] = "testAccount"; - Assert.Equal(azureSubscription1.Id, AzureSession.CurrentContext.Subscription.Id); - Assert.Equal(azureSubscription1.Properties[AzureSubscription.Property.StorageAccount], - AzureSession.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount]); - - var newSubscription = new AzureSubscription - { - Id = azureSubscription1.Id, - Environment = azureSubscription1.Environment, - Account = azureSubscription1.Account, - Name = azureSubscription1.Name - }; - newSubscription.Properties[AzureSubscription.Property.StorageAccount] = "testAccount1"; - - client.AddOrSetSubscription(newSubscription); - var newSubscriptionFromProfile = client.Profile.Subscriptions[newSubscription.Id]; - - Assert.Equal(newSubscription.Id, AzureSession.CurrentContext.Subscription.Id); - Assert.Equal(newSubscription.Id, newSubscriptionFromProfile.Id); - Assert.Equal(newSubscription.Properties[AzureSubscription.Property.StorageAccount], - AzureSession.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount]); - Assert.Equal(newSubscription.Properties[AzureSubscription.Property.StorageAccount], - newSubscriptionFromProfile.Properties[AzureSubscription.Property.StorageAccount]); - } - - [Fact] - public void RemoveAzureSubscriptionChecksAndRemoves() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.SetSubscriptionAsCurrent(azureSubscription1.Name, azureSubscription1.Account); - client.SetSubscriptionAsDefault(azureSubscription1.Name, azureSubscription1.Account); - - Assert.Equal(1, client.Profile.Subscriptions.Count); - - List log = new List(); - client.WarningLog = log.Add; - - var subscription = client.RemoveSubscription(azureSubscription1.Name); - - Assert.Equal(0, client.Profile.Subscriptions.Count); - Assert.Equal(azureSubscription1.Name, subscription.Name); - Assert.Equal(2, log.Count); - Assert.Equal( - "The default subscription is being removed. Use Select-AzureSubscription -Default to select a new default subscription.", - log[0]); - Assert.Equal( - "The current subscription is being removed. Use Select-AzureSubscription to select a new current subscription.", - log[1]); - Assert.Throws(() => client.RemoveSubscription("bad")); - Assert.Throws(() => client.RemoveSubscription(null)); - } - - [Fact] - public void RefreshSubscriptionsUpdatesAccounts() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetEnvironment(azureEnvironment); - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetSubscription(azureSubscription1); - - var subscriptions = client.RefreshSubscriptions(azureEnvironment); - - Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(rdfeSubscription1.SubscriptionId))); - Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(rdfeSubscription2.SubscriptionId))); - Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(csmSubscription1.SubscriptionId))); - Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(csmSubscription1withDuplicateId.SubscriptionId))); - } - - [Fact] - public void RefreshSubscriptionsMergesFromServer() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetEnvironment(azureEnvironment); - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetSubscription(azureSubscription1); - - var subscriptions = client.RefreshSubscriptions(azureEnvironment); - - Assert.Equal(4, subscriptions.Count); - Assert.Equal(4, subscriptions.Count(s => s.Account == "test")); - Assert.Equal(1, subscriptions.Count(s => s.Id == azureSubscription1.Id)); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId))); - Assert.Equal(2, subscriptions.First(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)).GetPropertyAsArray(AzureSubscription.Property.SupportedModes).Count()); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId))); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(csmSubscription1.SubscriptionId))); - } - - [Fact] - public void RefreshSubscriptionsWorksWithMooncake() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - client.Profile.Accounts[azureAccount.Id] = azureAccount; - - var subscriptions = client.RefreshSubscriptions(client.Profile.Environments[EnvironmentName.AzureChinaCloud]); - - Assert.Equal(2, subscriptions.Count); - Assert.Equal(2, subscriptions.Count(s => s.Account == "test")); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId))); - Assert.Equal(1, subscriptions.First(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)).GetPropertyAsArray(AzureSubscription.Property.SupportedModes).Count()); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId))); - } - - [Fact] - public void RefreshSubscriptionsListsAllSubscriptions() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - - var subscriptions = client.RefreshSubscriptions(azureEnvironment); - - Assert.Equal(4, subscriptions.Count); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId))); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId))); - Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(csmSubscription1.SubscriptionId))); - Assert.True(subscriptions.All(s => s.Environment == "Test")); - Assert.True(subscriptions.All(s => s.Account == "test")); - } - - [Fact] - public void GetAzureSubscriptionByNameChecksAndReturnsOnlyLocal() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.AddOrSetSubscription(azureSubscription2); - - var subscriptions = client.GetSubscription(azureSubscription1.Name); - - Assert.Equal(azureSubscription1.Id, subscriptions.Id); - Assert.Throws(() => client.GetSubscription(new Guid())); - } - - [Fact] - public void GetAzureSubscriptionByIdChecksAndReturnsOnlyLocal() - { - SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList()); - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.AddOrSetSubscription(azureSubscription2); - - var subscriptions = client.GetSubscription(azureSubscription1.Id); - - Assert.Equal(azureSubscription1.Id, subscriptions.Id); - Assert.Throws(() => client.GetSubscription(new Guid())); - } - - [Fact] - public void SetAzureSubscriptionAsDefaultSetsDefaultAndCurrent() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription2); - - Assert.Null(client.Profile.DefaultSubscription); - - client.SetSubscriptionAsDefault(azureSubscription2.Name, azureSubscription2.Account); - - Assert.Equal(azureSubscription2.Id, client.Profile.DefaultSubscription.Id); - Assert.Equal(azureSubscription2.Id, AzureSession.CurrentContext.Subscription.Id); - Assert.Throws(() => client.SetSubscriptionAsDefault("bad", null)); - Assert.Throws(() => client.SetSubscriptionAsDefault(null, null)); - } - - [Fact] - public void ClearDefaultAzureSubscriptionClearsDefault() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription2); - - Assert.Null(client.Profile.DefaultSubscription); - client.SetSubscriptionAsDefault(azureSubscription2.Name, azureSubscription2.Account); - Assert.Equal(azureSubscription2.Id, client.Profile.DefaultSubscription.Id); - - client.ClearDefaultSubscription(); - - Assert.Null(client.Profile.DefaultSubscription); - } - - [Fact] - public void SetAzureSubscriptionAsCurrentSetsCurrent() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.AddOrSetSubscription(azureSubscription2); - - Assert.Null(AzureSession.CurrentContext.Subscription); - - client.SetSubscriptionAsCurrent(azureSubscription2.Name, azureSubscription2.Account); - - Assert.Equal(azureSubscription2.Id, AzureSession.CurrentContext.Subscription.Id); - Assert.Throws(() => client.SetSubscriptionAsCurrent("bad", null)); - Assert.Throws(() => client.SetSubscriptionAsCurrent(null, null)); - } - - [Fact] - public void ImportPublishSettingsLoadsAndReturnsSubscriptions() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", azureEnvironment.Name); - var account = client.Profile.Accounts.Values.First(); - - Assert.True(subscriptions.All(s => s.Account == account.Id)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(6, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsDefaultsToAzureCloudEnvironmentWithManagementUrl() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.SetSubscriptionAsDefault(azureSubscription1.Name, azureAccount.Id); - client.Profile.Save(); - - client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", null); - - Assert.True(subscriptions.All(s => s.Environment == EnvironmentName.AzureCloud)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(7, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsUsesProperEnvironmentWithManagementUrl() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - azureEnvironment.Endpoints[AzureEnvironment.Endpoint.ServiceManagement] = "https://newmanagement.core.windows.net/"; - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.SetSubscriptionAsDefault(azureSubscription1.Name, azureAccount.Id); - client.Profile.Save(); - - client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile3); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", null); - - Assert.True(subscriptions.All(s => s.Environment == azureEnvironment.Name)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(7, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsUsesProperEnvironmentWithChinaManagementUrl() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfileChina); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", null); - - Assert.True(subscriptions.All(s => s.Environment == EnvironmentName.AzureChinaCloud)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(6, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsUsesProperEnvironmentWithChinaManagementUrlOld() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfileChinaOld); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", null); - - Assert.True(subscriptions.All(s => s.Environment == EnvironmentName.AzureChinaCloud)); - Assert.Equal(1, subscriptions.Count); - Assert.Equal(1, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsDefaultsToAzureCloudWithIncorrectManagementUrl() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.SetSubscriptionAsDefault(azureSubscription1.Name, azureAccount.Id); - client.Profile.Save(); - - client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile3); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", null); - - Assert.True(subscriptions.All(s => s.Environment == EnvironmentName.AzureCloud)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(7, client.Profile.Subscriptions.Count); - } - - [Fact] - public void ImportPublishSettingsUsesPassedInEnvironment() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - client.AddOrSetAccount(azureAccount); - client.AddOrSetEnvironment(azureEnvironment); - client.AddOrSetSubscription(azureSubscription1); - client.SetSubscriptionAsDefault(azureSubscription1.Name, azureAccount.Id); - client.Profile.Save(); - - client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile3); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", azureEnvironment.Name); - - Assert.True(subscriptions.All(s => s.Environment == azureEnvironment.Name)); - Assert.Equal(6, subscriptions.Count); - Assert.Equal(7, client.Profile.Subscriptions.Count); - } - - [Fact] - public void SelectAzureSubscriptionByIdWorks() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - - var tempSubscriptions = new List - { - new AzureSubscription - { - Id = new Guid("11111111-1383-4740-8A69-748C5B63ADBA"), - Name = "Same Name Subscription", - Environment = azureEnvironment.Name, - Account = azureAccount.Id, - Properties = new Dictionary - { - { AzureSubscription.Property.Default, "True" } - } - }, - - new AzureSubscription - { - Id = new Guid("22222222-1383-4740-8A69-748C5B63ADBA"), - Name = "Same Name Subscription", - Environment = azureEnvironment.Name, - Account = azureAccount.Id, - Properties = new Dictionary() - }, - - new AzureSubscription - { - Id = new Guid("33333333-1383-4740-8A69-748C5B63ADBA"), - Name = "Same Name Subscription", - Environment = azureEnvironment.Name, - Account = azureAccount.Id, - Properties = new Dictionary() - } - }; - - client.Profile.Accounts[azureAccount.Id] = azureAccount; - client.AddOrSetEnvironment(azureEnvironment); - - foreach (var s in tempSubscriptions) - { - client.AddOrSetSubscription(s); - } - - client.SetSubscriptionAsCurrent(tempSubscriptions[0].Name, tempSubscriptions[0].Account); - client.Profile.Save(); - - Assert.Equal(tempSubscriptions[0].Id, AzureSession.CurrentContext.Subscription.Id); - - var cmdlt = new SelectAzureSubscriptionCommand(); - - cmdlt.CommandRuntime = new MockCommandRuntime(); - cmdlt.SubscriptionId = tempSubscriptions[2].Id.ToString(); - cmdlt.SetParameterSet("SelectSubscriptionByIdParameterSet"); - - // Act - cmdlt.InvokeBeginProcessing(); - cmdlt.ExecuteCmdlet(); - cmdlt.InvokeEndProcessing(); - - Assert.Equal(tempSubscriptions[2].Id, AzureSession.CurrentContext.Subscription.Id); - } - - [Fact] - public void ImportPublishSettingsAddsSecondCertificate() - { - MockDataStore dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; - ProfileClient client = new ProfileClient(); - var newSubscription = new AzureSubscription - { - Id = new Guid("f62b1e05-af8f-4203-8f97-421089adc053"), - Name = "Microsoft Azure Sandbox 9-220", - Environment = EnvironmentName.AzureCloud, - Account = azureAccount.Id - }; - azureAccount.SetProperty(AzureAccount.Property.Subscriptions, newSubscription.Id.ToString()); - client.AddOrSetAccount(azureAccount); - client.AddOrSetSubscription(newSubscription); - client.Profile.Save(); - - client = new ProfileClient(); - - dataStore.WriteFile("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", - Properties.Resources.ValidProfile); - - client.AddOrSetEnvironment(azureEnvironment); - var subscriptions = client.ImportPublishSettings("ImportPublishSettingsLoadsAndReturnsSubscriptions.publishsettings", azureEnvironment.Name); - - Assert.Equal(2, client.Profile.Accounts.Count()); - var certAccount = client.Profile.Accounts.Values.First(a => a.Type == AzureAccount.AccountType.Certificate); - var userAccount = client.Profile.Accounts.Values.First(a => a.Type == AzureAccount.AccountType.User); - - Assert.True(subscriptions.All(s => s.Account == certAccount.Id)); - Assert.Equal(azureAccount.Id, client.Profile.Subscriptions.Values.First(s => s.Id == newSubscription.Id).Account); - - Assert.True(userAccount.GetPropertyAsArray(AzureAccount.Property.Subscriptions).Contains(newSubscription.Id.ToString())); - Assert.True(certAccount.GetPropertyAsArray(AzureAccount.Property.Subscriptions).Contains(newSubscription.Id.ToString())); - - Assert.Equal(6, subscriptions.Count); - Assert.Equal(6, client.Profile.Subscriptions.Count); - } - - private void SetMocks(List rdfeSubscriptions, - List csmSubscriptions, - List tenants = null, - Func tokenProvider = null) - { - ClientMocks clientMocks = new ClientMocks(new Guid(defaultSubscription)); - - clientMocks.LoadRdfeSubscriptions(rdfeSubscriptions); - clientMocks.LoadCsmSubscriptions(csmSubscriptions); - clientMocks.LoadTenants(tenants); - - AzureSession.ClientFactory = new MockClientFactory(new object[] { clientMocks.RdfeSubscriptionClientMock.Object, - clientMocks.CsmSubscriptionClientMock.Object }); - - var mockFactory = new MockTokenAuthenticationFactory(); - if (tokenProvider != null) - { - mockFactory.TokenProvider = tokenProvider; - } - - AzureSession.AuthenticationFactory = mockFactory; - } - - private void SetMockData() - { - commonTenant = new TenantIdDescription - { - Id = "Common", - TenantId = "Common" - }; - guestTenant = new TenantIdDescription - { - Id = "Guest", - TenantId = "Guest" - }; - rdfeSubscription1 = new Subscriptions.Models.SubscriptionListOperationResponse.Subscription - { - SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E", - SubscriptionName = "RdfeSub1", - SubscriptionStatus = Subscriptions.Models.SubscriptionStatus.Active, - ActiveDirectoryTenantId = "Common" - }; - rdfeSubscription2 = new Subscriptions.Models.SubscriptionListOperationResponse.Subscription - { - SubscriptionId = "26E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E", - SubscriptionName = "RdfeSub2", - SubscriptionStatus = Subscriptions.Models.SubscriptionStatus.Active, - ActiveDirectoryTenantId = "Common" - }; - guestRdfeSubscription = new Subscriptions.Models.SubscriptionListOperationResponse.Subscription - { - SubscriptionId = "26E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1C", - SubscriptionName = "RdfeSub2", - SubscriptionStatus = Subscriptions.Models.SubscriptionStatus.Active, - ActiveDirectoryTenantId = "Guest" - }; - csmSubscription1 = new Azure.Subscriptions.Models.Subscription - { - Id = "Subscriptions/36E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E", - DisplayName = "CsmSub1", - State = "Active", - SubscriptionId = "36E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" - }; - csmSubscription1withDuplicateId = new Azure.Subscriptions.Models.Subscription - { - Id = "Subscriptions/16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E", - DisplayName = "RdfeSub1", - State = "Active", - SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" - }; - csmSubscription2 = new Azure.Subscriptions.Models.Subscription - { - Id = "Subscriptions/46E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E", - DisplayName = "CsmSub2", - State = "Active", - SubscriptionId = "46E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" - }; - guestCsmSubscription = new Azure.Subscriptions.Models.Subscription - { - Id = "Subscriptions/76E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1D", - DisplayName = "CsmGuestSub", - State = "Active", - SubscriptionId = "76E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1D" - }; - azureSubscription1 = new AzureSubscription - { - Id = new Guid("56E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E"), - Name = "LocalSub1", - Environment = "Test", - Account = "test", - Properties = new Dictionary - { - { AzureSubscription.Property.Default, "True" } - } - }; - azureSubscription2 = new AzureSubscription - { - Id = new Guid("66E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E"), - Name = "LocalSub2", - Environment = "Test", - Account = "test" - }; - azureSubscription3withoutUser = new AzureSubscription - { - Id = new Guid("76E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E"), - Name = "LocalSub3", - Environment = "Test", - }; - azureEnvironment = new AzureEnvironment - { - Name = "Test", - Endpoints = new Dictionary - { - { AzureEnvironment.Endpoint.ServiceManagement, "https://umapi.rdfetest.dnsdemo4.com:8443/" }, - { AzureEnvironment.Endpoint.ManagementPortalUrl, "https://windows.azure-test.net" }, - { AzureEnvironment.Endpoint.AdTenant, "https://login.windows-ppe.net/" }, - { AzureEnvironment.Endpoint.ActiveDirectory, "https://login.windows-ppe.net/" }, - { AzureEnvironment.Endpoint.Gallery, "https://current.gallery.azure-test.net" }, - { AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" }, - { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, "vault-int.azure-int.net"}, - { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, "https://vault-int.azure-int.net/"} - } - }; - azureAccount = new AzureAccount - { - Id = "test", - Type = AzureAccount.AccountType.User, - Properties = new Dictionary - { - { AzureAccount.Property.Subscriptions, azureSubscription1.Id + "," + azureSubscription2.Id } - } - }; - newProfileDataPath = System.IO.Path.Combine(AzurePowerShell.ProfileDirectory, AzurePowerShell.ProfileFile); - oldProfileDataPath = System.IO.Path.Combine(AzurePowerShell.ProfileDirectory, AzurePowerShell.OldProfileFile); - oldProfileDataPathError = System.IO.Path.Combine(AzurePowerShell.ProfileDirectory, AzurePowerShell.OldProfileFileBackup); - oldProfileData = @" - - AzureCloud - - - https://management.core.windows.net/ - https://login.windows-ppe.net/ - Common - https://current.gallery.azure-test.net - http://go.microsoft.com/fwlink/?LinkId=254433 - Current - d:\Code\azure.publishsettings - https://api-current.resources.windows-int.net/ - https://umapi.rdfetest.dnsdemo4.com:8443/ - .database.windows.net - - trafficmanager.net - - - https://management.core.windows.net/ - https://login.windows-ppe.net/ - Common - https://df.gallery.azure-test.net - https://windows.azure-test.net - Dogfood - https://auxnext.windows.azure-test.net/publishsettings/index - https://api-dogfood.resources.windows-int.net - https://management-preview.core.windows-int.net/ - .database.windows.net - - trafficmanager.net - - - - - - - - - - - true - - - https://management.core.windows.net/ - Test - - - .database.windows.net - 06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E - trafficmanager.net - - - - - 123 - test@mail.com - - - true - - - https://management-preview.core.windows-int.net/ - Test 2 - - - .database.windows.net - 06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F - trafficmanager.net - - - https://login.windows.net/ - https://management.core.windows.net/ - 72f988bf-86f1-41af-91ab-2d7cd011db47 - test@mail.com - - - false - - 3AF24D48B97730E5C4C9CCB12397B5E046F79E09 - https://management.core.windows.net/ - Test 3 - - - .database.windows.net - d1e52cbc-b073-42e2-a0a0-c2f547118a6f - trafficmanager.net - - - - - - - - - false - - 3AF24D48B97730E5C4C9CCB12397B5E046F79E09 - https://management.core.chinacloudapi.cn/ - Mooncake Test - - - .database.windows.net - c14d7dc5-ed4d-4346-a02f-9f1bcf78fb66 - trafficmanager.net - - - "; - - oldProfileDataBadSubscription = @" - - AzureCloud - - - - - - - - - - - true - - - https://management.core.windows.net/ - Test Nill ID - - - .database.windows.net - - trafficmanager.net - - - - - - test@mail.com - - - true - - - Bad Data - Test Bad Management Endpoint - - - .database.windows.net - 06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F - trafficmanager.net - - - - - - test@mail.com - - - true - - - - Test Null Management Endpoint - - - .database.windows.net - 06E3F6FD-A3AA-439A-8FC4-1F5C41D2ADFF - trafficmanager.net - - - https://login.windows.net/ - https://management.core.windows.net/ - 72f988bf-86f1-41af-91ab-2d7cd011db47 - test@mail.com - - - false - - 3AF24D48B97730E5C4C9CCB12397B5E046F79E99 - https://management.core.windows.net/ - Test Bad Cert - - - .database.windows.net - d1e52cbc-b073-42e2-a0a0-c2f547118a6f - trafficmanager.net - - - "; - - oldProfileDataCorruptedFile = @" - - AzureCloud - - - https://management.core.windows.net/ - https://login.windows-ppe.net/ - Common - https://current.gallery.azure-test.net - http://go.microsoft.com/fwlink/?LinkId=254433 - Current - d:\Code\azure.publishsettings - https://api-current.resources.windows-int.net/ - https://umapi.rdfetest.dnsdemo4.com:8443/ - .database.windows.net - - trafficmanager.net - - - - "; - - jsonProfileWithoutAccount = @"{ - ""Environments"": [], - ""Subscriptions"": [ - { - ""Id"": ""7e11f45f-70e6-430a-a4fc-af338aa22c11"", - ""Name"": ""Test"", - ""Environment"": ""AzureCloud"", - ""Account"": ""test@mail.com"", - ""Properties"": { - ""SupportedModes"": ""AzureServiceManagement"", - ""Default"": ""True"", - ""StorageAccount"": ""rjfmmanagement"" - } - } - ], - ""Accounts"": [] - }"; - - jsonProfileWithBadData = @"{ - ""Environments"": [], - ""Subscriptions"": { - { - ""Id"": ""7e11f45f-70e6-430a-a4fc-af338aa22c11"", - ""Name"": ""Test"", - ""Environment"": ""AzureCloud"", - ""Account"": ""test@mail.com"", - ""Properties"": { - ""SupportedModes"": ""AzureServiceManagement"", - ""Default"": ""True"", - ""StorageAccount"": ""rjfmmanagement"" - } - } - ], - ""Accounts"": [] - }"; - } - } -} diff --git a/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs b/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs index b72bb2c66b66..c0a1396f60bb 100644 --- a/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs +++ b/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs @@ -12,24 +12,20 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Microsoft.WindowsAzure.Commands.Profile; +using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Management.Automation; -using System.Management.Automation.Language; using System.Reflection; using System.Security.Cryptography.X509Certificates; -using System.Text; -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.WindowsAzure.Commands.Profile; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions.Authentication; -using Moq; using Xunit; -using Microsoft.Azure.Common.Extensions; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { @@ -46,10 +42,9 @@ public class ProfileCmdltsTests public ProfileCmdltsTests() : base() { dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; + AzureSession.DataStore = dataStore; commandRuntimeMock = new MockCommandRuntime(); SetMockData(); - AzureSession.SetCurrentContext(null, null, null); } [Fact] @@ -57,7 +52,7 @@ public void ClearAzureProfileClearsDefaultProfile() { ClearAzureProfileCommand cmdlt = new ClearAzureProfileCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); @@ -72,7 +67,7 @@ public void ClearAzureProfileClearsDefaultProfile() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); Assert.Equal(0, client.Profile.Subscriptions.Count); Assert.Equal(0, client.Profile.Accounts.Count); Assert.Equal(2, client.Profile.Environments.Count); //only default environments @@ -85,7 +80,7 @@ public void ClearAzureProfileClearsCustomProfile() ClearAzureProfileCommand cmdlt = new ClearAzureProfileCommand(); // Setup - ProfileClient client = new ProfileClient(subscriptionDataFile); + ProfileClient client = new ProfileClient(new AzureProfile(subscriptionDataFile)); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); @@ -93,7 +88,7 @@ public void ClearAzureProfileClearsCustomProfile() cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.Force = new SwitchParameter(true); - cmdlt.SubscriptionDataFile = subscriptionDataFile; + cmdlt.Profile = new AzureProfile(subscriptionDataFile); // Act cmdlt.InvokeBeginProcessing(); @@ -101,7 +96,7 @@ public void ClearAzureProfileClearsCustomProfile() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(subscriptionDataFile); + client = new ProfileClient(new AzureProfile(subscriptionDataFile)); Assert.Equal(0, client.Profile.Subscriptions.Count); Assert.Equal(0, client.Profile.Accounts.Count); Assert.Equal(2, client.Profile.Environments.Count); //only default environments @@ -155,13 +150,13 @@ public void DeleteCorruptedTokenCache() { //setup string testFileName = @"c:\foobar\TokenCache.dat"; - ProfileClient.DataStore.WriteFile(testFileName, new byte[] { 0, 1 }); + AzureSession.DataStore.WriteFile(testFileName, new byte[] { 0, 1 }); //Act ProtectedFileTokenCache tokenCache = new ProtectedFileTokenCache(testFileName); //Assert - Assert.False(ProfileClient.DataStore.FileExists(testFileName)); + Assert.False(AzureSession.DataStore.FileExists(testFileName)); } [Fact] @@ -181,7 +176,7 @@ public void SetAzureSubscriptionAddsSubscriptionWithCertificate() cmdlt.InvokeEndProcessing(); // Verify - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; var newAccount = client.Profile.Accounts[SampleCertificate.Thumbprint]; Assert.Equal(cmdlt.SubscriptionName, newSubscription.Name); @@ -197,11 +192,11 @@ public void SetAzureSubscriptionAddsSubscriptionWithCertificate() [Fact] public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnAdd() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetEnvironment(azureEnvironment); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = Guid.NewGuid().ToString(); @@ -216,7 +211,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnAdd( cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; Assert.Equal(cmdlt.SubscriptionName, newSubscription.Name); Assert.Equal(cmdlt.Environment, newSubscription.Environment); @@ -228,7 +223,7 @@ public void SetAzureSubscriptionThrowsExceptionWithoutCertificateOnAdd() { SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetEnvironment(azureEnvironment); client.Profile.Save(); @@ -246,13 +241,13 @@ public void SetAzureSubscriptionThrowsExceptionWithoutCertificateOnAdd() [Fact] public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = azureSubscription1.Id.ToString(); @@ -265,7 +260,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet( cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; Assert.Equal(cmdlt.Environment, newSubscription.Environment); Assert.Equal(cmdlt.CurrentStorageAccountName, newSubscription.GetProperty(AzureSubscription.Property.StorageAccount)); @@ -274,13 +269,13 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet( [Fact] public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOnSet() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = azureSubscription1.Id.ToString(); @@ -293,7 +288,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOn cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; Assert.Equal(cmdlt.Environment, newSubscription.Environment); Assert.Equal(cmdlt.CurrentStorageAccountName, @@ -303,13 +298,13 @@ public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOn [Fact] public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameterOnSet() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = azureSubscription1.Id.ToString(); @@ -322,7 +317,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameter cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; Assert.Equal(cmdlt.Environment, newSubscription.Environment); Assert.Equal(cmdlt.CurrentStorageAccountName, newSubscription.GetProperty(AzureSubscription.Property.StorageAccount)); @@ -331,14 +326,15 @@ public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameter [Fact] public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); + cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = azureSubscription1.Id.ToString(); cmdlt.CurrentStorageAccountName = "NewCloudStorage"; @@ -351,7 +347,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; Assert.Equal(cmdlt.Environment, newSubscription.Environment); Assert.Equal(cmdlt.CurrentStorageAccountName, newSubscription.GetProperty(AzureSubscription.Property.StorageAccount)); @@ -360,15 +356,15 @@ public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters() [Fact] public void SetAzureSubscriptionUpdatesSubscriptionWithCertificate() { - SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); - // Setup - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetAccount(azureAccount); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetSubscription(azureSubscription1); client.Profile.Save(); + SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand(); + cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SubscriptionId = azureSubscription1.Id.ToString(); cmdlt.CurrentStorageAccountName = "NewCloudStorage"; @@ -380,7 +376,7 @@ public void SetAzureSubscriptionUpdatesSubscriptionWithCertificate() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var newSubscription = client.Profile.Subscriptions[new Guid(cmdlt.SubscriptionId)]; var newAccount = client.Profile.Accounts[SampleCertificate.Thumbprint]; var existingAccount = client.Profile.Accounts[azureAccount.Id]; @@ -403,16 +399,16 @@ public void ImportPublishSettingsFileSelectsCorrectEnvironment() ImportAzurePublishSettingsCommand cmdlt = new ImportAzurePublishSettingsCommand(); // Setup - ProfileClient.DataStore.WriteFile("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", + AzureSession.DataStore.WriteFile("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", Properties.Resources.ValidProfileChina); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var oldDataStore = FileUtilities.DataStore; - FileUtilities.DataStore = ProfileClient.DataStore; + FileUtilities.DataStore = AzureSession.DataStore; var expectedEnv = "AzureChinaCloud"; var expected = client.ImportPublishSettings("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", null); cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.ProfileClient = new ProfileClient(); + cmdlt.ProfileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); cmdlt.PublishSettingsFile = "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings"; try @@ -442,16 +438,16 @@ public void ImportPublishSettingsFileOverwritesEnvironment() ImportAzurePublishSettingsCommand cmdlt = new ImportAzurePublishSettingsCommand(); // Setup - ProfileClient.DataStore.WriteFile("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", + AzureSession.DataStore.WriteFile("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", Properties.Resources.ValidProfileChina); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var oldDataStore = FileUtilities.DataStore; - FileUtilities.DataStore = ProfileClient.DataStore; + FileUtilities.DataStore = AzureSession.DataStore; var expectedEnv = "AzureCloud"; var expected = client.ImportPublishSettings("ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings", expectedEnv); cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.ProfileClient = new ProfileClient(); + cmdlt.ProfileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); cmdlt.PublishSettingsFile = "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings"; cmdlt.Environment = expectedEnv; @@ -479,8 +475,8 @@ public void ImportPublishSettingsFileOverwritesEnvironment() [Fact] public void SelectDefaultAzureSubscriptionByNameUpdatesProfile() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); var client = SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; @@ -495,7 +491,7 @@ public void SelectDefaultAzureSubscriptionByNameUpdatesProfile() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); Assert.NotNull(client.Profile.DefaultSubscription); Assert.Equal(azureSubscription2.Id, client.Profile.DefaultSubscription.Id); } @@ -503,36 +499,34 @@ public void SelectDefaultAzureSubscriptionByNameUpdatesProfile() [Fact] public void SelectAzureSubscriptionByNameUpdatesProfile() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SetParameterSet("SelectSubscriptionByNameParameterSet"); cmdlt.SubscriptionName = azureSubscription2.Name; - Assert.Null(AzureSession.CurrentContext.Subscription); // Act cmdlt.InvokeBeginProcessing(); cmdlt.ExecuteCmdlet(); cmdlt.InvokeEndProcessing(); - + // Verify - Assert.NotNull(AzureSession.CurrentContext.Subscription); - Assert.Equal(azureSubscription2.Id, AzureSession.CurrentContext.Subscription.Id); + Assert.NotNull(cmdlt.Profile.Context.Subscription); + Assert.Equal(azureSubscription2.Id, cmdlt.Profile.Context.Subscription.Id); } [Fact] public void SelectAzureSubscriptionWithoutPassthroughDoesNotPrint() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SetParameterSet("SelectSubscriptionByNameParameterSet"); cmdlt.SubscriptionName = azureSubscription2.Name; - Assert.Null(AzureSession.CurrentContext.Subscription); // Act cmdlt.InvokeBeginProcessing(); @@ -546,15 +540,14 @@ public void SelectAzureSubscriptionWithoutPassthroughDoesNotPrint() [Fact] public void SelectAzureSubscriptionWithPassthroughPrintsSubscription() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SetParameterSet("SelectSubscriptionByNameParameterSet"); cmdlt.SubscriptionName = azureSubscription2.Name; cmdlt.PassThru = new SwitchParameter(true); - Assert.Null(AzureSession.CurrentContext.Subscription); // Act cmdlt.InvokeBeginProcessing(); @@ -569,8 +562,8 @@ public void SelectAzureSubscriptionWithPassthroughPrintsSubscription() [Fact] public void SelectDefaultAzureSubscriptionByIdAndNoDefaultUpdatesProfile() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); var client = SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; @@ -585,7 +578,7 @@ public void SelectDefaultAzureSubscriptionByIdAndNoDefaultUpdatesProfile() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); Assert.NotNull(client.Profile.DefaultSubscription); Assert.Equal(azureSubscription2.Id, client.Profile.DefaultSubscription.Id); @@ -602,59 +595,21 @@ public void SelectDefaultAzureSubscriptionByIdAndNoDefaultUpdatesProfile() cmdlt.InvokeEndProcessing(); // Verify - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); Assert.Null(client.Profile.DefaultSubscription); } - [Fact] - public void SelectAzureSubscriptionByIdAndNoCurrentUpdatesProfile() - { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); - SetupDefaultProfile(); - - // Setup - cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.SetParameterSet("SelectSubscriptionByIdParameterSet"); - cmdlt.SubscriptionId = azureSubscription2.Id.ToString(); - Assert.Null(AzureSession.CurrentContext.Subscription); - - // Act - cmdlt.InvokeBeginProcessing(); - cmdlt.ExecuteCmdlet(); - cmdlt.InvokeEndProcessing(); - - // Verify - Assert.NotNull(AzureSession.CurrentContext.Subscription); - Assert.Equal(azureSubscription2.Id, AzureSession.CurrentContext.Subscription.Id); - - cmdlt = new SelectAzureSubscriptionCommand(); - - // Setup - cmdlt.CommandRuntime = commandRuntimeMock; - cmdlt.SetParameterSet("NoCurrentSubscriptionParameterSet"); - cmdlt.NoCurrent = new SwitchParameter(true); - - // Act - cmdlt.InvokeBeginProcessing(); - cmdlt.ExecuteCmdlet(); - cmdlt.InvokeEndProcessing(); - - // Verify - Assert.Null(AzureSession.CurrentContext.Subscription); - } - [Fact] public void SelectAzureSubscriptionByInvalidIdThrowsException() { - SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); SetupDefaultProfile(); + SelectAzureSubscriptionCommand cmdlt = new SelectAzureSubscriptionCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; cmdlt.SetParameterSet("SelectSubscriptionByIdParameterSet"); string invalidGuid = Guid.NewGuid().ToString(); cmdlt.SubscriptionId = invalidGuid; - Assert.Null(AzureSession.CurrentContext.Subscription); // Act cmdlt.InvokeBeginProcessing(); @@ -665,7 +620,7 @@ public void SelectAzureSubscriptionByInvalidIdThrowsException() } catch (ArgumentException ex) { - Assert.Contains(string.Format(Microsoft.WindowsAzure.Commands.Common.Properties.Resources.InvalidSubscriptionId, invalidGuid), ex.Message); + Assert.Contains(string.Format("The subscription id {0} doesn't exist.\r\nParameter name: id", invalidGuid), ex.Message); } } @@ -680,7 +635,6 @@ public void SelectAzureSubscriptionByInvalidGuidThrowsException() cmdlt.SetParameterSet("SelectSubscriptionByIdParameterSet"); string invalidGuid = "foo"; cmdlt.SubscriptionId = invalidGuid; - Assert.Null(AzureSession.CurrentContext.Subscription); // Act cmdlt.InvokeBeginProcessing(); @@ -697,7 +651,7 @@ public void SelectAzureSubscriptionByInvalidGuidThrowsException() private ProfileClient SetupDefaultProfile() { - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetEnvironment(azureEnvironment); client.AddOrSetAccount(azureAccount); client.AddOrSetSubscription(azureSubscription1); diff --git a/src/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs b/src/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs index 6c5fa8acfa92..aea3d567dfd0 100644 --- a/src/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs +++ b/src/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common @@ -21,7 +21,7 @@ public class RemoveAzurePublishSettingsCommand { public void RemovePublishSettingsProcess(string azureSdkDirPath) { - ProfileClient.DataStore.EmptyDirectory(azureSdkDirPath); + AzureSession.DataStore.EmptyDirectory(azureSdkDirPath); } } } \ No newline at end of file diff --git a/src/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs b/src/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs index 727260cdbf2a..9e14767655db 100644 --- a/src/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs +++ b/src/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Authentication; +using Microsoft.Azure.Common.Authentication; using System; using System.Runtime.InteropServices; using System.Security; diff --git a/src/Common/Commands.Common.Test/Common/TestBase.cs b/src/Common/Commands.Common.Test/Common/TestBase.cs index 9e36cc6c2c61..eab7d2c7dfbf 100644 --- a/src/Common/Commands.Common.Test/Common/TestBase.cs +++ b/src/Common/Commands.Common.Test/Common/TestBase.cs @@ -16,10 +16,10 @@ using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { @@ -28,6 +28,8 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common /// public abstract class TestBase { + protected AzureProfile currentProfile; + public TestBase() { BaseSetup(); @@ -39,17 +41,17 @@ public TestBase() [TestInitialize] public void BaseSetup() { - if (ProfileClient.DataStore != null && !(ProfileClient.DataStore is MockDataStore)) + if (AzureSession.DataStore != null && !(AzureSession.DataStore is MockDataStore)) { - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); } - if (AzureSession.CurrentContext.Subscription == null) + currentProfile = new AzureProfile(); + + if (currentProfile.Context.Subscription == null) { var newGuid = Guid.NewGuid(); - AzureSession.SetCurrentContext( - new AzureSubscription { Id = newGuid, Name = "test", Environment = EnvironmentName.AzureCloud, Account = "test" }, - null, - new AzureAccount + currentProfile.Subscriptions[newGuid] = new AzureSubscription { Id = newGuid, Name = "test", Environment = EnvironmentName.AzureCloud, Account = "test" }; + currentProfile.Accounts["test"] = new AzureAccount { Id = "test", Type = AzureAccount.AccountType.User, @@ -57,7 +59,8 @@ public void BaseSetup() { {AzureAccount.Property.Subscriptions, newGuid.ToString()} } - }); + }; + currentProfile.DefaultSubscription = currentProfile.Subscriptions[newGuid]; } AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(); } diff --git a/src/Common/Commands.Common.Test/Common/Testing.cs b/src/Common/Commands.Common.Test/Common/Testing.cs index 0e546b0aff7a..aa441770f3d4 100644 --- a/src/Common/Commands.Common.Test/Common/Testing.cs +++ b/src/Common/Commands.Common.Test/Common/Testing.cs @@ -75,7 +75,7 @@ public static void AssertThrows(Action action, string expectedMessage) catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(T)); - Assert.AreEqual(expectedMessage, ex.Message); + Assert.AreEqual(expectedMessage, ex.Message, ex.ToString()); } } diff --git a/src/Common/Commands.Common.Test/Mocks/MockAccessToken.cs b/src/Common/Commands.Common.Test/Mocks/MockAccessToken.cs index 72037f0e2809..4acccb09d00f 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockAccessToken.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockAccessToken.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Extensions.Authentication; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/Common/Commands.Common.Test/Mocks/MockAccessTokenProvider.cs b/src/Common/Commands.Common.Test/Mocks/MockAccessTokenProvider.cs index 34bfe4adb8d6..8b14461bc714 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockAccessTokenProvider.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockAccessTokenProvider.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Security; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Extensions.Authentication; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/Common/Commands.Common.Test/Mocks/MockCertificateAuthenticationFactory.cs b/src/Common/Commands.Common.Test/Mocks/MockCertificateAuthenticationFactory.cs index 03b03e09fa52..65328c311d27 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockCertificateAuthenticationFactory.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockCertificateAuthenticationFactory.cs @@ -13,9 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using System.Security; using System.Security.Cryptography.X509Certificates; diff --git a/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs b/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs index f6f5cdbbb5fa..0d4dd8a15061 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs @@ -22,10 +22,11 @@ using Hyak.Common; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.Azure.Common; -using Microsoft.Azure.Common.Extensions.Factories; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { @@ -52,23 +53,37 @@ public TClient CreateClient(AzureContext context, AzureEnvironment.Endp return client; } - public TClient CreateClient(AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + public TClient CreateClient(AzureProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient { + throw new NotImplementedException(); + } + + public TClient CreateClient(AzureProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + if (subscription == null) + { + throw new ArgumentException(Commands.Common.Properties.Resources.InvalidDefaultSubscription); + } + + if (profile == null) + { + profile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + } + SubscriptionCloudCredentials creds = new TokenCloudCredentials(subscription.Id.ToString(), "fake_token"); if (HttpMockServer.GetCurrentMode() != HttpRecorderMode.Playback) { - ProfileClient profileClient = new ProfileClient(); - AzureContext context = new AzureContext() - { - Account = profileClient.GetAccount(subscription.Account), - Environment = profileClient.GetEnvironmentOrDefault(subscription.Environment), - Subscription = subscription - }; + ProfileClient profileClient = new ProfileClient(profile); + AzureContext context = new AzureContext( + subscription, + profileClient.GetAccount(subscription.Account), + profileClient.GetEnvironmentOrDefault(subscription.Environment) + ); creds = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(context); } - Uri endpointUri = (new ProfileClient()).Profile.Environments[subscription.Environment].GetEndpointAsUri(endpoint); + Uri endpointUri = profile.Environments[subscription.Environment].GetEndpointAsUri(endpoint); return CreateCustomClient(creds, endpointUri); } diff --git a/src/Common/Commands.Common.Test/Mocks/MockDataStore.cs b/src/Common/Commands.Common.Test/Mocks/MockDataStore.cs index 55b2f053632b..a6f72ecd94f2 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockDataStore.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockDataStore.cs @@ -19,7 +19,7 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Text.RegularExpressions; -using Microsoft.Azure.Common.Extensions.Interfaces; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/Common/Commands.Common.Test/Mocks/MockTokenAuthenticationFactory.cs b/src/Common/Commands.Common.Test/Mocks/MockTokenAuthenticationFactory.cs index a6d4523c4fe9..b53006e3abbe 100644 --- a/src/Common/Commands.Common.Test/Mocks/MockTokenAuthenticationFactory.cs +++ b/src/Common/Commands.Common.Test/Mocks/MockTokenAuthenticationFactory.cs @@ -13,9 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using System; using System.Security; @@ -62,7 +61,19 @@ public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environm account.Id = "test"; } - return TokenProvider(account, environment, tenant); + if (TokenProvider == null) + { + return new MockAccessToken() + { + AccessToken = account.Id, + LoginType = LoginType.OrgId, + UserId = account.Id + }; + } + else + { + return TokenProvider(account, environment, tenant); + } } public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context) diff --git a/src/Common/Commands.Common.Test/packages.config b/src/Common/Commands.Common.Test/packages.config index 017a7b8159e3..79a7459dd7e9 100644 --- a/src/Common/Commands.Common.Test/packages.config +++ b/src/Common/Commands.Common.Test/packages.config @@ -1,18 +1,18 @@  - - + + - + - + - + diff --git a/src/Common/Commands.Common/AzurePSCmdlet.cs b/src/Common/Commands.Common/AzurePSCmdlet.cs index abf5f1496930..a4ec8b56d41e 100644 --- a/src/Common/Commands.Common/AzurePSCmdlet.cs +++ b/src/Common/Commands.Common/AzurePSCmdlet.cs @@ -12,19 +12,23 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Properties; using System; using System.Diagnostics; +using System.IO; using System.Management.Automation; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { public abstract class AzurePSCmdlet : PSCmdlet { - private readonly RecordingTracingInterceptor httpTracingInterceptor = new RecordingTracingInterceptor(); + private readonly RecordingTracingInterceptor _httpTracingInterceptor = new RecordingTracingInterceptor(); + + [Parameter(Mandatory = false, HelpMessage = "In-memory profile.")] + public AzureProfile Profile { get; set; } static AzurePSCmdlet() { @@ -36,40 +40,66 @@ static AzurePSCmdlet() AzureSession.ClientFactory.UserAgents.Add(AzurePowerShell.UserAgentValue); } - public AzurePSCmdlet() + /// + /// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile + /// + protected override void BeginProcessing() { - DefaultProfileClient = new ProfileClient(); + InitializeProfile(); - if (AzureSession.CurrentContext.Subscription == null && - DefaultProfileClient.Profile.DefaultSubscription != null) + if (string.IsNullOrEmpty(ParameterSetName)) { - try - { - AzureSession.SetCurrentContext( - DefaultProfileClient.Profile.DefaultSubscription, - DefaultProfileClient.GetEnvironmentOrDefault( - DefaultProfileClient.Profile.DefaultSubscription.Environment), - DefaultProfileClient.GetAccountOrNull(DefaultProfileClient.Profile.DefaultSubscription.Account)); - } - catch - { - // Ignore anything at this point - } + WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithoutParameterSetLog, this.GetType().Name)); + } + else + { + WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithParameterSetLog, this.GetType().Name, ParameterSetName)); + } + + if (Profile.Context != null && Profile.Context.Account != null && Profile.Context.Account.Id != null) + { + WriteDebugWithTimestamp(string.Format("using account id '{0}'...", Profile.Context.Account.Id)); } + RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); + + base.BeginProcessing(); } - public AzureContext CurrentContext + private void InitializeProfile() { - get { return AzureSession.CurrentContext; } + // Load profile from disk + var profileFromDisk = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + if (Profile == null || + Profile.ProfilePath == profileFromDisk.ProfilePath) + { + Profile = profileFromDisk; + } } - public bool HasCurrentSubscription + /// + /// End processing. Flush messages in tracing interceptor and save profile. + /// + protected override void EndProcessing() { - get { return AzureSession.CurrentContext.Subscription != null; } + string message = string.Format(Resources.EndProcessingLog, this.GetType().Name); + WriteDebugWithTimestamp(message); + + RecordingTracingInterceptor.RemoveFromContext(_httpTracingInterceptor); + FlushMessagesFromTracingInterceptor(); + + base.EndProcessing(); } - public ProfileClient DefaultProfileClient { get; private set; } + /*public AzureContext Profile.Context + { + get { return Profile.Context; } + }*/ + + public bool HasCurrentSubscription + { + get { return Profile.Context.Subscription != null; } + } protected string CurrentPath() { @@ -207,53 +237,15 @@ protected override void ProcessRecord() } } - /// - /// Cmdlet begin process - /// - protected override void BeginProcessing() - { - if (string.IsNullOrEmpty(ParameterSetName)) - { - WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithoutParameterSetLog, this.GetType().Name)); - } - else - { - WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithParameterSetLog, this.GetType().Name, ParameterSetName)); - } - - if (CurrentContext != null && CurrentContext.Account != null && CurrentContext.Account.Id != null) - { - WriteDebugWithTimestamp(string.Format("using account id '{0}'...", CurrentContext.Account.Id)); - } - - RecordingTracingInterceptor.AddToContext(httpTracingInterceptor); - - base.BeginProcessing(); - } - private void FlushMessagesFromTracingInterceptor() { string message; - while (httpTracingInterceptor.MessageQueue.TryDequeue(out message)) + while (_httpTracingInterceptor.MessageQueue.TryDequeue(out message)) { base.WriteDebug(message); } } - /// - /// End processing - /// - protected override void EndProcessing() - { - string message = string.Format(Resources.EndProcessingLog, this.GetType().Name); - WriteDebugWithTimestamp(message); - - RecordingTracingInterceptor.RemoveFromContext(httpTracingInterceptor); - FlushMessagesFromTracingInterceptor(); - - base.EndProcessing(); - } - /// /// Asks for confirmation before executing the action. /// diff --git a/src/Common/Commands.Common/AzurePowerShell.cs b/src/Common/Commands.Common/AzurePowerShell.cs index 89eb873f080a..63648b9f3f0d 100644 --- a/src/Common/Commands.Common/AzurePowerShell.cs +++ b/src/Common/Commands.Common/AzurePowerShell.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Properties; +using Microsoft.Azure.Common.Authentication.Properties; using System; using System.IO; using System.Net.Http.Headers; diff --git a/src/Common/Commands.Common/CloudBaseCmdlet.cs b/src/Common/Commands.Common/CloudBaseCmdlet.cs index b8a8ee7a4412..9d9463a3e207 100644 --- a/src/Common/Commands.Common/CloudBaseCmdlet.cs +++ b/src/Common/Commands.Common/CloudBaseCmdlet.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using System; @@ -81,14 +81,14 @@ protected virtual void InitChannelCurrentSubscription(bool force) protected void DoInitChannelCurrentSubscription(bool force) { - if (CurrentContext.Subscription == null) + if (Profile.Context.Subscription == null) { - throw new ArgumentException(Resources.InvalidCurrentSubscription); + throw new ArgumentException(Resources.InvalidDefaultSubscription); } - if (CurrentContext.Account == null) + if (Profile.Context.Account == null) { - throw new ArgumentException(Resources.InvalidCurrentSuscriptionCertificate); + throw new ArgumentException(Resources.AccountNeedsToBeSpecified); } if (Channel == null || force) @@ -127,19 +127,19 @@ protected virtual T CreateChannel() return Channel; } - string certificateThumbprint = CurrentContext.Account.Id; - Debug.Assert(DefaultProfileClient.Profile.Accounts[certificateThumbprint].Type == AzureAccount.AccountType.Certificate); + string certificateThumbprint = Profile.Context.Account.Id; + Debug.Assert(Profile.Accounts[certificateThumbprint].Type == AzureAccount.AccountType.Certificate); return ChannelHelper.CreateServiceManagementChannel( ServiceBinding, - CurrentContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement), - ProfileClient.DataStore.GetCertificate(certificateThumbprint), + Profile.Context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement), + AzureSession.DataStore.GetCertificate(certificateThumbprint), new HttpRestMessageInspector(WriteDebug)); } protected void RetryCall(Action call) { - RetryCall(CurrentContext.Subscription.Id, call); + RetryCall(Profile.Context.Subscription.Id, call); } protected void RetryCall(Guid subsId, Action call) @@ -172,7 +172,7 @@ protected void RetryCall(Guid subsId, Action call) protected TResult RetryCall(Func call) { - return RetryCall(CurrentContext.Subscription.Id, call); + return RetryCall(Profile.Context.Subscription.Id, call); } protected TResult RetryCall(Guid subsId, Func call) diff --git a/src/Common/Commands.Common/CmdletExtensions.cs b/src/Common/Commands.Common/CmdletExtensions.cs index c1cb970e42a3..9942a85f769a 100644 --- a/src/Common/Commands.Common/CmdletExtensions.cs +++ b/src/Common/Commands.Common/CmdletExtensions.cs @@ -123,6 +123,13 @@ public static void InvokeEndProcessing(this PSCmdlet cmdlt) MethodInfo dynMethod = (typeof(PSCmdlet)).GetMethod("EndProcessing", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod.Invoke(cmdlt, null); } + public static void ExecuteWithProcessing(this AzurePSCmdlet cmdlt) + { + cmdlt.InvokeBeginProcessing(); + cmdlt.ExecuteCmdlet(); + cmdlt.InvokeEndProcessing(); + + } #endregion } diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 3a8653344463..6e4638bd7127 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -52,19 +52,19 @@ False - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll False - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -79,13 +79,13 @@ ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/Common/Commands.Common/GeneralUtilities.cs b/src/Common/Commands.Common/GeneralUtilities.cs index 776b11817439..787b18fe10a5 100644 --- a/src/Common/Commands.Common/GeneralUtilities.cs +++ b/src/Common/Commands.Common/GeneralUtilities.cs @@ -13,8 +13,7 @@ // ---------------------------------------------------------------------------------- using Hyak.Common; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Properties; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; using System; using System.Collections.Generic; @@ -52,7 +51,9 @@ private static bool TryFindCertificatesInStore(string thumbprint, public static string GetNodeModulesPath() { - return Path.Combine(FileUtilities.GetAssemblyDirectory(), Resources.NodeModulesPath); + return Path.Combine( + FileUtilities.GetAssemblyDirectory(), + Microsoft.WindowsAzure.Commands.Common.Properties.Resources.NodeModulesPath); } [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")] @@ -72,7 +73,9 @@ public static X509Certificate2 GetCertificateFromStore(string thumbprint) } else { - throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint)); + throw new ArgumentException(string.Format( + Microsoft.Azure.Common.Authentication.Properties.Resources.CertificateNotFoundInStore, + thumbprint)); } } diff --git a/src/Common/Commands.Common/HttpClientExtensions.cs b/src/Common/Commands.Common/HttpClientExtensions.cs index 1571324e132f..5f7e313644d2 100644 --- a/src/Common/Commands.Common/HttpClientExtensions.cs +++ b/src/Common/Commands.Common/HttpClientExtensions.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; using Newtonsoft.Json; using System; diff --git a/src/Common/Commands.Common/PSAzureAccount.cs b/src/Common/Commands.Common/PSAzureAccount.cs index f39fcd405d0c..c01ef746316f 100644 --- a/src/Common/Commands.Common/PSAzureAccount.cs +++ b/src/Common/Commands.Common/PSAzureAccount.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -namespace Microsoft.Azure.Common.Extensions.Models +namespace Microsoft.Azure.Common.Authentication.Models { public class PSAzureAccount { diff --git a/src/Common/Commands.Common/ProfileClientExtensions.cs b/src/Common/Commands.Common/ProfileClientExtensions.cs index 5a14b5d566c7..20b734ed808f 100644 --- a/src/Common/Commands.Common/ProfileClientExtensions.cs +++ b/src/Common/Commands.Common/ProfileClientExtensions.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/Common/Commands.Common/Properties/Resources.Designer.cs b/src/Common/Commands.Common/Properties/Resources.Designer.cs index d3fef027128f..1fceef514540 100644 --- a/src/Common/Commands.Common/Properties/Resources.Designer.cs +++ b/src/Common/Commands.Common/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.WindowsAzure.Commands.Common.Properties -{ - - +namespace Microsoft.WindowsAzure.Commands.Common.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -78,6 +78,15 @@ public static string AccountIdDoesntMatchSubscription { } } + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified { + get { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + /// /// Looks up a localized string similar to Account "{0}" has been added.. /// @@ -240,15 +249,6 @@ public static string AzureDirectory { } } - /// - /// Looks up a localized string similar to Windows Azure Powershell. - /// - public static string AzureDirectoryName { - get { - return ResourceManager.GetString("AzureDirectoryName", resourceCulture); - } - } - /// /// Looks up a localized string similar to https://manage.windowsazure.com. /// @@ -447,24 +447,6 @@ public static string CertificateImportedMessage { } } - /// - /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. - /// - public static string CertificateNotFoundInStore { - get { - return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. - /// - public static string CertificateNotFoundInStore1 { - get { - return ResourceManager.GetString("CertificateNotFoundInStore1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. /// @@ -510,15 +492,6 @@ public static string ChangeSettingsElementMessage { } } - /// - /// Looks up a localized string similar to Changing public environment is not supported.. - /// - public static string ChangingDefaultEnvironmentNotSupported { - get { - return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); - } - } - /// /// Looks up a localized string similar to Choose which publish settings file to use:. /// @@ -591,15 +564,6 @@ public static string CompleteMessage { } } - /// - /// Looks up a localized string similar to Complete. - /// - public static string CompleteMessage1 { - get { - return ResourceManager.GetString("CompleteMessage1", resourceCulture); - } - } - /// /// Looks up a localized string similar to config.json. /// @@ -627,15 +591,6 @@ public static string CreateWebsiteFailed { } } - /// - /// Looks up a localized string similar to -Credential parameter can only be used with Organization ID credentials. For more information, please refer to http://go.microsoft.com/fwlink/?linkid=331007&clcid=0x409 for more information about the difference between an organizational account and a Microsoft account.. - /// - public static string CredentialOrganizationIdMessage { - get { - return ResourceManager.GetString("CredentialOrganizationIdMessage", resourceCulture); - } - } - /// /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. /// @@ -852,15 +807,6 @@ public static string EnvironmentNameDoesntMatchSubscription { } } - /// - /// Looks up a localized string similar to The environment name '{0}' is not found.. - /// - public static string EnvironmentNotFound { - get { - return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); - } - } - /// /// Looks up a localized string similar to environments.xml. /// @@ -897,15 +843,6 @@ public static string ErrorUpdatingVirtualMachine { } } - /// - /// Looks up a localized string similar to Your Microsoft Azure credential in the Windows PowerShell session has expired. Please use Add-AzureAccount to login again.. - /// - public static string ExpiredRefreshToken { - get { - return ResourceManager.GetString("ExpiredRefreshToken", resourceCulture); - } - } - /// /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. /// @@ -987,15 +924,6 @@ public static string GlobalSettingsManager_Load_PublishSettingsNotFound { } } - /// - /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. - /// - public static string GlobalSettingsManager_Load_PublishSettingsNotFound1 { - get { - return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound1", resourceCulture); - } - } - /// /// Looks up a localized string similar to iisnode.dll. /// @@ -1041,24 +969,6 @@ public static string IISNodeVersionWarningText { } } - /// - /// Looks up a localized string similar to Illegal characters in path.. - /// - public static string IllegalPath { - get { - return ResourceManager.GetString("IllegalPath", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Illegal characters in path.. - /// - public static string IllegalPath1 { - get { - return ResourceManager.GetString("IllegalPath1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Internal Server Error. /// @@ -1077,24 +987,6 @@ public static string InvalidCacheRoleName { } } - /// - /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. - /// - public static string InvalidCertificate { - get { - return ResourceManager.GetString("InvalidCertificate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. - /// - public static string InvalidCertificate1 { - get { - return ResourceManager.GetString("InvalidCertificate1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Invalid certificate format.. /// @@ -1122,42 +1014,6 @@ public static string InvalidCountryNameMessage { } } - /// - /// Looks up a localized string similar to Credential type invalid, only handles '{0}'. - /// - public static string InvalidCredentialType { - get { - return ResourceManager.GetString("InvalidCredentialType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No current subscription has been designated. Use Select-AzureSubscription -Current <subscriptionName> to set the current subscription.. - /// - public static string InvalidCurrentSubscription { - get { - return ResourceManager.GetString("InvalidCurrentSubscription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The ID of the current subscription is invalid. Use Set-AzureSubscription to fix the subscription ID or use Select-AzureSubscription to use a different subscription.. - /// - public static string InvalidCurrentSubscriptionId { - get { - return ResourceManager.GetString("InvalidCurrentSubscriptionId", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The management certificate of the current subscription is invalid. Use Set-AzureSubscription to fix the management certificate or use Select-AzureSubscription to use a different subscription.. - /// - public static string InvalidCurrentSuscriptionCertificate { - get { - return ResourceManager.GetString("InvalidCurrentSuscriptionCertificate", resourceCulture); - } - } - /// /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. /// @@ -1185,15 +1041,6 @@ public static string InvalidDeploymentSlot { } } - /// - /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. - /// - public static string InvalidDnsName { - get { - return ResourceManager.GetString("InvalidDnsName", resourceCulture); - } - } - /// /// Looks up a localized string similar to Invalid service endpoint.. /// @@ -1203,15 +1050,6 @@ public static string InvalidEndpoint { } } - /// - /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. - /// - public static string InvalidFileExtension { - get { - return ResourceManager.GetString("InvalidFileExtension", resourceCulture); - } - } - /// /// Looks up a localized string similar to File {0} has invalid characters. /// @@ -1271,15 +1109,6 @@ public static string InvalidJobFile { } } - /// - /// Looks up a localized string similar to Cannot create instance of management client type {0}. It does not have the expected constructor.. - /// - public static string InvalidManagementClientType { - get { - return ResourceManager.GetString("InvalidManagementClientType", resourceCulture); - } - } - /// /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. /// @@ -1316,15 +1145,6 @@ public static string InvalidNullArgument { } } - /// - /// Looks up a localized string similar to {0} is invalid or empty. - /// - public static string InvalidOrEmptyArgumentMessage { - get { - return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); - } - } - /// /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. /// @@ -1370,15 +1190,6 @@ public static string InvalidPublishSettingsSchema { } } - /// - /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. - /// - public static string InvalidPublishSettingsSchema1 { - get { - return ResourceManager.GetString("InvalidPublishSettingsSchema1", resourceCulture); - } - } - /// /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. /// @@ -1451,15 +1262,6 @@ public static string InvalidServiceSettingElement { } } - /// - /// Looks up a localized string similar to You must provide valid value for {0}. - /// - public static string InvalidServiceSettingElement1 { - get { - return ResourceManager.GetString("InvalidServiceSettingElement1", resourceCulture); - } - } - /// /// Looks up a localized string similar to settings.json is invalid or doesn't exist. /// @@ -1487,15 +1289,6 @@ public static string InvalidSubscriptionId { } } - /// - /// Looks up a localized string similar to Must specify a non-null subscription name.. - /// - public static string InvalidSubscriptionName { - get { - return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); - } - } - /// /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. /// @@ -1514,15 +1307,6 @@ public static string InvalidSubscriptionsDataSchema { } } - /// - /// Looks up a localized string similar to Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials.. - /// - public static string InvalidSubscriptionState { - get { - return ResourceManager.GetString("InvalidSubscriptionState", resourceCulture); - } - } - /// /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. /// @@ -1925,24 +1709,6 @@ public static string NoHint { } } - /// - /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. - /// - public static string NoInternetConnection { - get { - return ResourceManager.GetString("NoInternetConnection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. - /// - public static string NoInternetConnection1 { - get { - return ResourceManager.GetString("NoInternetConnection1", resourceCulture); - } - } - /// /// Looks up a localized string similar to <NONE>. /// @@ -2101,24 +1867,6 @@ public static string PackageJsonFileName { } } - /// - /// Looks up a localized string similar to Path {0} doesn't exist.. - /// - public static string PathDoesNotExist { - get { - return ResourceManager.GetString("PathDoesNotExist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. - /// - public static string PathDoesNotExistForElement { - get { - return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); - } - } - /// /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. /// @@ -2377,15 +2125,6 @@ public static string PublishSettingsFileName { } } - /// - /// Looks up a localized string similar to &whr={0}. - /// - public static string PublishSettingsFileRealmFormat { - get { - return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); - } - } - /// /// Looks up a localized string similar to Publish settings imported. /// @@ -2629,24 +2368,6 @@ public static string RemoveAzureServiceWaitMessage { } } - /// - /// Looks up a localized string similar to The current subscription is being removed. Use Select-AzureSubscription <subscriptionName> to select a new current subscription.. - /// - public static string RemoveCurrentSubscription { - get { - return ResourceManager.GetString("RemoveCurrentSubscription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. - /// - public static string RemoveDefaultSubscription { - get { - return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); - } - } - /// /// Looks up a localized string similar to Removing {0} deployment for {1} service. /// @@ -2899,15 +2620,6 @@ public static string RemoveWebsiteWarning { } } - /// - /// Looks up a localized string similar to Removing public environment is not supported.. - /// - public static string RemovingDefaultEnvironmentsNotSupported { - get { - return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); - } - } - /// /// Looks up a localized string similar to Deleting namespace. /// @@ -3196,15 +2908,6 @@ public static string ServiceDefinitionFileName { } } - /// - /// Looks up a localized string similar to ServiceDefinition.csdef. - /// - public static string ServiceDefinitionFileName1 { - get { - return ResourceManager.GetString("ServiceDefinitionFileName1", resourceCulture); - } - } - /// /// Looks up a localized string similar to {0}Deploy. /// @@ -3233,16 +2936,7 @@ public static string ServiceIsInTransitionState { } /// - /// Looks up a localized string similar to Unable to retrieve service key for ServicePrincipal account {0}. Please run the Add-AzureAccount cmdlet to supply the credentials for this service principal.. - /// - public static string ServiceKeyNotFound { - get { - return ResourceManager.GetString("ServiceKeyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". /// public static string ServiceManagementClientExceptionStringFormat { get { @@ -3250,15 +2944,6 @@ public static string ServiceManagementClientExceptionStringFormat { } } - /// - /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". - /// - public static string ServiceManagementClientExceptionStringFormat1 { - get { - return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Begin Operation: {0}. /// @@ -3304,24 +2989,6 @@ public static string ServiceName { } } - /// - /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. - /// - public static string ServiceNameExists { - get { - return ResourceManager.GetString("ServiceNameExists", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. - /// - public static string ServiceNameExists1 { - get { - return ResourceManager.GetString("ServiceNameExists1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Please provide name for the hosted service. /// @@ -3376,24 +3043,6 @@ public static string ServiceSettings_ValidateStorageAccountName_InvalidName { } } - /// - /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. - /// - public static string ServiceSettings_ValidateStorageAccountName_InvalidName1 { - get { - return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to service settings. - /// - public static string ServiceSettings1 { - get { - return ResourceManager.GetString("ServiceSettings1", resourceCulture); - } - } - /// /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. /// @@ -3485,15 +3134,6 @@ public static string SettingsFileName { } } - /// - /// Looks up a localized string similar to deploymentSettings.json. - /// - public static string SettingsFileName1 { - get { - return ResourceManager.GetString("SettingsFileName1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. /// @@ -3521,15 +3161,6 @@ public static string ShouldProcessCaption { } } - /// - /// Looks up a localized string similar to Confirm. - /// - public static string ShouldProcessCaption1 { - get { - return ResourceManager.GetString("ShouldProcessCaption1", resourceCulture); - } - } - /// /// Looks up a localized string similar to Shutdown. /// @@ -3728,15 +3359,6 @@ public static string SubscriptionDataFileNotFound { } } - /// - /// Looks up a localized string similar to The subscription id {0} doesn't exist.. - /// - public static string SubscriptionIdNotFoundMessage { - get { - return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); - } - } - /// /// Looks up a localized string similar to Subscription must not be null. /// @@ -3746,15 +3368,6 @@ public static string SubscriptionMustNotBeNull { } } - /// - /// Looks up a localized string similar to The subscription name {0} doesn't exist.. - /// - public static string SubscriptionNameNotFoundMessage { - get { - return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); - } - } - /// /// Looks up a localized string similar to Suspend. /// @@ -3809,24 +3422,6 @@ public static string UnableToDecodeBase64String { } } - /// - /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. - /// - public static string UnableToPatchJson { - get { - return ResourceManager.GetString("UnableToPatchJson", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Illegal credential type. - /// - public static string UnknownCredentialType { - get { - return ResourceManager.GetString("UnknownCredentialType", resourceCulture); - } - } - /// /// Looks up a localized string similar to The provider {0} is unknown.. /// @@ -4016,15 +3611,6 @@ public static string WorkerRoleTemplateFileName { } } - /// - /// Looks up a localized string similar to (x86). - /// - public static string x86InProgramFiles { - get { - return ResourceManager.GetString("x86InProgramFiles", resourceCulture); - } - } - /// /// Looks up a localized string similar to Yes. /// diff --git a/src/Common/Commands.Common/Properties/Resources.resx b/src/Common/Commands.Common/Properties/Resources.resx index 8374c78d8185..12709dd8a7ca 100644 --- a/src/Common/Commands.Common/Properties/Resources.resx +++ b/src/Common/Commands.Common/Properties/Resources.resx @@ -168,9 +168,6 @@ Windows Azure Powershell\ - - Windows Azure Powershell - https://manage.windowsazure.com @@ -238,12 +235,6 @@ Certificate imported into CurrentUser\My\{0} - - No certificate was found in the certificate store with thumbprint {0} - - - No certificate was found in the certificate store with thumbprint {0} - Your account does not have access to the private key for certificate {0} @@ -283,9 +274,6 @@ Complete - - Complete - config.json @@ -366,9 +354,6 @@ The environment '{0}' already exists. - - The environment name '{0}' is not found. - environments.xml @@ -383,9 +368,6 @@ Error updating VirtualMachine WAPackIaaS - - Your Microsoft Azure credential in the Windows PowerShell session has expired. Please use Add-AzureAccount to login again. - Job Id {0} failed. Error: {1}, ExceptionDetails: {2} WAPackIaaS @@ -414,9 +396,6 @@ Could not find publish settings. Please run Import-AzurePublishSettingsFile. - - Could not find publish settings. Please run Import-AzurePublishSettingsFile. - iisnode.dll @@ -432,24 +411,12 @@ Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) - - Illegal characters in path. - - - Illegal characters in path. - Internal Server Error Cannot enable memcach protocol on a cache worker role {0}. - - Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings - - - Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings - Invalid certificate format. @@ -459,33 +426,15 @@ The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. - - No current subscription has been designated. Use Select-AzureSubscription -Current <subscriptionName> to set the current subscription. - - - The ID of the current subscription is invalid. Use Set-AzureSubscription to fix the subscription ID or use Select-AzureSubscription to use a different subscription. - - - The management certificate of the current subscription is invalid. Use Set-AzureSubscription to fix the management certificate or use Select-AzureSubscription to use a different subscription. - - - No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. - Deployment with {0} does not exist The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". - - "{0}" is an invalid DNS name for {1} - Invalid service endpoint. - - The provided file in {0} must be have {1} extension - File {0} has invalid characters @@ -509,9 +458,6 @@ Please follow these steps in the portal: There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. - - Cannot create instance of management client type {0}. It does not have the expected constructor. - Could not download a valid runtime manifest, Please check your internet connection and try again. @@ -524,9 +470,6 @@ Please follow these steps in the portal: Value cannot be null. Parameter name: '{0}' - - {0} is invalid or empty - The provided package path is invalid or doesn't exist @@ -542,9 +485,6 @@ Please follow these steps in the portal: The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile - - The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile - The provided role name "{0}" has invalid characters @@ -569,9 +509,6 @@ Please follow these steps in the portal: You must provide valid value for {0} - - You must provide valid value for {0} - settings.json is invalid or doesn't exist @@ -581,18 +518,12 @@ Please follow these steps in the portal: The provided subscription id {0} is not valid - - Must specify a non-null subscription name. - A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet The provided subscriptions file {0} has invalid content. - - Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials. - Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. @@ -733,12 +664,6 @@ use and privacy statement at {0} and (c) agree to sharing my contact information No, I do not agree - - Please connect to internet before executing this cmdlet - - - Please connect to internet before executing this cmdlet - No publish settings files with extension *.publishsettings are found in the directory "{0}". @@ -797,12 +722,6 @@ use and privacy statement at {0} and (c) agree to sharing my contact information package.json - - Path {0} doesn't exist. - - - Path for {0} doesn't exist in {1}. - A value for the Peer Asn has to be provided. @@ -893,9 +812,6 @@ Please follow these steps in the portal: publishSettings.xml - - &whr={0} - Publish settings imported @@ -977,12 +893,6 @@ Please follow these steps in the portal: Removing cloud service {0}... - - The current subscription is being removed. Use Select-AzureSubscription <subscriptionName> to select a new current subscription. - - - The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. - Removing {0} deployment for {1} service @@ -1142,9 +1052,6 @@ Please follow these steps in the portal: ServiceDefinition.csdef - - ServiceDefinition.csdef - {0}Deploy @@ -1169,12 +1076,6 @@ Please follow these steps in the portal: service name - - The provided service name {0} already exists, please pick another name - - - The provided service name {0} already exists, please pick another name - Please provide name for the hosted service @@ -1193,12 +1094,6 @@ Please follow these steps in the portal: The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - - The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - - - service settings - The {0} slot for cloud service {1} doesn't exist. @@ -1233,15 +1128,9 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf deploymentSettings.json - - deploymentSettings.json - Confirm - - Confirm - Shutdown WAPackIaaS @@ -1308,12 +1197,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf The subscription data file {0} does not exist. - - The subscription id {0} doesn't exist. - - - The subscription name {0} doesn't exist. - Subscription must not be null WAPackIaaS @@ -1334,9 +1217,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf Make sure you have Python 2.7 installed along with Django installed to site-packages. - - Unable to update mismatching Json structured: {0} {1}. - The provider {0} is unknown. @@ -1401,9 +1281,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf WorkerRole.xml - - (x86) - Yes @@ -1438,9 +1315,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf <NONE> - - - "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. @@ -1448,9 +1322,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. {0} is the string that is not in a valid base 64 format. - - -Credential parameter can only be used with Organization ID credentials. For more information, please refer to http://go.microsoft.com/fwlink/?linkid=331007&clcid=0x409 for more information about the difference between an organizational account and a Microsoft account. - Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". @@ -1460,18 +1331,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf Removing environment - - Removing public environment is not supported. - - - Changing public environment is not supported. - - - Credential type invalid, only handles '{0}' - - - Illegal credential type - There is no subscription associated with account {0}. @@ -1481,9 +1340,6 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf Environment name doesn't match one in subscription. - - Unable to retrieve service key for ServicePrincipal account {0}. Please run the Add-AzureAccount cmdlet to supply the credentials for this service principal. - Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? @@ -1493,4 +1349,10 @@ use and privacy statement at <url> and (c) agree to sharing my contact inf The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + \ No newline at end of file diff --git a/src/Common/Commands.Common/RecordingTracingInterceptor.cs b/src/Common/Commands.Common/RecordingTracingInterceptor.cs index 6fed19616660..b0364c18a29b 100644 --- a/src/Common/Commands.Common/RecordingTracingInterceptor.cs +++ b/src/Common/Commands.Common/RecordingTracingInterceptor.cs @@ -20,7 +20,7 @@ using System.Collections.Generic; using System.Net.Http; -namespace Microsoft.Azure.Common.Extensions.Models +namespace Microsoft.Azure.Common.Authentication.Models { public class RecordingTracingInterceptor : Hyak.Common.ICloudTracingInterceptor { diff --git a/src/Common/Commands.Common/SubscriptionCmdletBase.cs b/src/Common/Commands.Common/SubscriptionCmdletBase.cs index 91031a45c851..53c8f04ca45b 100644 --- a/src/Common/Commands.Common/SubscriptionCmdletBase.cs +++ b/src/Common/Commands.Common/SubscriptionCmdletBase.cs @@ -12,10 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; -using Microsoft.WindowsAzure.Commands.Common.Properties; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using System.Management.Automation; namespace Microsoft.WindowsAzure.Commands.Utilities.Profile { @@ -26,39 +24,32 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Profile /// public abstract class SubscriptionCmdletBase : AzurePSCmdlet { - [Parameter(Mandatory = false, HelpMessage = "[Deprecated]: File storing subscription data, if not set uses default.")] - public string SubscriptionDataFile { get; set; } - private readonly bool _saveProfile; - protected SubscriptionCmdletBase(bool saveProfile) + protected SubscriptionCmdletBase(bool saveProfile) { - this._saveProfile = saveProfile; + _saveProfile = saveProfile; } protected override void BeginProcessing() { - if (!string.IsNullOrEmpty(SubscriptionDataFile)) - { - ProfileClient = new ProfileClient(SubscriptionDataFile); - WriteWarning(Resources.SubscriptionDataFileDeprecated); - } - else - { - ProfileClient = new ProfileClient(); - } + base.BeginProcessing(); + + ProfileClient = new ProfileClient(Profile); ProfileClient.WarningLog = WriteWarning; ProfileClient.DebugLog = WriteDebug; } - protected override void EndProcessing() { + if (_saveProfile) { - ProfileClient.Profile.Save(); + Profile.Save(); } - } + base.EndProcessing(); + } public ProfileClient ProfileClient { get; set; } + } } \ No newline at end of file diff --git a/src/Common/Commands.Common/packages.config b/src/Common/Commands.Common/packages.config index 0b62e49baae0..250c461362d8 100644 --- a/src/Common/Commands.Common/packages.config +++ b/src/Common/Commands.Common/packages.config @@ -1,10 +1,10 @@  - + - + - + @@ -12,7 +12,7 @@ - + diff --git a/src/Common/Commands.Profile/Account/AddAzureAccount.cs b/src/Common/Commands.Profile/Account/AddAzureAccount.cs index d6793e6522d9..d2efb315a0d1 100644 --- a/src/Common/Commands.Profile/Account/AddAzureAccount.cs +++ b/src/Common/Commands.Profile/Account/AddAzureAccount.cs @@ -15,9 +15,8 @@ using System.Management.Automation; using System.Security; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; namespace Microsoft.WindowsAzure.Commands.Profile diff --git a/src/Common/Commands.Profile/Account/GetAzureAccount.cs b/src/Common/Commands.Profile/Account/GetAzureAccount.cs index ad63b8dc70ee..d088ebddc317 100644 --- a/src/Common/Commands.Profile/Account/GetAzureAccount.cs +++ b/src/Common/Commands.Profile/Account/GetAzureAccount.cs @@ -12,9 +12,10 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System.Collections.Generic; @@ -37,7 +38,7 @@ public GetAzureAccount() : base(false) public override void ExecuteCmdlet() { - IEnumerable accounts = DefaultProfileClient.ListAccounts(Name); + IEnumerable accounts = Profile.Accounts.Values.Where(a => Name == null || a.Id == Name); List output = new List(); foreach (AzureAccount account in accounts) { output.Add(account.ToPSAzureAccount()); diff --git a/src/Common/Commands.Profile/Account/RemoveAzureAccount.cs b/src/Common/Commands.Profile/Account/RemoveAzureAccount.cs index 5e16e019cf35..7cf8484c336e 100644 --- a/src/Common/Commands.Profile/Account/RemoveAzureAccount.cs +++ b/src/Common/Commands.Profile/Account/RemoveAzureAccount.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/Common/Commands.Profile/Commands.Profile.csproj b/src/Common/Commands.Profile/Commands.Profile.csproj index a24af090e1af..6e47c3b69b3e 100644 --- a/src/Common/Commands.Profile/Commands.Profile.csproj +++ b/src/Common/Commands.Profile/Commands.Profile.csproj @@ -48,30 +48,30 @@ - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False @@ -129,7 +129,8 @@ - + + diff --git a/src/Common/Commands.Profile/Environment/AddAzureEnvironment.cs b/src/Common/Commands.Profile/Environment/AddAzureEnvironment.cs index 1af9a1b1ff14..0ae5955a60c4 100644 --- a/src/Common/Commands.Profile/Environment/AddAzureEnvironment.cs +++ b/src/Common/Commands.Profile/Environment/AddAzureEnvironment.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System.Collections.Generic; using System; diff --git a/src/Common/Commands.Profile/Environment/GetAzureEnvironment.cs b/src/Common/Commands.Profile/Environment/GetAzureEnvironment.cs index d57fb27a1379..8411f45464b6 100644 --- a/src/Common/Commands.Profile/Environment/GetAzureEnvironment.cs +++ b/src/Common/Commands.Profile/Environment/GetAzureEnvironment.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System; diff --git a/src/Common/Commands.Profile/Environment/RemoveAzureEnvironment.cs b/src/Common/Commands.Profile/Environment/RemoveAzureEnvironment.cs index 941b0724c871..05d3c700c464 100644 --- a/src/Common/Commands.Profile/Environment/RemoveAzureEnvironment.cs +++ b/src/Common/Commands.Profile/Environment/RemoveAzureEnvironment.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/Common/Commands.Profile/Environment/SetAzureEnvironment.cs b/src/Common/Commands.Profile/Environment/SetAzureEnvironment.cs index f8f7743450fa..e43d3d7e3bba 100644 --- a/src/Common/Commands.Profile/Environment/SetAzureEnvironment.cs +++ b/src/Common/Commands.Profile/Environment/SetAzureEnvironment.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; namespace Microsoft.WindowsAzure.Commands.Profile diff --git a/src/Common/Commands.Profile/Microsoft.WindowsAzure.Commands.Profile.format.ps1xml b/src/Common/Commands.Profile/Microsoft.WindowsAzure.Commands.Profile.format.ps1xml index 3e2281e8506c..b34dcf874e8b 100644 --- a/src/Common/Commands.Profile/Microsoft.WindowsAzure.Commands.Profile.format.ps1xml +++ b/src/Common/Commands.Profile/Microsoft.WindowsAzure.Commands.Profile.format.ps1xml @@ -2,9 +2,9 @@ - Microsoft.Azure.Common.Extensions.Models.PSAzureAccount + Microsoft.Azure.Common.Authentication.Models.PSAzureAccount - Microsoft.Azure.Common.Extensions.Models.PSAzureAccount + Microsoft.Azure.Common.Authentication.Models.PSAzureAccount diff --git a/src/Common/Commands.Profile/Models/PsAzureSubscription.cs b/src/Common/Commands.Profile/Models/PsAzureSubscription.cs index 9a549b133113..8e1e6846086e 100644 --- a/src/Common/Commands.Profile/Models/PsAzureSubscription.cs +++ b/src/Common/Commands.Profile/Models/PsAzureSubscription.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/Common/Commands.Profile/Models/PsAzureSubscriptionExtended.cs b/src/Common/Commands.Profile/Models/PsAzureSubscriptionExtended.cs index c4894d9e73b9..763647ff2b26 100644 --- a/src/Common/Commands.Profile/Models/PsAzureSubscriptionExtended.cs +++ b/src/Common/Commands.Profile/Models/PsAzureSubscriptionExtended.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/Common/Commands.Profile/ProfileDoctor/ClearAzureProfile.cs b/src/Common/Commands.Profile/Profile/ClearAzureProfile.cs similarity index 97% rename from src/Common/Commands.Profile/ProfileDoctor/ClearAzureProfile.cs rename to src/Common/Commands.Profile/Profile/ClearAzureProfile.cs index a60306b008f7..076f3cf2799a 100644 --- a/src/Common/Commands.Profile/ProfileDoctor/ClearAzureProfile.cs +++ b/src/Common/Commands.Profile/Profile/ClearAzureProfile.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/Common/Commands.Profile/Profile/NewAzureProfile.cs b/src/Common/Commands.Profile/Profile/NewAzureProfile.cs new file mode 100644 index 000000000000..158c5aafb757 --- /dev/null +++ b/src/Common/Commands.Profile/Profile/NewAzureProfile.cs @@ -0,0 +1,121 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Security.Cryptography.X509Certificates; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; +using System.Security.Permissions; + +namespace Microsoft.WindowsAzure.Commands.Profile +{ + /// + /// Creates new Microsoft Azure profile. + /// + [Cmdlet(VerbsCommon.New, "AzureProfile"), OutputType(typeof(AzureProfile))] + public class NewAzureProfileCommand : AzurePSCmdlet + { + private const string CertificateParameterSet = "Certificate"; + private const string CredentialsParameterSet = "Credentials"; + private const string ServicePrincipalParameterSet = "ServicePrincipal"; + private const string AccessTokenParameterSet = "Token"; + private const string FileParameterSet = "File"; + + [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = CertificateParameterSet)] + [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = AccessTokenParameterSet)] + [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = CredentialsParameterSet)] + public AzureEnvironment Environment { get; set; } + + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = CertificateParameterSet)] + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = AccessTokenParameterSet)] + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = CredentialsParameterSet)] + public string SubscriptionId { get; set; } + + [Parameter(Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = CertificateParameterSet)] + [Parameter(Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + [Parameter(Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = AccessTokenParameterSet)] + [Parameter(Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = CredentialsParameterSet)] + public string StorageAccount { get; set; } + + [Parameter(Mandatory = true, Position = 3, ValueFromPipelineByPropertyName = true, ParameterSetName = CertificateParameterSet)] + public X509Certificate2 Certificate { get; set; } + + [Parameter(Mandatory = true, Position = 3, ValueFromPipelineByPropertyName = true, ParameterSetName = CredentialsParameterSet)] + [Parameter(Mandatory = true, Position = 3, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + public PSCredential Credential { get; set; } + + [Parameter(Mandatory = true, Position = 4, ValueFromPipelineByPropertyName = true, ParameterSetName = CredentialsParameterSet)] + [Parameter(Mandatory = true, Position = 4, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + public string Tenant { get; set; } + + [Parameter(Mandatory = true, Position = 5, ValueFromPipelineByPropertyName = true, ParameterSetName = ServicePrincipalParameterSet)] + public SwitchParameter ServicePrincipal { get; set; } + + [Parameter(Mandatory = true, Position = 3, ValueFromPipelineByPropertyName = true, ParameterSetName = AccessTokenParameterSet)] + public string AccessToken { get; set; } + + [Parameter(Mandatory = true, Position = 4, ValueFromPipelineByPropertyName = true, ParameterSetName = AccessTokenParameterSet)] + public string AccountId { get; set; } + + [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = FileParameterSet)] + public string Path { get; set; } + + [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] + public override void ExecuteCmdlet() + { + AzureProfile azureProfile = new AzureProfile(); + ProfileClient profileClient = new ProfileClient(azureProfile); + if (Environment == null) + { + Environment = AzureEnvironment.PublicEnvironments["AzureCloud"]; + } + + switch (ParameterSetName) + { + case CertificateParameterSet: + profileClient.InitializeProfile(Environment, new Guid(SubscriptionId), Certificate, + StorageAccount); + break; + case CredentialsParameterSet: + AzureAccount userAccount = new AzureAccount + { + Id = Credential.UserName, + Type = AzureAccount.AccountType.User + }; + profileClient.InitializeProfile(Environment, new Guid(SubscriptionId), userAccount, + Credential.Password, StorageAccount); + break; + case AccessTokenParameterSet: + profileClient.InitializeProfile(Environment, new Guid(SubscriptionId), AccessToken, + AccountId, StorageAccount); + break; + case ServicePrincipalParameterSet: + AzureAccount servicePrincipalAccount = new AzureAccount + { + Id = Credential.UserName, + Type = AzureAccount.AccountType.ServicePrincipal + }; + profileClient.InitializeProfile(Environment, new Guid(SubscriptionId), servicePrincipalAccount, + Credential.Password, StorageAccount); + break; + } + + WriteObject(azureProfile); + } + } +} diff --git a/src/Common/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs b/src/Common/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs index 4cea0c630855..3cb69cddae84 100644 --- a/src/Common/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs +++ b/src/Common/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs index 39670163cf34..f5824b361792 100644 --- a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs @@ -17,13 +17,13 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using Microsoft.WindowsAzure.Management; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { @@ -64,7 +64,7 @@ public override void ExecuteCmdlet() switch (ParameterSetName) { case "ByName": - WriteSubscriptions(ProfileClient.RefreshSubscriptions(AzureSession.CurrentContext.Environment) + WriteSubscriptions(ProfileClient.RefreshSubscriptions(Profile.Context.Environment) .Where(s => SubscriptionName == null || s.Name.Equals(SubscriptionName, StringComparison.InvariantCultureIgnoreCase))); break; case "ById": @@ -103,7 +103,7 @@ public void GetCurrent() // since current is strictly in-memory and we want the real // current subscription. // - if (AzureSession.CurrentContext.Subscription == null) + if (Profile.Context.Subscription == null) { WriteError(new ErrorRecord( new InvalidOperationException(Resources.InvalidSelectedSubscription), @@ -112,7 +112,7 @@ public void GetCurrent() } else { - WriteSubscriptions(AzureSession.CurrentContext.Subscription); + WriteSubscriptions(Profile.Context.Subscription); } } @@ -148,7 +148,7 @@ private PSAzureSubscription ConstructPsAzureSubscription(AzureSubscription subsc psObject.DefaultAccount = subscription.Account; psObject.Accounts = ProfileClient.Profile.Accounts.Values.Where(a => a.HasSubscription(subscription.Id)).ToArray(); psObject.IsDefault = subscription.IsPropertySet(AzureSubscription.Property.Default); - psObject.IsCurrent = AzureSession.CurrentContext.Subscription != null && AzureSession.CurrentContext.Subscription.Id == subscription.Id; + psObject.IsCurrent = Profile.Context.Subscription != null && Profile.Context.Subscription.Id == subscription.Id; psObject.CurrentStorageAccountName = subscription.GetProperty(AzureSubscription.Property.StorageAccount); psObject.TenantId = subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants).FirstOrDefault(); return psObject; @@ -156,11 +156,11 @@ private PSAzureSubscription ConstructPsAzureSubscription(AzureSubscription subsc private PSAzureSubscriptionExtended ConstructPsAzureSubscriptionExtended(AzureSubscription subscription, IClientFactory clientFactory) { - using (var client = clientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement)) + using (var client = clientFactory.CreateClient(Profile, subscription, AzureEnvironment.Endpoint.ServiceManagement)) { var response = client.Subscriptions.Get(); var environment = ProfileClient.GetEnvironmentOrDefault(subscription.Environment); - var account = DefaultProfileClient.Profile.Accounts[subscription.Account]; + var account = ProfileClient.Profile.Accounts[subscription.Account]; bool isCert = account.Type == AzureAccount.AccountType.Certificate; PSAzureSubscriptionExtended result = new PSAzureSubscriptionExtended(ConstructPsAzureSubscription(subscription)) @@ -186,7 +186,7 @@ private PSAzureSubscriptionExtended ConstructPsAzureSubscriptionExtended(AzureSu ResourceManagerEndpoint = environment.GetEndpoint(AzureEnvironment.Endpoint.ResourceManager), IsDefault = subscription.GetProperty(AzureSubscription.Property.Default) != null, Account = account, - Certificate = isCert ? ProfileClient.DataStore.GetCertificate(subscription.Account) : null, + Certificate = isCert ? AzureSession.DataStore.GetCertificate(subscription.Account) : null, CurrentStorageAccountName = subscription.GetProperty(AzureSubscription.Property.StorageAccount) }; diff --git a/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs b/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs index 1e0c6ca498b4..8b47e0c1832b 100644 --- a/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs +++ b/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs @@ -17,13 +17,13 @@ using System.Linq; using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using Microsoft.WindowsAzure.Commands.Common; using System.Diagnostics; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { @@ -54,14 +54,7 @@ public override void ExecuteCmdlet() } AzureSubscription defaultSubscription = ProfileClient.Profile.DefaultSubscription; - Debug.Assert(AzureSession.CurrentContext != null); - if (defaultSubscription != null && AzureSession.CurrentContext.Subscription == null) - { - AzureSession.SetCurrentContext( - defaultSubscription, - ProfileClient.Profile.Environments[defaultSubscription.Environment], - ProfileClient.Profile.Accounts[defaultSubscription.Account]); - } + Debug.Assert(Profile.Context != null); } private bool IsDirectory() diff --git a/src/Common/Commands.Profile/Subscription/RemoveAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/RemoveAzureSubscription.cs index e12a652d4ca1..fb4b83cd8729 100644 --- a/src/Common/Commands.Profile/Subscription/RemoveAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/RemoveAzureSubscription.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/Common/Commands.Profile/Subscription/SelectAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/SelectAzureSubscription.cs index 51b5adf693b8..36305d783b2d 100644 --- a/src/Common/Commands.Profile/Subscription/SelectAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/SelectAzureSubscription.cs @@ -15,10 +15,10 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { @@ -94,23 +94,25 @@ public override void ExecuteCmdlet() switch (ParameterSetName) { case SelectSubscriptionByNameParameterSet: - azureSubscription = ProfileClient.SetSubscriptionAsCurrent(SubscriptionName, Account); + azureSubscription = ProfileClient.SetSubscriptionAsDefault(SubscriptionName, Account); break; case SelectSubscriptionByIdParameterSet: - azureSubscription = ProfileClient.SetSubscriptionAsCurrent(SubscriptionIdAsGuid(), Account); + azureSubscription = ProfileClient.SetSubscriptionAsDefault(SubscriptionIdAsGuid(), Account); break; case SelectDefaultSubscriptionByNameParameterSet: azureSubscription = ProfileClient.SetSubscriptionAsDefault(SubscriptionName, Account); + WriteWarning("Current and Default parameters have been deprecated. Select-AzureSubscription will always update the Default Subscription."); break; case SelectDefaultSubscriptionByIdParameterSet: azureSubscription = ProfileClient.SetSubscriptionAsDefault(SubscriptionIdAsGuid(), Account); + WriteWarning("Current and Default parameters have been deprecated. Select-AzureSubscription will always update the Default Subscription."); break; case NoCurrentSubscriptionParameterSet: - AzureSession.SetCurrentContext(null, null, null); + WriteWarning("Current parameter set has been deprecated. Use Select-AzureSubscription -NoDefault instead."); break; case NoDefaultSubscriptionParameterSet: diff --git a/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs index 52a97162a980..52545c5afa31 100644 --- a/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs @@ -16,7 +16,8 @@ using System.Linq; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; @@ -106,7 +107,8 @@ public override void ExecuteCmdlet() AzureEnvironment environment = ProfileClient.GetEnvironment(Environment, ServiceEndpoint, ResourceManagerEndpoint); if (environment == null) { - environment = DefaultProfileClient.GetEnvironment(Environment, ServiceEndpoint, ResourceManagerEndpoint); + var profileClient = new ProfileClient(Profile); + environment = profileClient.GetEnvironment(Environment, ServiceEndpoint, ResourceManagerEndpoint); } if (environment == null) diff --git a/src/Common/Commands.Profile/SwitchAzureMode.cs b/src/Common/Commands.Profile/SwitchAzureMode.cs index 7d9ad67780f8..10e8392fb452 100644 --- a/src/Common/Commands.Profile/SwitchAzureMode.cs +++ b/src/Common/Commands.Profile/SwitchAzureMode.cs @@ -15,7 +15,7 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { diff --git a/src/Common/Commands.Profile/packages.config b/src/Common/Commands.Profile/packages.config index 0f2b1ec77c46..64ab34241859 100644 --- a/src/Common/Commands.Profile/packages.config +++ b/src/Common/Commands.Profile/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs b/src/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs index 12f15d9dd2c2..53491d71cb96 100644 --- a/src/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs +++ b/src/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj b/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj index 7580a909c892..980bcb3b17c7 100644 --- a/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj +++ b/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj @@ -39,26 +39,26 @@ - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll @@ -69,13 +69,13 @@ ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/Common/Commands.ScenarioTest/Common/PowerShellTest.cs b/src/Common/Commands.ScenarioTest/Common/PowerShellTest.cs index 27dc682af445..d6be6a7f8e02 100644 --- a/src/Common/Commands.ScenarioTest/Common/PowerShellTest.cs +++ b/src/Common/Commands.ScenarioTest/Common/PowerShellTest.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest.Resources; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { diff --git a/src/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs b/src/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs index 6b9faa273a0e..914cefc0ccb6 100644 --- a/src/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs +++ b/src/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs @@ -21,8 +21,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.XmlSchema; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.XmlSchema; using Hyak.Common; using Microsoft.Azure; diff --git a/src/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs b/src/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs index a8786a3ad86c..476681ca1132 100644 --- a/src/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs +++ b/src/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs @@ -22,8 +22,8 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { @@ -55,7 +55,7 @@ public AzurePowerShellCertificateTest(params string[] modules) string dummyCredentialFile = Path.Combine(Environment.CurrentDirectory, TestCredentialHelper.DefaultCredentialFile); if (!File.Exists(dummyCredentialFile)) { - ProfileClient.DataStore.WriteFile(dummyCredentialFile, Properties.Resources.RdfeTestDummy); + AzureSession.DataStore.WriteFile(dummyCredentialFile, Properties.Resources.RdfeTestDummy); } this.credentialFile = dummyCredentialFile; } @@ -65,7 +65,7 @@ public AzurePowerShellCertificateTest(params string[] modules) this.credentialFile = TestCredentialHelper.DefaultCredentialFile; this.profileFile = TestCredentialHelper.WindowsAzureProfileFile; } - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); if (Environment.GetEnvironmentVariable(outputDirKey) != null) { diff --git a/src/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs b/src/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs index c29a3c4f28ad..4bbe3c544681 100644 --- a/src/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs +++ b/src/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; using Xunit.Extensions; diff --git a/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs b/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs index 5a6c8dd425c0..d731e743012f 100644 --- a/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs +++ b/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs @@ -16,7 +16,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.CredentialTests { diff --git a/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs b/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs index a764f52988d6..7b103d5bf913 100644 --- a/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs +++ b/src/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.CredentialTests { @@ -29,7 +29,7 @@ internal class CredentialTestHelper public CredentialTestHelper() { - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); // Ignore SSL errors System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => true; } diff --git a/src/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs b/src/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs index c60721acf51f..16308717cf74 100644 --- a/src/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs +++ b/src/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs b/src/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs index 5ffbb328c31a..6dc3045cebc5 100644 --- a/src/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs +++ b/src/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs b/src/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs index 940ae28da5e3..0b4aa74d80f2 100644 --- a/src/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs +++ b/src/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Management.WebSites; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.WebsitesTests { diff --git a/src/Common/Commands.ScenarioTest/packages.config b/src/Common/Commands.ScenarioTest/packages.config index d301118ab974..d652b31ebcad 100644 --- a/src/Common/Commands.ScenarioTest/packages.config +++ b/src/Common/Commands.ScenarioTest/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj index d29351a05942..490fdb401d50 100644 --- a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj +++ b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj @@ -38,34 +38,34 @@ - ..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs b/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs index 00a1a65b9cf5..3999a573e91c 100644 --- a/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs +++ b/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs @@ -18,14 +18,15 @@ using System.Management.Automation; using System.Security.Cryptography.X509Certificates; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System.Diagnostics; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.Azure; +using System.IO; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { @@ -40,8 +41,8 @@ public class EnvironmentSetupHelper public EnvironmentSetupHelper() { - ProfileClient.DataStore = new MockDataStore(); - client = new ProfileClient(); + AzureSession.DataStore = new MockDataStore(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); // Ignore SSL errors System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => true; @@ -141,7 +142,7 @@ private void SetupAzureEnvironmentFromEnvironmentVariables(AzureModule mode) client.Profile.Subscriptions[testSubscription.Id] = testSubscription; client.Profile.Accounts[testAccount.Id] = testAccount; - client.SetSubscriptionAsCurrent(testSubscription.Name, testSubscription.Account); + client.SetSubscriptionAsDefault(testSubscription.Name, testSubscription.Account); } } diff --git a/src/Common/Commands.ScenarioTests.Common/packages.config b/src/Common/Commands.ScenarioTests.Common/packages.config index d848dcfb4bb9..49cc8a86b4e7 100644 --- a/src/Common/Commands.ScenarioTests.Common/packages.config +++ b/src/Common/Commands.ScenarioTests.Common/packages.config @@ -1,16 +1,16 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj b/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj index 38901382309c..63ec4da6a237 100644 --- a/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj +++ b/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj @@ -39,17 +39,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -64,21 +64,21 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.13.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/BatchController.cs b/src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/BatchController.cs index fb3848dee18d..781dd59dbb30 100644 --- a/src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/BatchController.cs +++ b/src/ResourceManager/Batch/Commands.Batch.Test/ScenarioTests/BatchController.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Batch; diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/packages.config b/src/ResourceManager/Batch/Commands.Batch.Test/packages.config index 8b73ff7326f8..b9f801f1e166 100644 --- a/src/ResourceManager/Batch/Commands.Batch.Test/packages.config +++ b/src/ResourceManager/Batch/Commands.Batch.Test/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/Batch/Commands.Batch/BatchClient.cs b/src/ResourceManager/Batch/Commands.Batch/BatchClient.cs index 3173556916de..65deff43bce9 100644 --- a/src/ResourceManager/Batch/Commands.Batch/BatchClient.cs +++ b/src/ResourceManager/Batch/Commands.Batch/BatchClient.cs @@ -14,8 +14,8 @@ using Hyak.Common; using Microsoft.Azure.Commands.Batch.Properties; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Batch; using Microsoft.Azure.Management.Batch.Models; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs b/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs index 9b63bdca19a8..c90a5e47d34d 100644 --- a/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs +++ b/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using Hyak.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; @@ -31,7 +31,7 @@ public BatchClient BatchClient { if (batchClient == null) { - batchClient = new BatchClient(CurrentContext); + batchClient = new BatchClient(Profile.Context); } return batchClient; } diff --git a/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj b/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj index cd547b4773cf..3fddb33df228 100644 --- a/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj +++ b/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj @@ -42,17 +42,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -62,12 +62,12 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Batch/Commands.Batch/packages.config b/src/ResourceManager/Batch/Commands.Batch/packages.config index c29bfcff95e0..338ca9a067b7 100644 --- a/src/ResourceManager/Batch/Commands.Batch/packages.config +++ b/src/ResourceManager/Batch/Commands.Batch/packages.config @@ -1,15 +1,15 @@  - - + + - + - + 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 4fe01c6605b8..1eb7b2fd2113 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj @@ -42,17 +42,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll - True + + False + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -68,23 +68,23 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.13.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll ..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs index 54c1a39cfbd8..91b3ea576f94 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.DataFactories; diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config index cecd99ae7535..7f9108e82509 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config @@ -1,20 +1,20 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 6d1f4c548ac3..5b8fc738c026 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -49,17 +49,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -75,12 +75,12 @@ ..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.2.1-preview\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryBaseCmdlet.cs b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryBaseCmdlet.cs index 4877fdf76c36..cdb52cfc0ebd 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryBaseCmdlet.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryBaseCmdlet.cs @@ -40,7 +40,7 @@ internal DataFactoryClient DataFactoryClient { if (this.dataFactoryClient == null) { - this.dataFactoryClient = new DataFactoryClient(CurrentContext); + this.dataFactoryClient = new DataFactoryClient(Profile.Context); } return this.dataFactoryClient; } diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs index d3916e93c8d1..a85b0fb1ab02 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs @@ -21,7 +21,7 @@ using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.DataFactories { diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs b/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs index 9de6c60116c6..3b81cd161286 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs @@ -15,13 +15,13 @@ using System.IO; using Microsoft.Azure.Management.DataFactories; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Commands.DataFactories.Properties; using System; using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage; using System.Net; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.DataFactories { diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config index 0e0d3318842b..1d479d5bf47b 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + 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 06b31f034efe..3b2da743b7da 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -45,37 +45,36 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Insights.0.7.0-preview\lib\net45\Microsoft.Azure.Insights.dll - - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - - - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + + False + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + + False + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False @@ -89,10 +88,6 @@ False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - - False - ..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.1\lib\net40\Microsoft.WindowsAzure.Management.dll - ..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config index 6559e76ba32e..87256352e4f3 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config @@ -1,27 +1,25 @@  - - + + + - - - - + + - + - + - \ 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 6b85adf524b3..844934c759ac 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -44,33 +44,29 @@ False - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Insights.0.7.0-preview\lib\net45\Microsoft.Azure.Insights.dll - - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - - ..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.1\lib\net40\Microsoft.WindowsAzure.Management.dll + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs index 86db7690ec29..69d3c30254e6 100644 --- a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Insights; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -39,7 +39,7 @@ public IInsightsClient InsightsClient if (this.insightsClient == null) { // The premise is that a command to establish a context (like Add-AzureAccount) has been called before this command in order to have a correct CurrentContext - this.insightsClient = AzureSession.ClientFactory.CreateClient(CurrentContext, AzureEnvironment.Endpoint.ResourceManager); + this.insightsClient = AzureSession.ClientFactory.CreateClient(Profile.Context, AzureEnvironment.Endpoint.ResourceManager); } return this.insightsClient; diff --git a/src/ResourceManager/Insights/Commands.Insights/packages.config b/src/ResourceManager/Insights/Commands.Insights/packages.config index d0ece5276843..4e2d94e68ad0 100644 --- a/src/ResourceManager/Insights/Commands.Insights/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights/packages.config @@ -1,20 +1,18 @@  - - + + + - - - + - 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 1e046ea14c34..c51b868f3c40 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj @@ -49,32 +49,32 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config index 8809447d2bc4..a0b9d60af6c9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config @@ -1,16 +1,16 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 69e3dde3333a..c85ddb7bc60f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -108,17 +108,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -133,12 +133,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs index b7da41363c81..c22fd1ef9fcd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs @@ -13,9 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Properties; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using System; using System.Linq; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs index db5d4cc5b0cb..f819deabfdda 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; using System.IO; @@ -34,7 +34,7 @@ internal IKeyVaultDataServiceClient DataServiceClient { this.dataServiceClient = new KeyVaultDataServiceClient( AzureSession.AuthenticationFactory, - AzureSession.CurrentContext, + Profile.Context, new HttpClient()); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index 1b77127cc288..779a08b88575 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -15,8 +15,8 @@ using Hyak.Common; using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.Commands.KeyVault.WebKey; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure; using System; using System.Collections.Generic; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config index 0f2b1ec77c46..64ab34241859 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config @@ -1,14 +1,14 @@  - - + + - + - + 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 28d1148eb761..8cc473641972 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj @@ -42,17 +42,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Redis.0.14.0-preview\lib\net40\Microsoft.Azure.Management.Redis.dll @@ -60,21 +60,21 @@ ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs index 7925889e9557..26af932e0df4 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Microsoft.Azure.Management.Redis; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; public abstract class RedisCacheTestsBase : IDisposable { diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config index c1656b65270d..8e8ccf64c8e1 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config @@ -1,17 +1,17 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj index 94a9159f6c79..a21b7a2ef7d0 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj @@ -47,17 +47,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -67,13 +67,13 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs index fe0241307c05..9d53a8d832cd 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs @@ -14,8 +14,8 @@ namespace Microsoft.Azure.Commands.RedisCache { - using Microsoft.Azure.Common.Extensions; - using Microsoft.Azure.Common.Extensions.Models; + using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Redis; using Microsoft.Azure.Management.Redis.Models; using Microsoft.WindowsAzure; diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheCmdletBase.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheCmdletBase.cs index 1b2dadb68f9f..d9d77b7c7ea5 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheCmdletBase.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheCmdletBase.cs @@ -29,7 +29,7 @@ public RedisCacheClient CacheClient { if (cacheClient == null) { - cacheClient = new RedisCacheClient(CurrentContext); + cacheClient = new RedisCacheClient(Profile.Context); } return cacheClient; } diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config b/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config index db728279d1a6..7b83a67a57eb 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config @@ -1,15 +1,15 @@  - - + + - + - + 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 0325d68d6f7a..6cf00749919a 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj @@ -45,17 +45,16 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -72,18 +71,18 @@ ..\..\..\packages\Microsoft.Azure.Management.Resources.2.13.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs index 03e0f5af5044..550ea4878bfd 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs @@ -37,7 +37,7 @@ using Xunit; using Xunit.Extensions; using System.Diagnostics; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Hyak.Common; namespace Microsoft.Azure.Commands.Resources.Test.Models diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs index d1cb7415a4f6..14e9e4a37021 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Management.Authorization; diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config index a84ae4e10d7d..fe869d752628 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config +++ b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj index 1866b0860e5f..650b4f15884a 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj +++ b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj @@ -49,17 +49,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -77,13 +77,13 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.13.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryBaseCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryBaseCmdlet.cs index d181789e1e3e..3ce8593341ae 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryBaseCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryBaseCmdlet.cs @@ -27,7 +27,7 @@ public ActiveDirectoryClient ActiveDirectoryClient { if (activeDirectoryClient == null) { - activeDirectoryClient = new ActiveDirectoryClient(CurrentContext); + activeDirectoryClient = new ActiveDirectoryClient(Profile.Context); } return activeDirectoryClient; diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs index 17730f3f695f..979c90f584c9 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs @@ -12,13 +12,10 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Graph.RBAC.Models; -using Microsoft.WindowsAzure; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions.Models; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs index abfa4fefdb75..52058b30af38 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs @@ -16,13 +16,13 @@ using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Authorization.Models; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; using System.Collections.Generic; using System.Linq; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Resources.Models.Authorization { diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs index d1946901f9b6..81d0a72094c7 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs @@ -26,11 +26,11 @@ using Microsoft.Azure.Gallery.Models; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Hyak.Common; using Microsoft.Azure.Common.OData; diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs index 68228bb5b593..37fa397cb582 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs @@ -24,7 +24,7 @@ using Microsoft.Azure.Management.Resources.Models; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; @@ -32,7 +32,7 @@ using Microsoft.Azure.Management.Authorization.Models; using Microsoft.Azure.Commands.Resources.Models.Authorization; using System.Diagnostics; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Hyak.Common; namespace Microsoft.Azure.Commands.Resources.Models diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs index bed68542d78a..07585cd05981 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Resources.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Hyak.Common; namespace Microsoft.Azure.Commands.Resources diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs index f290bc29771a..9e1f3721ecc8 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs @@ -13,7 +13,10 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Resources.Models.Authorization; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.IO; namespace Microsoft.Azure.Commands.Resources.Models { @@ -31,7 +34,7 @@ public ResourcesClient ResourcesClient { if (resourcesClient == null) { - resourcesClient = new ResourcesClient(CurrentContext) + resourcesClient = new ResourcesClient(Profile.Context) { VerboseLogger = WriteVerboseWithTimestamp, ErrorLogger = WriteErrorWithTimestamp, @@ -50,7 +53,12 @@ public GalleryTemplatesClient GalleryTemplatesClient { if (galleryTemplatesClient == null) { - galleryTemplatesClient = new GalleryTemplatesClient(CurrentContext); + if(Profile == null) + { + Profile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + } + + galleryTemplatesClient = new GalleryTemplatesClient(Profile.Context); } return galleryTemplatesClient; } @@ -64,7 +72,7 @@ public AuthorizationClient PoliciesClient { if (policiesClient == null) { - policiesClient = new AuthorizationClient(CurrentContext); + policiesClient = new AuthorizationClient(Profile.Context); } return policiesClient; } diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs index 1d8f98b411f2..f93ed1a12ae2 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs @@ -25,7 +25,7 @@ using Newtonsoft.Json; using Microsoft.Azure.Commands.Resources.Models.Authorization; using Microsoft.Azure.Management.Authorization.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Resources.Models { diff --git a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs index 89285126a0f3..32b776dcc361 100644 --- a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs @@ -210,7 +210,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName, ResourceName = ResourceName, ResourceType = ResourceType, - Subscription = string.IsNullOrEmpty(ResourceGroupName) ? null : CurrentContext.Subscription.Id.ToString() + Subscription = string.IsNullOrEmpty(ResourceGroupName) ? null : Profile.Context.Subscription.Id.ToString() } }; diff --git a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs index ebceb5d7a2f0..6621b8aa3ca2 100644 --- a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs @@ -159,7 +159,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName, ResourceName = ResourceName, ResourceType = ResourceType, - Subscription = CurrentContext.Subscription.Id.ToString(), + Subscription = Profile.Context.Subscription.Id.ToString(), } }; diff --git a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/RemoveAzureRoleAssignmentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/RemoveAzureRoleAssignmentCommand.cs index 4bd28130aec6..4b74ca69472b 100644 --- a/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/RemoveAzureRoleAssignmentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/RoleAssignments/RemoveAzureRoleAssignmentCommand.cs @@ -168,7 +168,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName, ResourceName = ResourceName, ResourceType = ResourceType, - Subscription = CurrentContext.Subscription.Id.ToString() + Subscription = Profile.Context.Subscription.Id.ToString() } }; diff --git a/src/ResourceManager/Resources/Commands.Resources/packages.config b/src/ResourceManager/Resources/Commands.Resources/packages.config index ce2dd4e792fd..870aabcd7aa2 100644 --- a/src/ResourceManager/Resources/Commands.Resources/packages.config +++ b/src/ResourceManager/Resources/Commands.Resources/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + 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 7df915826240..41bd49f76a47 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj +++ b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj @@ -43,17 +43,16 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll - True + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -65,18 +64,18 @@ ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs index f36e67e07d08..82e03b9b72cd 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.ScenarioTest.SqlTests { diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config index 9b6a2f4216c5..09999bb53849 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config @@ -1,18 +1,18 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index 9d6cbc5a9735..1ee2c2fa5f66 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -89,19 +89,19 @@ False - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -120,12 +120,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SqlDatabaseSecurityCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SqlDatabaseSecurityCmdletBase.cs index e4e0314b69c8..0a627ad138bc 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SqlDatabaseSecurityCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SqlDatabaseSecurityCmdletBase.cs @@ -73,7 +73,7 @@ protected virtual void SendPolicy(AuditingPolicy policy) { } /// public override void ExecuteCmdlet() { - PolicyHandler = new SqlClient(CurrentContext.Subscription); + PolicyHandler = new SqlClient(Profile, Profile.Context.Subscription); AuditingPolicy policy = this.GetPolicy(); this.UpdatePolicy(policy); this.SendPolicy(policy); diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs index cfd90d3c7c12..7dc75c742c2b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs @@ -14,8 +14,8 @@ using Microsoft.Azure.Commands.Sql.Security.Model; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using Microsoft.Azure.Management.Sql; @@ -45,9 +45,12 @@ public class EndpointsCommunicator private static AzureSubscription Subscription {get ; set; } private static ResourceManagementClient ResourcesClient { get; set; } + + private AzureProfile Profile { get; set; } - public EndpointsCommunicator(AzureSubscription subscription) + public EndpointsCommunicator(AzureProfile profile, AzureSubscription subscription) { + Profile = profile; if (subscription != Subscription) { Subscription = subscription; @@ -149,7 +152,7 @@ public void SetServerSecurityPolicy(string resourceGroupName, string serverName, public string GetStorageResourceGroup(string storageAccountName) { - ResourceManagementClient resourcesClient = GetCurrentResourcesClient(); + ResourceManagementClient resourcesClient = GetCurrentResourcesClient(Profile); ResourceListResult res = resourcesClient.Resources.List(new ResourceListParameters { @@ -181,11 +184,11 @@ public string GetStorageResourceGroup(string storageAccountName) /// /// Gets the storage table endpoint the given storage account /// - public string GetStorageTableEndpoint(string storageAccountName) + public string GetStorageTableEndpoint(AzureProfile profile, string storageAccountName) { try { - List endpoints = new List(GetCurrentStorageClient().StorageAccounts.Get(storageAccountName).StorageAccount.Properties.Endpoints); + List endpoints = new List(GetCurrentStorageClient(profile).StorageAccounts.Get(storageAccountName).StorageAccount.Properties.Endpoints); return endpoints.Find(u => u.AbsoluteUri.Contains(".table.")).AbsoluteUri; } catch @@ -194,17 +197,17 @@ public string GetStorageTableEndpoint(string storageAccountName) } } - private StorageManagementClient GetCurrentStorageClient() + private StorageManagementClient GetCurrentStorageClient(AzureProfile profile) { if(StorageClient == null) - StorageClient = AzureSession.ClientFactory.CreateClient(Subscription, AzureEnvironment.Endpoint.ServiceManagement); + StorageClient = AzureSession.ClientFactory.CreateClient(profile, Subscription, AzureEnvironment.Endpoint.ServiceManagement); return StorageClient; } - private ResourceManagementClient GetCurrentResourcesClient() + private ResourceManagementClient GetCurrentResourcesClient(AzureProfile profile) { if (ResourcesClient == null) - ResourcesClient = AzureSession.ClientFactory.CreateClient(Subscription, AzureEnvironment.Endpoint.ResourceManager); + ResourcesClient = AzureSession.ClientFactory.CreateClient(profile, Subscription, AzureEnvironment.Endpoint.ResourceManager); return ResourcesClient; } @@ -218,7 +221,7 @@ private SqlManagementClient GetCurrentSqlClient(String clientRequestId) // Get the SQL management client for the current subscription if (SqlClient == null) { - SqlClient = AzureSession.ClientFactory.CreateClient(Subscription, AzureEnvironment.Endpoint.ResourceManager); + SqlClient = AzureSession.ClientFactory.CreateClient(Profile, Subscription, AzureEnvironment.Endpoint.ResourceManager); SqlClient.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, Util.GenerateTracingId()); } SqlClient.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName); diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs index 377978ed9ed3..65a4575a4e47 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Sql.Security.Model; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.Sql.Security.Services { /// - /// The SqlClient class is resposible for the mapping of data between two models: + /// The SqlClient class is responsible for the mapping of data between two models: /// The communication model as defined by the endpoint APIs and the cmdlet model that is defined by the /// AuditingPolicy class. This class knows how to wrap a policy in its communication model and return /// a policy in its cmdlet model and vice versa (i.e., unwrapping). @@ -32,28 +32,31 @@ public class SqlClient { private AzureSubscription Subscription { get; set; } + private AzureProfile Profile { get; set; } + private EndpointsCommunicator Communicator { get; set; } - // cacheing the fetched properties to prevent constly network interaction in cases it is not needed + // Caching the fetched properties to prevent costly network interaction in cases it is not needed private DatabaseSecurityPolicyProperties FetchedProperties; // In cases when storage is not needed and not provided, theres's no need to perform storage related network interaction that may fail public bool IgnoreStorage { get; set; } - public SqlClient(AzureSubscription subscription) + public SqlClient(AzureProfile profile, AzureSubscription subscription) { + Profile = profile; Subscription = subscription; - Communicator = new EndpointsCommunicator(subscription); + Communicator = new EndpointsCommunicator(profile, subscription); IgnoreStorage = false; } /// /// Returns the storage account name of the given database server /// - /// The name of the resouce group to which the server belongs + /// The name of the resource group to which the server belongs /// The server's name /// The Id to use in the request - /// The name of the storage accunt, null if it doesn't exist + /// The name of the storage account, null if it doesn't exist public string GetServerStorageAccount(string resourceGroupName, string serverName, string requestId) { return Communicator.GetServerSecurityPolicy(resourceGroupName, serverName, requestId).Properties.StorageAccountName; @@ -258,7 +261,7 @@ private void UpdateStorage(AuditingPolicy policy, DatabaseSecurityPolicyProperti throw new Exception(string.Format(Microsoft.Azure.Commands.Sql.Properties.Resources.NoStorageAccountWhenConfiguringAuditingPolicy)); } - // no need to do time consuming http inteaction to fetch these properties if the storage account was not changed + // no need to do time consuming http interaction to fetch these properties if the storage account was not changed if (properties.StorageAccountName == this.FetchedProperties.StorageAccountName) { properties.StorageAccountResourceGroupName = this.FetchedProperties.StorageAccountResourceGroupName; @@ -269,7 +272,7 @@ private void UpdateStorage(AuditingPolicy policy, DatabaseSecurityPolicyProperti { properties.StorageAccountSubscriptionId = Subscription.Id.ToString(); properties.StorageAccountResourceGroupName = Communicator.GetStorageResourceGroup(properties.StorageAccountName); - properties.StorageTableEndpoint = Communicator.GetStorageTableEndpoint(properties.StorageAccountName); + properties.StorageTableEndpoint = Communicator.GetStorageTableEndpoint(Profile, properties.StorageAccountName); } if (!IgnoreStorage) diff --git a/src/ResourceManager/Sql/Commands.Sql/packages.config b/src/ResourceManager/Sql/Commands.Sql/packages.config index 09e3bde991b1..2ac915e7ced2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -12,7 +12,7 @@ - + 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 0c2cde5eb67f..6c1ebb26c3b4 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -40,17 +40,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -66,20 +66,20 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.13.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs index e2f357412b54..4ec03b1c5c87 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config index 2f6bd6e78138..1f9142b689ef 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index 09e55466fb89..ecaa12c30168 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -49,17 +49,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -69,12 +69,12 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs index 8861ac9e5909..045121b801f7 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs @@ -15,8 +15,8 @@ using System.IO; using Microsoft.Azure.Management.StreamAnalytics; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.StreamAnalytics.Models { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs index d120a9543c23..0fd25ac2e2ca 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs @@ -35,7 +35,7 @@ internal StreamAnalyticsClient StreamAnalyticsClient { if (this.streamAnalyticsClient == null) { - this.streamAnalyticsClient = new StreamAnalyticsClient(CurrentContext); + this.streamAnalyticsClient = new StreamAnalyticsClient(Profile.Context); } return this.streamAnalyticsClient; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs index c95d5349aaa7..df745c2a5e7d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs @@ -20,7 +20,7 @@ using Microsoft.Azure.Commands.StreamAnalytics.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.StreamAnalytics { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config index fc1aec7e7eec..489c8750fc44 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -1,15 +1,15 @@  - - + + - + - + diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index 61c82ffd2c07..6b83a0361b05 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -49,29 +49,29 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ResourceManager/Tags/Commands.Tags/Model/TagBaseCmdlet.cs b/src/ResourceManager/Tags/Commands.Tags/Model/TagBaseCmdlet.cs index 87adae564266..c5311c1b5b17 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Model/TagBaseCmdlet.cs +++ b/src/ResourceManager/Tags/Commands.Tags/Model/TagBaseCmdlet.cs @@ -26,7 +26,7 @@ public TagsClient TagsClient { if (tagsClient == null) { - tagsClient = new TagsClient(CurrentContext.Subscription) + tagsClient = new TagsClient(Profile, Profile.Context.Subscription) { VerboseLogger = WriteVerboseWithTimestamp, ErrorLogger = WriteErrorWithTimestamp diff --git a/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs b/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs index 135981ca718b..5a9dd56d3c6b 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs +++ b/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs @@ -19,9 +19,9 @@ using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Tags.Model { @@ -39,8 +39,8 @@ public class TagsClient /// Creates new TagsClient /// /// Subscription containing resources to manipulate - public TagsClient(AzureSubscription subscription) - : this(AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ResourceManager)) + public TagsClient(AzureProfile profile, AzureSubscription subscription) + : this(AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ResourceManager)) { } diff --git a/src/ResourceManager/Tags/Commands.Tags/packages.config b/src/ResourceManager/Tags/Commands.Tags/packages.config index 0f2b1ec77c46..64ab34241859 100644 --- a/src/ResourceManager/Tags/Commands.Tags/packages.config +++ b/src/ResourceManager/Tags/Commands.Tags/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj b/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj index f837e2b26dec..8401a9954755 100644 --- a/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj +++ b/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj @@ -48,27 +48,27 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config index 8416e5600f21..0616e5657ee9 100644 --- a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config +++ b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs index 8c188f0e8abd..da8907bcf105 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs @@ -47,7 +47,7 @@ public IAutomationClient AutomationClient { get { - return this.automationClient = this.automationClient ?? new AutomationClient(CurrentContext.Subscription); + return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription); } set diff --git a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs index b66f5b301398..729c932b33e5 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs @@ -40,7 +40,7 @@ public IAutomationClient AutomationClient { get { - return this.automationClient = this.automationClient ?? new AutomationClient(CurrentContext.Subscription); + return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription); } set diff --git a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs index 613f7006d92d..21b4f00f8705 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs @@ -40,7 +40,8 @@ public IAutomationClient AutomationClient { get { - return this.automationClient = this.automationClient ?? new AutomationClient(CurrentContext.Subscription); + return this.automationClient = this.automationClient ?? new AutomationClient(Profile, + Profile.Context.Subscription); } set diff --git a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs index 6d6007b56e64..4d63614e3f99 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs @@ -42,7 +42,8 @@ public IAutomationClient AutomationClient { get { - return this.automationClient = this.automationClient ?? new AutomationClient(CurrentContext.Subscription); + return this.automationClient = this.automationClient ?? new AutomationClient(Profile, + Profile.Context.Subscription); } set diff --git a/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj index 2c50e5a289f4..d20f67aedfea 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj +++ b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj @@ -53,28 +53,28 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs index 587497bfb501..d54234fadff1 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs @@ -26,6 +26,7 @@ using Microsoft.WindowsAzure.Management.Automation; using Microsoft.WindowsAzure.Management.Automation.Models; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Common.Authentication.Models; using Newtonsoft.Json; using Runbook = Microsoft.Azure.Commands.Automation.Model.Runbook; @@ -42,8 +43,7 @@ namespace Microsoft.Azure.Commands.Automation.Common { using AutomationManagement = WindowsAzure.Management.Automation; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; @@ -56,10 +56,9 @@ public AutomationClient() { } - public AutomationClient(AzureSubscription subscription) + public AutomationClient(AzureProfile profile, AzureSubscription subscription) : this(subscription, - AzureSession.ClientFactory.CreateClient(subscription, - AzureEnvironment.Endpoint.ServiceManagement)) + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement)) { } diff --git a/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs b/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs index 6f36e485a121..0ae57197d827 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs @@ -17,7 +17,7 @@ using System.Collections.Generic; using System.Security; using Microsoft.Azure.Commands.Automation.Model; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Automation.Common { diff --git a/src/ServiceManagement/Automation/Commands.Automation/packages.config b/src/ServiceManagement/Automation/Commands.Automation/packages.config index a87b8713c6d8..2d4d87a3acfd 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/packages.config +++ b/src/ServiceManagement/Automation/Commands.Automation/packages.config @@ -1,15 +1,15 @@  - - + + - + - + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/Commands.ServiceManagement.Extensions.Test.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/Commands.ServiceManagement.Extensions.Test.csproj index 7e801c7579b8..8727aabef743 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/Commands.ServiceManagement.Extensions.Test.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/Commands.ServiceManagement.Extensions.Test.csproj @@ -41,26 +41,27 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config index 0f2b1ec77c46..64ab34241859 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj index 15f23db23c94..1acccd22f8bd 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj @@ -60,17 +60,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -85,12 +85,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config index 7d44e82372d2..bc73c7ceb4eb 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj index 44294d00057c..45e0d2d39af5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj @@ -60,17 +60,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -85,12 +85,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config index 52c05c11e685..f7728287df79 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj index 2d2f7b7010f9..c062815f6df4 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj @@ -54,16 +54,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -77,13 +78,13 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs index 729b780d0aa6..e7b98b52ff54 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs index 1876fe516458..c817e930b28f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ExtensionTests/AzureVMAccessExtensionTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ExtensionTests/AzureVMAccessExtensionTests.cs index f426f256652c..4914e0e25908 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ExtensionTests/AzureVMAccessExtensionTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ExtensionTests/AzureVMAccessExtensionTests.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ExtensionTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index a65632d78d6d..1ce5f524ca9f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -25,7 +25,7 @@ using System.Threading; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs index 9915405849b8..3ea2082086b3 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs index f0f5e9982c48..8f8da078a683 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Sync.Download; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs index 78114f61c852..d6e0f4d1bb9b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs @@ -28,7 +28,7 @@ using System.Xml; using System.Xml.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index d5bb969f147f..3a1be186471e 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -22,7 +22,7 @@ using System.Security.Cryptography.X509Certificates; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs index ac566b598950..ade26545ec4b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs @@ -20,7 +20,7 @@ using System.Threading; using System.Xml.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.Properties; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config index 920cfaa438d7..45b09325d3fd 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj index 7ec538ea5623..a61f90f7b3b7 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj @@ -62,17 +62,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -87,12 +87,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs index 597f18fb8096..a24bfa9c41d6 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs @@ -78,7 +78,7 @@ protected void ValidateService() { string serviceName; ServiceSettings settings = CommonUtilities.GetDefaultSettings(CommonUtilities.TryGetServiceRootPath(CurrentPath()), - ServiceName, null, null, null, null, CurrentContext.Subscription.Id.ToString(), out serviceName); + ServiceName, null, null, null, null, Profile.Context.Subscription.Id.ToString(), out serviceName); if (string.IsNullOrEmpty(serviceName)) { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs index 48cd05446b6a..c6dc159c042f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs @@ -40,7 +40,7 @@ public class ExtensionManager public ExtensionManager(ServiceManagementBaseCmdlet cmdlet, string serviceName) { - if (cmdlet == null || cmdlet.CurrentContext.Subscription == null) + if (cmdlet == null || cmdlet.Profile.Context.Subscription == null) { throw new ArgumentNullException("cmdlet"); } @@ -51,7 +51,7 @@ public ExtensionManager(ServiceManagementBaseCmdlet cmdlet, string serviceName) } Cmdlet = cmdlet; - SubscriptionId = cmdlet.CurrentContext.Subscription.Id.ToString(); + SubscriptionId = cmdlet.Profile.Context.Subscription.Id.ToString(); ServiceName = serviceName; } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs index 18ccb01da7e9..3d168eb176dd 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs @@ -16,7 +16,7 @@ using System; using System.Management.Automation; using System.Net; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; @@ -113,7 +113,7 @@ public virtual void NewPaaSDeploymentProcess() AssertNoPersistenVmRoleExistsInDeployment(PVM.DeploymentSlotType.Production); AssertNoPersistenVmRoleExistsInDeployment(PVM.DeploymentSlotType.Staging); - var storageName = CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + var storageName = Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); Uri packageUrl; if (this.Package.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs index fa2b277cbc8e..7d34c6d4dee8 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs @@ -15,7 +15,7 @@ using System; using System.Management.Automation; using System.Net; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; @@ -189,7 +189,7 @@ public void ExecuteCommand() if (string.Compare(ParameterSetName, "Upgrade", StringComparison.OrdinalIgnoreCase) == 0) { bool removePackage = false; - var storageName = CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + var storageName = Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); Uri packageUrl = null; if (Package.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs index 17abeb97d913..0ca4f5dc3a39 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs @@ -19,10 +19,10 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS { @@ -166,7 +166,7 @@ protected Collection GetDataDisks() protected void ValidateParameters() { - var currentSubscription = AzureSession.CurrentContext.Subscription; + var currentSubscription = Profile.Context.Subscription; if ((currentSubscription == null || currentSubscription.GetProperty(AzureSubscription.Property.StorageAccount) == null) && this.MediaLocation == null && string.Compare(this.ParameterSetName, "CreateNew", StringComparison.OrdinalIgnoreCase) == 0) { throw new ArgumentException(Resources.MediaLocationOrDefaultStorageAccountMustBeSpecified); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs index 1b139bd0242f..c1689e70d382 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs @@ -21,7 +21,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs index c39ca7ba484b..04945834e219 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs @@ -16,14 +16,14 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Management.Storage; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions @@ -179,7 +179,7 @@ protected override void ValidateParameters() if (string.Equals(this.ParameterSetName, SetCustomScriptExtensionByContainerBlobsParamSetName)) { this.StorageEndpointSuffix = string.IsNullOrEmpty(this.StorageEndpointSuffix) ? - AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix; + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix; var sName = string.IsNullOrEmpty(this.StorageAccountName) ? GetStorageName() : this.StorageAccountName; var sKey = string.IsNullOrEmpty(this.StorageAccountKey) ? GetStorageKey(sName) : this.StorageAccountKey; @@ -204,7 +204,7 @@ protected override void ValidateParameters() protected string GetStorageName() { - return CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + return Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); } protected string GetStorageKey(string storageName) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs index f7af774ca2f4..19d858ccc91f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs index e79fd87c7d8f..f2f1c14da975 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs @@ -15,7 +15,7 @@ using System; using System.Globalization; using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -40,7 +40,7 @@ public static StorageCredentials GetStorageCredentials(this ServiceManagementBas } else { - var storageAccountName = cmdlet.CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + var storageAccountName = cmdlet.Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); if (!string.IsNullOrEmpty(storageAccountName)) { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs index f4cdcacf6e3b..4844e883dc90 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs index 441282b2ab56..43173452b9df 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs @@ -19,7 +19,7 @@ using Microsoft.Azure.Commands.Network.NetworkSecurityGroup.Model; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS { @@ -48,7 +48,7 @@ protected override void ProcessRecord() else { - var networkClient = new NetworkClient(AzureSession.CurrentContext.Subscription, CommandRuntime); + var networkClient = new NetworkClient(Profile, Profile.Context.Subscription, CommandRuntime); INetworkSecurityGroup networkSecurityGroup = networkClient.GetNetworkSecurityGroup(networkSecurityGroupName, Detailed); WriteObject(networkSecurityGroup, true); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs index 89547a2adc39..820076ba1aef 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs @@ -21,7 +21,7 @@ using System.Net; using System.Security.Cryptography.X509Certificates; using AutoMapper; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions; @@ -171,11 +171,11 @@ public class NewQuickVM : IaaSDeploymentManagementCmdletBase public void NewAzureVMProcess() { - AzureSubscription currentSubscription = CurrentContext.Subscription; + AzureSubscription currentSubscription = Profile.Context.Subscription; CloudStorageAccount currentStorage = null; try { - currentStorage = currentSubscription.GetCloudStorageAccount(); + currentStorage = currentSubscription.GetCloudStorageAccount(Profile); } catch (Exception ex) // couldn't access { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs index cea2e5f40d24..f4a4d4f297c5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs @@ -18,7 +18,7 @@ using System.Management.Automation; using System.Net; using AutoMapper; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -157,11 +157,11 @@ public string ReservedIPName public void NewAzureVMProcess() { - AzureSubscription currentSubscription = CurrentContext.Subscription; + AzureSubscription currentSubscription = Profile.Context.Subscription; CloudStorageAccount currentStorage = null; try { - currentStorage = currentSubscription.GetCloudStorageAccount(); + currentStorage = currentSubscription.GetCloudStorageAccount(Profile); } catch (Exception ex) // couldn't access { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs index fb08778cb8ef..ded3f7ab2bcc 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs @@ -16,7 +16,7 @@ using System; using System.Collections.ObjectModel; using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -132,7 +132,7 @@ protected override void ProcessRecord() protected void ValidateParameters() { - AzureSubscription currentSubscription = CurrentContext.Subscription; + AzureSubscription currentSubscription = Profile.Context.Subscription; if ((currentSubscription == null || string.IsNullOrEmpty(currentSubscription.GetProperty(AzureSubscription.Property.StorageAccount))) && string.IsNullOrEmpty(MediaLocation)) { throw new ArgumentException(Resources.MustSpecifyMediaLocationOrHaveCurrentStorageAccount); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs index de7a15577691..ac18a9524c38 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Management.Automation; using AutoMapper; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -54,7 +54,7 @@ internal void ExecuteCommandNewSM() base.ExecuteCommand(); - AzureSubscription currentSubscription = CurrentContext.Subscription; + AzureSubscription currentSubscription = Profile.Context.Subscription; if (CurrentDeploymentNewSM == null) { throw new ApplicationException(String.Format(Resources.CouldNotFindDeployment, ServiceName, Model.DeploymentSlotType.Production)); @@ -65,7 +65,7 @@ internal void ExecuteCommandNewSM() { if (datadisk.MediaLink == null && string.IsNullOrEmpty(datadisk.DiskName)) { - CloudStorageAccount currentStorage = currentSubscription.GetCloudStorageAccount(); + CloudStorageAccount currentStorage = currentSubscription.GetCloudStorageAccount(Profile); if (currentStorage == null) { throw new ArgumentException(Resources.CurrentStorageAccountIsNotAccessible); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/AddAzureVhdCommand.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/AddAzureVhdCommand.cs index 959d92f44c4b..a2aa33e23440 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/AddAzureVhdCommand.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/AddAzureVhdCommand.cs @@ -120,7 +120,7 @@ private StorageCredentialsFactory CreateStorageCredentialsFactory() StorageCredentialsFactory storageCredentialsFactory; if (StorageCredentialsFactory.IsChannelRequired(Destination)) { - storageCredentialsFactory = new StorageCredentialsFactory(this.StorageClient, this.CurrentContext.Subscription); + storageCredentialsFactory = new StorageCredentialsFactory(this.StorageClient, this.Profile.Context.Subscription); } else { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs index c12a470e24ab..bab5c364df06 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Sync.Download; using Microsoft.WindowsAzure.Management.Storage; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config index 52c05c11e685..f7728287df79 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj index 02b1728d8d53..00cdc00fc2af 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj @@ -42,28 +42,28 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteBaseCmdlet.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteBaseCmdlet.cs index 362ffdf80bd5..9d2b1026ea91 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteBaseCmdlet.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteBaseCmdlet.cs @@ -26,7 +26,7 @@ public ExpressRouteClient ExpressRouteClient { if (expressRouteClient == null) { - expressRouteClient = new ExpressRouteClient(CurrentContext.Subscription); + expressRouteClient = new ExpressRouteClient(Profile, Profile.Context.Subscription); } return expressRouteClient; } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs index 22a67f9b9ed4..25181cc9d77d 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Common; namespace Microsoft.WindowsAzure.Commands.ExpressRoute @@ -25,8 +25,8 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute using System.Collections.Generic; using System.Net; using Utilities.Common; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; @@ -34,17 +34,17 @@ public class ExpressRouteClient { public ExpressRouteManagementClient Client { get; internal set; } - private static ClientType CreateClient(AzureSubscription subscription) where ClientType : ServiceClient + private static ClientType CreateClient(AzureProfile profile, AzureSubscription subscription) where ClientType : ServiceClient { - return AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); } /// /// Creates new ExpressRouteClient /// /// Subscription containing websites to manipulate - public ExpressRouteClient(AzureSubscription subscription) - : this(CreateClient(subscription)) + public ExpressRouteClient(AzureProfile profile, AzureSubscription subscription) + : this(CreateClient(profile, subscription)) { } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config index a2e0cc60e388..4b3d4742b855 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj index 5eaa931db2c8..e15aa5bcbb9c 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj @@ -42,17 +42,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -74,12 +74,12 @@ False ..\..\..\packages\Microsoft.Hadoop.Client.1.4.5\lib\net45\Microsoft.HDInsight.Net.Http.Formatting.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs index ff0db4f6a304..bd4d6ea0519f 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs @@ -18,7 +18,7 @@ using Microsoft.Hadoop.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.HDInsight.CmdLetTests; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities; using Microsoft.WindowsAzure.Management.HDInsight; @@ -26,7 +26,8 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.HDInsight.CommandTests { @@ -102,9 +103,9 @@ public void CanGetSubscriptionsCertificateCredentialFromCurrentSubscription() { var getClustersCommand = new GetAzureHDInsightClusterCommand(); var waSubscription = GetCurrentSubscription(); - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); - var subscriptionCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, AzureSession.CurrentContext.Environment, profileClient.Profile); + var subscriptionCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, profileClient.Profile.Context.Environment, profileClient.Profile); Assert.IsInstanceOfType(subscriptionCreds, typeof(HDInsightCertificateCredential)); var asCertificateCreds = subscriptionCreds as HDInsightCertificateCredential; @@ -121,7 +122,7 @@ public void CanGetAccessTokenCertificateCredentialFromCurrentSubscription() { Id = IntegrationTestBase.TestCredentials.SubscriptionId, }; - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); profileClient.Profile.Accounts["test"] = new AzureAccount { Id = "test", @@ -135,7 +136,7 @@ public void CanGetAccessTokenCertificateCredentialFromCurrentSubscription() profileClient.Profile.Save(); waSubscription.Account = "test"; - var accessTokenCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, AzureSession.CurrentContext.Environment, profileClient.Profile); + var accessTokenCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, profileClient.Profile.Context.Environment, profileClient.Profile); Assert.IsInstanceOfType(accessTokenCreds, typeof(HDInsightAccessTokenCredential)); var asAccessTokenCreds = accessTokenCreds as HDInsightAccessTokenCredential; Assert.AreEqual("abc", asAccessTokenCreds.AccessToken); @@ -148,11 +149,11 @@ public void CanGetJobSubmissionCertificateCredentialFromCurrentSubscription() { var getClustersCommand = new GetAzureHDInsightJobCommand(); var waSubscription = GetCurrentSubscription(); - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var subscriptionCreds = getClustersCommand.GetJobSubmissionClientCredentials( waSubscription, - AzureSession.CurrentContext.Environment, + profileClient.Profile.Context.Environment, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName, profileClient.Profile); @@ -172,7 +173,7 @@ public void CanGetJobSubmissionAccessTokenCredentialFromCurrentSubscription() Id = IntegrationTestBase.TestCredentials.SubscriptionId, Account = "test" }; - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); profileClient.Profile.Accounts["test"] = new AzureAccount { Id = "test", @@ -186,7 +187,7 @@ public void CanGetJobSubmissionAccessTokenCredentialFromCurrentSubscription() profileClient.Profile.Save(); var accessTokenCreds = getClustersCommand.GetJobSubmissionClientCredentials( waSubscription, - AzureSession.CurrentContext.Environment, + profileClient.Profile.Context.Environment, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName, profileClient.Profile); Assert.IsInstanceOfType(accessTokenCreds, typeof(HDInsightAccessTokenCredential)); @@ -207,9 +208,10 @@ public void CanGetBasicAuthCredentialFromCredentials() }; waSubscription.Account = "test"; var profile = new AzureProfile(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var accessTokenCreds = getClustersCommand.GetJobSubmissionClientCredentials( waSubscription, - AzureSession.CurrentContext.Environment, + profileClient.Profile.Context.Environment, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName, profile); Assert.IsInstanceOfType(accessTokenCreds, typeof(BasicAuthCredential)); var asBasicAuthCredentials = accessTokenCreds as BasicAuthCredential; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs index be2be604af89..3ca423dca8ac 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs @@ -17,11 +17,12 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Simulators { @@ -32,8 +33,8 @@ internal class AzureHDInsightSubscriptionResolverSimulator : IAzureHDInsightSubs internal AzureHDInsightSubscriptionResolverSimulator() { var certificate = new X509Certificate2(Convert.FromBase64String(IntegrationTestBase.TestCredentials.Certificate), string.Empty); - ProfileClient.DataStore.AddCertificate(certificate); - ProfileClient profileClient = new ProfileClient(); + AzureSession.DataStore.AddCertificate(certificate); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); profileClient.Profile.Accounts[certificate.Thumbprint] = new AzureAccount { Id = certificate.Thumbprint, diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs index a1c485b1486c..1e00b26d1dfa 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Simulators diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs index 54edc408d01c..d6ccf49809e7 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs @@ -21,7 +21,7 @@ using System.Security.Cryptography.X509Certificates; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.PowerShellTestAbstraction.Concretes; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.PowerShellTestAbstraction.Interfaces; @@ -35,7 +35,8 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; using Microsoft.WindowsAzure.Management.HDInsight.Framework.Core; using Microsoft.WindowsAzure.Management.HDInsight.Logging; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities { @@ -67,22 +68,27 @@ public static IEnumerable GetAllCredentials() public static AzureSubscription GetCurrentSubscription() { string certificateThumbprint1 = "jb245f1d1257fw27dfc402e9ecde37e400g0176r"; - ProfileClient profileClient = new ProfileClient(); + var newSubscription = new AzureSubscription() + { + Id = IntegrationTestBase.TestCredentials.SubscriptionId, + // Use fake certificate thumbprint + Account = certificateThumbprint1, + Environment = "AzureCloud" + }; + newSubscription.Properties[AzureSubscription.Property.Default] = "True"; + + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); profileClient.Profile.Accounts[certificateThumbprint1] = new AzureAccount() { Id = certificateThumbprint1, Type = AzureAccount.AccountType.Certificate }; - + profileClient.Profile.Subscriptions[newSubscription.Id] = newSubscription; + profileClient.Profile.Save(); - - return new AzureSubscription() - { - Id = IntegrationTestBase.TestCredentials.SubscriptionId, - // Use fake certificate thumbprint - Account = certificateThumbprint1 - }; + + return profileClient.Profile.Subscriptions[newSubscription.Id]; } public static AzureTestCredentials GetCredentialsForEnvironmentType(EnvironmentType type) @@ -184,7 +190,7 @@ public void ApplyFullMocking() var cmdletManager = ServiceLocator.Instance.Locate(); cmdletManager.MockingLevel = ServiceLocationMockingLevel.ApplyFullMocking; AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(); - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); } public void ApplyIndividualTestMockingOnly() diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config index f102eeaabeea..c6f5832e7d74 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs index b5df97274f09..8e9bcdd35219 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs @@ -17,14 +17,15 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Logging; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; using Microsoft.WindowsAzure.Management.HDInsight.Logging; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets { @@ -118,14 +119,14 @@ protected AzureSubscription GetCurrentSubscription(string Subscription, X509Cert { this.WriteWarning("The -Subscription parameter is deprecated, Please use Select-AzureSubscription -Current to select a subscription to use."); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var subscriptionResolver = ServiceLocator.Instance.Locate().Create(client.Profile); var resolvedSubscription = subscriptionResolver.ResolveSubscription(Subscription); if (certificate.IsNotNull() && resolvedSubscription.Account != certificate.Thumbprint) { - ProfileClient.DataStore.AddCertificate(certificate); + AzureSession.DataStore.AddCertificate(certificate); } if (resolvedSubscription.IsNull()) @@ -146,12 +147,12 @@ protected AzureSubscription GetCurrentSubscription(string Subscription, X509Cert // we need this for the tests to mock out the current subscription. if (this.HasCurrentSubscription) { - return this.CurrentContext.Subscription; + return this.Profile.Context.Subscription; } return testSubscription; #else - return this.CurrentContext.Subscription; + return this.Profile.Context.Subscription; #endif } } diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index cde876e92402..165f261bb2a7 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -49,19 +49,19 @@ False - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -84,12 +84,12 @@ False ..\..\..\packages\Microsoft.Hadoop.Client.1.4.5\lib\net45\Microsoft.HDInsight.Net.Http.Formatting.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs index 337e4d49d2a5..dee33062ee7a 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs @@ -16,7 +16,7 @@ using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs index 8c7a3bd75978..8b2ba329e843 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs @@ -20,7 +20,9 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using System.IO; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandImplementations { @@ -34,7 +36,7 @@ public override async Task EndProcessing() IHDInsightClient client = this.GetClient(); var cluster = await client.GetClusterAsync(this.Name); var connection = new AzureHDInsightClusterConnection(); - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); connection.Credential = this.GetSubscriptionCredentials(this.CurrentSubscription, profileClient.GetEnvironmentOrDefault(this.CurrentSubscription.Environment), profileClient.Profile); diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs index bd2d0cd3654a..c5f04e9e2d15 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs @@ -17,7 +17,9 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { @@ -41,7 +43,7 @@ internal IHDInsightClient GetClient() { this.CurrentSubscription.ArgumentNotNull("CurrentSubscription"); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var subscriptionCredentials = this.GetSubscriptionCredentials( this.CurrentSubscription, diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs index dee236bc6b37..1bad186c3b06 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs @@ -16,7 +16,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Framework.Core; using Microsoft.WindowsAzure.Management.HDInsight.Logging; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs index c19a310bf8f2..dc89b700bd29 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs @@ -12,18 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Linq; -using System.Reflection; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Hadoop.Client; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandImplementations; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; +using System; using System.Diagnostics; -using Microsoft.Azure.Common.Extensions.Authentication; -using Microsoft.Azure.Common.Extensions; +using System.IO; +using System.Reflection; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { @@ -60,7 +58,7 @@ public static IHDInsightSubscriptionCredentials GetSubscriptionCertificateCreden return new HDInsightCertificateCredential { SubscriptionId = currentSubscription.Id, - Certificate = ProfileClient.DataStore.GetCertificate(currentSubscription.Account), + Certificate = AzureSession.DataStore.GetCertificate(currentSubscription.Account), Endpoint = environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement), }; } @@ -68,13 +66,8 @@ public static IHDInsightSubscriptionCredentials GetSubscriptionCertificateCreden public static IHDInsightSubscriptionCredentials GetAccessTokenCredentials(this IAzureHDInsightCommonCommandBase command, AzureSubscription currentSubscription, AzureAccount azureAccount, AzureEnvironment environment) { - ProfileClient profileClient = new ProfileClient(); - AzureContext azureContext = new AzureContext - { - Subscription = currentSubscription, - Environment = environment, - Account = azureAccount - }; + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); + AzureContext azureContext = new AzureContext(currentSubscription, azureAccount, environment); var cloudCredentials = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(azureContext) as AccessTokenCredential; if (cloudCredentials != null) diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs index 7d4f1c814611..73b104c754f6 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs @@ -18,11 +18,12 @@ using System.Threading; using Microsoft.Hadoop.Client; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { @@ -48,7 +49,7 @@ internal IJobSubmissionClient GetClient(string cluster) { cluster.ArgumentNotNull("ClusterEndpoint"); IJobSubmissionClient client = null; - ProfileClient profileClient = new ProfileClient(); + ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); string currentEnvironmentName = this.CurrentSubscription == null ? null : this.CurrentSubscription.Environment; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs index e2630298b462..79321a6ecdef 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs @@ -14,7 +14,7 @@ using System; using System.Linq; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs index dda48854ea49..def460cba056 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs index 1aa735f604de..7b12055982fe 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs @@ -14,7 +14,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs index 7a9c3aed34cc..661b4edd8940 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs index 785b11d32e51..ce4baf284f24 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs index 56a779457f8b..0060f31435cc 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Logging; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs index e0928f28f103..2edb165cc22c 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs @@ -21,7 +21,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Hadoop.Client; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.BaseCommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config index 1e6ad8614b5c..77a6efb6704b 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj index 26e574faf003..ac368a1d24f2 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj @@ -39,26 +39,26 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll - True + + False + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll @@ -69,13 +69,13 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs index ddeb5726923a..0e6f3d151d71 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Management.ManagedCache; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config index 3c5a7c9a9d66..2dd058ba5df0 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj index 70fc2413f539..cb976092c6a8 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj @@ -42,17 +42,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -67,12 +67,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/ManagedCacheCmdletBase.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/ManagedCacheCmdletBase.cs index 3c7827f65823..65039549c033 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/ManagedCacheCmdletBase.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/ManagedCacheCmdletBase.cs @@ -29,7 +29,7 @@ internal PSCacheClient CacheClient { if (cacheClient == null) { - cacheClient = new PSCacheClient(CurrentContext.Subscription); + cacheClient = new PSCacheClient(Profile, Profile.Context.Subscription); } return cacheClient; } diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs index 643845b11c17..fcc90b488c34 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs @@ -24,9 +24,9 @@ using Microsoft.Azure.Management.ManagedCache.Models; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Hyak.Common; namespace Microsoft.Azure.Commands.ManagedCache @@ -38,9 +38,9 @@ class PSCacheClient private const int MaxNamedCacheCount = 10; private ManagedCacheClient client; - public PSCacheClient(AzureSubscription currentSubscription) + public PSCacheClient(AzureProfile profile, AzureSubscription currentSubscription) { - client = AzureSession.ClientFactory.CreateClient(currentSubscription, AzureEnvironment.Endpoint.ServiceManagement); + client = AzureSession.ClientFactory.CreateClient(profile, currentSubscription, AzureEnvironment.Endpoint.ServiceManagement); } public PSCacheClient() { } diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCache.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCache.cs index 1f52d75504de..1f9962fce47a 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCache.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCache.cs @@ -44,7 +44,7 @@ public override void ExecuteCmdlet() string memory = memoryDynamicParameterSet.GetMemoryValue(Sku); PSCacheService cacheService = new PSCacheService(CacheClient.CreateCacheService( - CurrentContext.Subscription.Id.ToString(), + Profile.Context.Subscription.Id.ToString(), cacheServiceName, Location, Sku, diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config index 58536403b7f9..d92de5320023 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj b/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj index 16423e80f925..6ee9ae770d7b 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj +++ b/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj @@ -39,26 +39,26 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll @@ -69,13 +69,13 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs index e7575498cded..47bdc2d33c64 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.Network.Test.ScenarioTests using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; using Microsoft.WindowsAzure.Management; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Test; public class NSGScenarioTests diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs index 0088e69a4bcc..b265fcd800fb 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Commands.Network.Test.ScenarioTests { - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; using WindowsAzure.Management.Network; public abstract class NetworkTestsBase diff --git a/src/ServiceManagement/Network/Commands.Network.Test/packages.config b/src/ServiceManagement/Network/Commands.Network.Test/packages.config index 580f69515677..95aa9a4485f7 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/packages.config +++ b/src/ServiceManagement/Network/Commands.Network.Test/packages.config @@ -1,19 +1,19 @@  - - + + - + - - + + - + diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj index fe02f78ecb59..fd4758da4b24 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj @@ -50,28 +50,28 @@ True - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs index 4bcec69567c9..47f09d01efd1 100644 --- a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs +++ b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- - namespace Microsoft.Azure.Commands.Network { using System; @@ -31,8 +30,8 @@ namespace Microsoft.Azure.Commands.Network using WindowsAzure.Management.Network; using WindowsAzure.Management.Network.Models; using WindowsAzure.Storage.Auth; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; public class NetworkClient @@ -41,9 +40,9 @@ public class NetworkClient private readonly ManagementClient managementClient; private readonly ICommandRuntime commandRuntime; - public NetworkClient(AzureSubscription subscription, ICommandRuntime commandRuntime) - : this(CreateClient(subscription), - CreateClient(subscription), + public NetworkClient(AzureProfile profile, AzureSubscription subscription, ICommandRuntime commandRuntime) + : this(CreateClient(profile, subscription), + CreateClient(profile, subscription), commandRuntime) { } @@ -362,9 +361,9 @@ private void PopulateOperationContext(OperationStatusResponse operationStatus, M operationContext.OperationDescription = commandRuntime.ToString(); } - private static ClientType CreateClient(AzureSubscription subscription) where ClientType : ServiceClient + private static ClientType CreateClient(AzureProfile profile, AzureSubscription subscription) where ClientType : ServiceClient { - return AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); } public void CreateNetworkSecurityGroup(string name, string location, string label) diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs b/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs index 87c8b563ba2c..48d233165bc6 100644 --- a/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs +++ b/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs @@ -14,8 +14,8 @@ namespace Microsoft.Azure.Commands.Network { - using Microsoft.Azure.Common.Extensions; - using Microsoft.Azure.Common.Extensions.Models; + using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Common.Authentication.Models; using WindowsAzure.Commands.Common; using WindowsAzure.Commands.Utilities.Common; using WindowsAzure.Commands.Utilities.Profile; @@ -29,7 +29,7 @@ public abstract class NetworkCmdletBase : AzurePSCmdlet protected AzureSubscription CurrentSubscription { - get { return AzureSession.CurrentContext.Subscription; } + get { return Profile.Context.Subscription; } } protected NetworkClient Client @@ -38,7 +38,7 @@ protected NetworkClient Client { if (client == null) { - client = new NetworkClient(CurrentSubscription, CommandRuntime); + client = new NetworkClient(Profile, CurrentSubscription, CommandRuntime); } return client; } diff --git a/src/ServiceManagement/Network/Commands.Network/packages.config b/src/ServiceManagement/Network/Commands.Network/packages.config index 388de216e7d3..f53b4f51dee4 100644 --- a/src/ServiceManagement/Network/Commands.Network/packages.config +++ b/src/ServiceManagement/Network/Commands.Network/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj index 0385ab070102..89f5df59ead8 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj @@ -37,34 +37,34 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs index bc43a76c1343..6003d8c0d876 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs @@ -27,8 +27,8 @@ using Microsoft.WindowsAzure.Management.SiteRecovery; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.RecoveryServices.Test.ScenarioTests { @@ -134,7 +134,7 @@ private SiteRecoveryManagementClient GetSiteRecoveryManagementClient() asrVaultCreds.CloudServiceName, asrVaultCreds.ResourceName, (SubscriptionCloudCredentials)environment.Credentials, - AzureSession.CurrentContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)).WithHandler(HttpMockServer.CreateInstance()); + AzureEnvironment.PublicEnvironments["AzureCloud"].GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)).WithHandler(HttpMockServer.CreateInstance()); } private static bool IgnoreCertificateErrorHandler diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config index ebb211dc55c6..88f75308ead1 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config @@ -1,17 +1,17 @@  - - + + - + - - + + - + diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj index 45ab4a7ca697..91591d0d7922 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj @@ -44,28 +44,28 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs index 1e30a45dd38f..036ed620ac41 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs @@ -26,14 +26,14 @@ using Microsoft.Azure.Portal.RecoveryServices.Models.Common; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.RecoveryServices; using Microsoft.WindowsAzure.Management.RecoveryServices.Models; using Microsoft.WindowsAzure.Management.SiteRecovery; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; -using Microsoft.Azure.Common.Extensions.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.RecoveryServices { @@ -47,6 +47,11 @@ public partial class PSRecoveryServicesClient /// public string ClientRequestId { get; set; } + /// + /// Azure profile + /// + public AzureProfile Profile { get; set; } + /// /// Amount of time to sleep before fetching job details again. /// @@ -66,22 +71,16 @@ public partial class PSRecoveryServicesClient /// private RecoveryServicesManagementClient recoveryServicesClient; - /// - /// Initializes a new instance of the class. - /// - public PSRecoveryServicesClient() - { - } - /// /// Initializes a new instance of the class with /// required current subscription. /// /// Azure Subscription - public PSRecoveryServicesClient(AzureSubscription azureSubscription) + public PSRecoveryServicesClient(AzureProfile azureProfile, AzureSubscription azureSubscription) { + this.Profile = azureProfile; this.recoveryServicesClient = - AzureSession.ClientFactory.CreateClient(azureSubscription, AzureEnvironment.Endpoint.ServiceManagement); + AzureSession.ClientFactory.CreateClient(azureProfile, azureSubscription, AzureEnvironment.Endpoint.ServiceManagement); } /// @@ -240,7 +239,9 @@ private SiteRecoveryManagementClient GetSiteRecoveryClient() } SiteRecoveryManagementClient siteRecoveryClient = - AzureSession.ClientFactory.CreateCustomClient(asrVaultCreds.CloudServiceName, asrVaultCreds.ResourceName, recoveryServicesClient.Credentials, AzureSession.CurrentContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)); + AzureSession.ClientFactory.CreateCustomClient(asrVaultCreds.CloudServiceName, + asrVaultCreds.ResourceName, recoveryServicesClient.Credentials, + Profile.Context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)); if (null == siteRecoveryClient) { diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/RecoveryServicesCmdletBase.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/RecoveryServicesCmdletBase.cs index 9f1707436869..bf7bdfce1ad1 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/RecoveryServicesCmdletBase.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/RecoveryServicesCmdletBase.cs @@ -48,7 +48,7 @@ internal PSRecoveryServicesClient RecoveryServicesClient { if (this.recoveryServicesClient == null) { - this.recoveryServicesClient = new PSRecoveryServicesClient(CurrentContext.Subscription); + this.recoveryServicesClient = new PSRecoveryServicesClient(Profile, Profile.Context.Subscription); } return this.recoveryServicesClient; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs index 78d95a792f0f..fd69d98d3b09 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.RecoveryServices { diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config index 16c10ab7b6f6..d9f6ab687c63 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config @@ -1,15 +1,15 @@  - - + + - + - + diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj b/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj index 4ffe069a3a48..1b433d23796c 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj @@ -43,27 +43,27 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs index b7450a09710d..6668883aee64 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs @@ -26,7 +26,7 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { using ConfigConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; using DefinitionConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema.ConfigurationSetting; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; public static class AzureAssert { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs index 242371ecf20d..d34b9e36618e 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Extensions.Authentication; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs index f240e0c9bc32..db0a877cbc00 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Security; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Extensions.Authentication; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs index 6dba8bed3435..a4a30c0a106e 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs @@ -18,7 +18,8 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { @@ -287,8 +288,8 @@ public string CreateAzureSdkDirectoryAndImportPublishSettings(string publishSett Debug.Assert(string.IsNullOrEmpty(AzureSdkPath)); AzureSdkPath = CreateDirectory("AzureSdk"); - ProfileClient client = new ProfileClient(); - ProfileClient.DataStore.WriteFile(publishSettingsPath, File.ReadAllText(publishSettingsPath)); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); + AzureSession.DataStore.WriteFile(publishSettingsPath, File.ReadAllText(publishSettingsPath)); client.ImportPublishSettings(publishSettingsPath, null); client.Profile.Save(); diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs index 7f0943b1c39c..11796eba3660 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs @@ -17,6 +17,9 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Common.Authentication.Models; +using System; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Websites { @@ -24,11 +27,14 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Websites public class WebsitesTestBase : TestBase { protected string subscriptionId = "035B9E16-BA8E-40A3-BEEA-4998F452C203"; + protected AzureProfile currentProfile; [TestInitialize] public virtual void SetupTest() { new FileSystemHelper(this).CreateAzureSdkDirectoryAndImportPublishSettings(); + + currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); } [TestCleanup] @@ -50,5 +56,19 @@ public void TestCleanup() File.Delete(sitesFile); } } + + protected void SetupProfile(string storageName) + { + + currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + var subscription = new AzureSubscription { Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; + if (storageName != null) + { + currentProfile.Context.Subscription.Properties[AzureSubscription.Property.StorageAccount] = storageName; + } + currentProfile.Save(); + } } } diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config b/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config index 81fd92f2687b..34820942ae70 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs index f936935a51b8..1ef8e8cf4290 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs @@ -23,7 +23,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Common; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureMemcacheRoleTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureMemcacheRoleTests.cs index 3c2c0d037247..7044b646a30d 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureMemcacheRoleTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureMemcacheRoleTests.cs @@ -34,7 +34,7 @@ namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development.Tests using ConfigConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; using DefinitionConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema.ConfigurationSetting; using TestResources = Commands.Common.Test.Properties.Resources; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; public class EnableAzureMemcacheRoleTests : TestBase { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs index 8f4463b5a538..38f5437240a3 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Common; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs index 79f496cc8b15..0210ef7bcefd 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs index 080d934d64c0..36d3ab2bf1a1 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs index 810686336dbe..62fbf8a43d74 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs @@ -18,7 +18,7 @@ using System.Net; using System.Threading; using Xunit; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; @@ -31,7 +31,7 @@ using Moq; using MockStorageService = Microsoft.WindowsAzure.Commands.Test.Utilities.Common.MockStorageService; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs index 67b990cbd864..811237bfe714 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs index cc4939661291..ed5b8acb37a1 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs @@ -23,7 +23,8 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { @@ -51,9 +52,9 @@ public PublishContextTests() packagePath = service.Paths.CloudPackage; configPath = service.Paths.CloudConfiguration; settings = ServiceSettingsTestData.Instance.Data[ServiceSettingsState.Default]; - ProfileClient.DataStore = new MockDataStore(); - ProfileClient client = new ProfileClient(); - ProfileClient.DataStore.WriteFile(Test.Utilities.Common.Data.ValidPublishSettings.First(), + AzureSession.DataStore = new MockDataStore(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); + AzureSession.DataStore.WriteFile(Test.Utilities.Common.Data.ValidPublishSettings.First(), File.ReadAllText(Test.Utilities.Common.Data.ValidPublishSettings.First())); client.ImportPublishSettings(Test.Utilities.Common.Data.ValidPublishSettings.First(), null); client.Profile.Save(); @@ -61,7 +62,7 @@ public PublishContextTests() public void TestCleanup() { - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); if (Directory.Exists(Test.Utilities.Common.Data.AzureSdkAppDir)) { new RemoveAzurePublishSettingsCommand().RemovePublishSettingsProcess(Test.Utilities.Common.Data.AzureSdkAppDir); diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs index 3114798e5b92..8bd4d124091a 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj index 5b25ca7f8afd..f9df1353c56e 100644 --- a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj +++ b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj @@ -48,21 +48,28 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + + + False + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll @@ -72,12 +79,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll @@ -221,6 +228,8 @@ + + @@ -342,8 +351,24 @@ + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + {c1bda476-a5cc-4394-914d-48b0ec31a710} + Commands.ScenarioTests.Common + {e1ca72ba-8374-45f6-904d-fd34ecdf5b6f} Commands.ServiceManagement diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs index dbae4495621c..8382976cbd81 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs @@ -16,14 +16,15 @@ using System.Management.Automation; using System.Reflection; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Moq; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Environment { @@ -34,12 +35,12 @@ public class AddAzureEnvironmentTests : TestBase, IDisposable public AddAzureEnvironmentTests() { dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; + AzureSession.DataStore = dataStore; } public void Cleanup() { - AzureSession.SetCurrentContext(null, null, null); + currentProfile = null; } [Fact] @@ -61,7 +62,7 @@ public void AddsAzureEnvironment() cmdlet.InvokeEndProcessing(); commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Once()); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); AzureEnvironment env = client.GetEnvironmentOrDefault("KaTaL"); Assert.Equal(env.Name, cmdlet.Name); Assert.Equal(env.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl], cmdlet.PublishSettingsFileUrl); @@ -86,7 +87,7 @@ public void AddsEnvironmentWithMinimumInformation() cmdlet.InvokeEndProcessing(); commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Once()); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); AzureEnvironment env = client.Profile.Environments["KaTaL"]; Assert.Equal(env.Name, cmdlet.Name); Assert.Equal(env.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl], cmdlet.PublishSettingsFileUrl); @@ -108,7 +109,7 @@ public void IgnoresAddingDuplicatedEnvironment() cmdlet.InvokeBeginProcessing(); cmdlet.ExecuteCmdlet(); cmdlet.InvokeEndProcessing(); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); int count = client.Profile.Environments.Count; // Add again @@ -150,7 +151,7 @@ public void AddsEnvironmentWithStorageEndpoint() cmdlet.InvokeEndProcessing(); commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Once()); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); AzureEnvironment env = client.Profile.Environments["KaTaL"]; Assert.Equal(env.Name, cmdlet.Name); Assert.Equal(env.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl], actual.GetVariableValue(AzureEnvironment.Endpoint.PublishSettingsFileUrl.ToString())); diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs index 0382d1202d30..6d0f00e67b2d 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs @@ -15,14 +15,14 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Moq; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Environment { @@ -33,7 +33,7 @@ public class GetAzureEnvironmentTests : TestBase public GetAzureEnvironmentTests() { dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; + AzureSession.DataStore = dataStore; } [Fact] diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs index ad1085a6af8f..7b1a0776761a 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs @@ -16,14 +16,15 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Moq; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Environment { @@ -34,12 +35,12 @@ public class RemoveAzureEnvironmentTests : TestBase, IDisposable public RemoveAzureEnvironmentTests() { dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; + AzureSession.DataStore = dataStore; } public void Cleanup() { - AzureSession.SetCurrentContext(null, null, null); + currentProfile = null; } [Fact] @@ -49,7 +50,7 @@ public void RemovesAzureEnvironment() commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny(), It.IsAny())).Returns(true); const string name = "test"; - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetEnvironment(new AzureEnvironment { Name = name @@ -67,7 +68,7 @@ public void RemovesAzureEnvironment() cmdlet.ExecuteCmdlet(); cmdlet.InvokeEndProcessing(); - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); Assert.False(client.Profile.Environments.ContainsKey(name)); } diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs index 25587ec8616b..486ff8d32bc6 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs @@ -18,13 +18,14 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Environment { @@ -36,12 +37,12 @@ public class SetAzureEnvironmentTests : TestBase, IDisposable public SetAzureEnvironmentTests() { dataStore = new MockDataStore(); - ProfileClient.DataStore = dataStore; + AzureSession.DataStore = dataStore; } public void Cleanup() { - AzureSession.SetCurrentContext(null, null, null); + currentProfile = null; } [Fact] @@ -49,7 +50,7 @@ public void SetsAzureEnvironment() { Mock commandRuntimeMock = new Mock(); string name = "Katal"; - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.AddOrSetEnvironment(new AzureEnvironment { Name = name }); SetAzureEnvironmentCommand cmdlet = new SetAzureEnvironmentCommand() @@ -68,7 +69,7 @@ public void SetsAzureEnvironment() cmdlet.InvokeEndProcessing(); commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Once()); - client = new ProfileClient(); + client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); AzureEnvironment env = client.Profile.Environments["KaTaL"]; Assert.Equal(env.Name.ToLower(), cmdlet.Name.ToLower()); Assert.Equal(env.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl], cmdlet.PublishSettingsFileUrl); diff --git a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs index dd00777e74fb..6a9fb4f6fd4f 100644 --- a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs @@ -17,7 +17,7 @@ using System.Threading.Tasks; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.MediaServices; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.MediaServices.Services.Entities; using Microsoft.WindowsAzure.Management.MediaServices.Models; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.MediaServices { @@ -71,7 +71,10 @@ public void ProcessGetMediaServicesTest() MediaServicesClient = clientMock.Object, }; - AzureSession.SetCurrentContext(new AzureSubscription {Id = new Guid(SubscriptionId)}, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(SubscriptionId)] = subscription; getAzureMediaServiceCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.Count); @@ -104,7 +107,10 @@ public void ProcessGetMediaServiceByNameShouldReturnOneMatchingEntry() MediaServicesClient = clientMock.Object, Name = expectedName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(SubscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(SubscriptionId)] = subscription; getAzureMediaServiceCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.Count); MediaServiceAccountDetails accounts = (MediaServiceAccountDetails)((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.FirstOrDefault(); @@ -142,7 +148,10 @@ public void ProcessGetMediaServiceByNameShouldNotReturnEntriesForNoneMatchingNam Name = mediaServicesAccountName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(SubscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(SubscriptionId)] = subscription; Assert.Throws(()=> getAzureMediaServiceCommand.ExecuteCmdlet()); Assert.Equal(0, ((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.Count); } diff --git a/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs b/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs index 310141cc26b9..a72148ea7740 100644 --- a/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.MediaServices; using Microsoft.WindowsAzure.Management.MediaServices; using Microsoft.WindowsAzure.Management.MediaServices.Models; diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs b/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs index a053082992b8..40f21d06425e 100644 --- a/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs @@ -19,8 +19,9 @@ using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Moq; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Test.Profile { @@ -31,7 +32,7 @@ public class GetAzurePublishSettingsFileTests public void GetsPublishSettingsFileUrl() { // Setup - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); Mock commandRuntimeMock = new Mock(); GetAzurePublishSettingsFileCommand cmdlet = new GetAzurePublishSettingsFileCommand() { @@ -40,7 +41,7 @@ public void GetsPublishSettingsFileUrl() Environment = EnvironmentName.AzureCloud, Realm = "microsoft.com" }; - cmdlet.ProfileClient = new ProfileClient(); + cmdlet.ProfileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); // Test cmdlet.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs new file mode 100644 index 000000000000..84d51dff3fca --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.Azure.Commands.Test.Profile; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Internal.Subscriptions.Csm.Models; +using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; +using CSMSubscription = Microsoft.Azure.Internal.Subscriptions.Csm.Models.Subscription; +using RDFESubscription = Microsoft.Azure.Internal.Subscriptions.Rdfe.Models.Subscription; + +namespace Microsoft.Azure.Commands.Test.Profile +{ + public class NewAzureProfileTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestCreatesNewAzureProfileWithCertificate() + { + ProfileTestController.NewInstance.RunPsTest("Test-CreatesNewAzureProfileWithCertificate"); + } + + [Fact(Skip = "Need support from mocking framework")] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestCreatesNewAzureProfileWithUserCredentials() + { + ProfileTestController.NewInstance.RunPsTest("Test-CreatesNewAzureProfileWithUserCredentials"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestCreatesNewAzureProfileWithAccessToken() + { + ProfileTestController.NewInstance.RunPsTest("Test-CreatesNewAzureProfileWithAccessToken"); + } + } +} diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.ps1 b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.ps1 new file mode 100644 index 000000000000..f1a6b79a5db2 --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.ps1 @@ -0,0 +1,68 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + + +$testCertData = [Convert]::FromBase64String("MIIKJAIBAzCCCeQGCSqGSIb3DQEHAaCCCdUEggnRMIIJzTCCBe4GCSqGSIb3DQEHAaCCBd8EggXbMIIF1zCCBdMGCyqGSIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAjilB4DFutYJwICB9AEggTItMCor/6dq+ynHyoo82U2N8bT9fBn57xuvF4zTtZdl503n+q48ZE5SLcUFoeAZkrYoCiyPn4ayVA4pfAHou5I2XEG1B4YF46hD0Bz0igWRSrsVigdoYP98BGGaMgl43d9AQGeV8iJ3d3In/TxMGjHUYzZwoIg1jE7xhQ8dMr2Xenw8pLrxl8FybI1isyxzAUjFE7E/Znv9DYi83VNwjC1uPg8q16PzXUQ/smFVzoZMtvmp8MxPrnI/gHqcS5g7SnnisTLmJcjqdLVywBZqiMo1ALs90EEgc7qgbim9lxGczUh+SI9cj2m5w9XMmXro4XJNJTLFG26DDOVMPfMSr9ij9P4rmxckVK7nHrGhQpshrLr37dF5KGFo6mh79VUadbwn/a4rXjfX9gXm5N/ZS8wq3U4/4Pl7t5N+bwB5izt8JG4aMhX6M6jshNrpe/gZHI9u6jNAo1yRxNfBdoxA7P2sZdlHO4CYTc9zZcZqTgH2QjRLTelIDn17PEQL9L4rEzqhT322WMzNnSMH9TCu3D5l2RuO6hsHl0JK4saiq3s04kkYoLXF9i+ovS0xSmu0zxemnFAGB1q1mlwoWoD06zlXEjHM2Q3T2b8ip1tK6/GFpU8Qs5BOUDanBOCqVLWlyvM/ilXUyN9cyLRMKM1sgEmn5ue0wsZlflU6egqChF8qjSJzq/34FgTjPazvkXkXv0e2vBz5+qzeC/1R8xySdFoehglny42VTkCRH4BzhoXf+MrfrC6tW85WCTKOj8SiTSzYXRragIwfG8RyLViOzdIW9pEAJF3UOloKOGGL1NREAnRPgxm9UVxD1oUj+pqYkPRRXcHuEnbiYEqE8Dgwk6GaSVOZ4CKjKAcapOwwW8bTxHgFOCrwgZhxIFXQhIZVoH8NphqN2WWwIUPa1gsc3uPwVXecgt8y8S01QEYCCFo9dT5sBS0rAOXMTOnSudWSHvz7c36IJSG2KyJwW3YO2UopIQ1V14MBZQhwUyddUILeuOy50u1j2eVOV3XESHO99oNP9FfalmgZw19LQDqX8S861x1w+GuU/NG//LZ0aXXaw1IhddIMZlpZVTADMunXIJbd0OiunfblXFwGZ33M1y/wGvFAZ6ofOuZv6vM0kmtufg3AHl/Vg+jzLOp1bYbKx4f7FHoYAerV88EA/ELXr2NTOLwwRYdk0cLWk4VY2lCLs8lcyoIUrcOS/+af8oX8dgJo9qkx2AiKp6AgYAWwrdpolOH7sMLmtu1rrthoMesExLz6xpUq/rYrWQJuyXWUmwbdxpDYFP8spqcW3KdbroNWhPEvM0tdocSK6lPWNnFMgqbb2qJJqjyV87LBZPEpHI8TPraofE7h4NWjXx/OqA6/dF1t3RvrvYqyC7kvrnaJ2LWfQI/88K9s7LAVvfDIbxWtIadrGXlo4gbtbQDSFzjve123DngBJkXqpzqRoL7mdpFvsgpg0upIKQ1fIbtaksC115g8BGBOzwGlo0Y3f4+ob6++OkePHoLkGhLahCMyDmGV1mxFz3ZUkXyxmfPSeynwXe/N8TxeZ2ixLZMF3sa61CpFsuHfEmVEetFxP5t3rrO5ZIbE87KVtvl6jCr8JQ3h81TZJBaeu8iiNC0MVspJpNQ/irYFElTMYHRMBMGCSqGSIb3DQEJFTEGBAQBAAAAMFsGCSqGSIb3DQEJFDFOHkwAewA0ADgANQBFADQAOQBCADYALQBFAEUARQA4AC0ANAA3ADUAQgAtADgAOQAwAEQALQA5ADcAQQA3ADYARgAyADQANgBEADkAMwB9MF0GCSsGAQQBgjcRATFQHk4ATQBpAGMAcgBvAHMAbwBmAHQAIABTAG8AZgB0AHcAYQByAGUAIABLAGUAeQAgAFMAdABvAHIAYQBnAGUAIABQAHIAbwB2AGkAZABlAHIwggPXBgkqhkiG9w0BBwagggPIMIIDxAIBADCCA70GCSqGSIb3DQEHATAcBgoqhkiG9w0BDAEGMA4ECG9kWMFPd2j2AgIH0ICCA5AUBLyrnhFVIYZKNWVLOWn0nfwmhADWS2FA3LGyGirb/lgpPcolLiQwGnXih0xxESn1CsZcWDpXiUvAfjQF1kxKHyCIUQBkrKQliYIT+RErliVuAY/vv1YW2Zj+bPUtTZKXUDzIPjNgb43+uxvf/wu+gGhAV/dV5oIWLjFhC1u4+Gp/LA5C6j60NtBXG7barSflAWTSOjGt2IIb5mBrUw+GkrhoYOqA+HYG40j2fkmkWpMCkImzcxxEM65ZElGUt7H1QY+GSRAxt7icA5ka9L+A0UM8a1SCFhbBK6Voo0IAkBZctJ6I7h4znhoHtqMDYYzraaYDVAK4SPdwOUMUyYdai0QwOYSL3frwVzC/ZHvCJkRmOsQXj9U44OGoXXrJ4rWIQIkcxFO3rEC3alI9lV5h5w73DWQRjex8Nz214B1yBRdlkoC/HQpgJ6IwFfEyJOn/lGgqkRPbgntTKSjNQZr5Ot60Z1SUYmmcMTpB8jRg+hy0LbWmx+79q9ERUnLO4yrtcXjQza12/FwAdpJOwbFrXMZb3QcuhQfn9aDF9/iNRkhTdxDmumS/C5gjZSYBzTugGDWsyS1hqws7LaYfcs6aWWRafqxt68cpNy4FaNXZ3XwXRVzuH+brnGvnWXRqhzwCbeGxEKDCEPxO9hO8NVrndsGlGfTZmxfTkKnPyRPD6vk4BG0Rc5BniyrmhnaZgSq0M04MeoAjp1s6S8CcIG73H5KkmoqQwSiKUbY3aA15nxqYhQj6L83WK5dPnVlmaV/xOeqkggzsdkaa+eQfA1e5RR27Gkyr5Rl20PQUR6J/sIGWIVCSSaqD2kxmDTODEORsF7jhL4YXZr96hqvNWtyNncxrqvjPsaFi/P2JFxjfZ8wmnF1HDsVW4W/i8cdRTyEz7Go4kzoRvSvC2sCPRAMa3D+o341r7L0hBlCnFfMU5Le8jatMKsw+Nk1TeOc4Cvc+w3gczSKrlhJnPtJjVZ67kKe8Ror8mKOP6afSr27avEizUYvJcCpKztUM59ukEbM2chEb2rrFPWxnB67KaLF825pRm+6Nl3mx0jaPDgK2ToydGfuVBA+9TSpnuV26imsd+K2yL2nwrdvBJPE/t2lPzVIR0hnf4AJ8/9BR0vTGmxiWwy8VMxrS3PyouLPZMXAgdT6ddRVwmewNjTe5g/tciGazIW+nROgg6fsgyObMp7keONMvtFMrJQLa2oKarGkwNzAfMAcGBSsOAwIaBBQXFDnqplMX7OuyknHK7B+HA/N8tAQUsL21+IY37DPL968vhVzqz09W/so=") +$testCert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 +$testCert.Import($testCertData) + +$secPasswd = ConvertTo-SecureString "TestPassw0rd" -AsPlainText -Force +$testCreds = New-Object System.Management.Automation.PSCredential ("test@mail.com", $secPasswd) + +<# +.SYNOPSIS +Tests creating new azure profile with certificate +#> +function Test-CreatesNewAzureProfileWithCertificate +{ + # Test + $actual = New-AzureProfile -SubscriptionId "058de55e-28e0-49e7-8cf2-6701d4a88ef5" -StorageAccount myStorage -Certificate $testCert + + # Assert + Assert-AreEqual "058de55e-28e0-49e7-8cf2-6701d4a88ef5" $actual.Context.Subscription.Id + Assert-AreEqual "AzureCloud" $actual.Context.Environment.Name + Assert-AreEqual "Certificate" $actual.Context.Account.Type +} + +<# +.SYNOPSIS +Tests creating new azure profile with user creds +#> +function Test-CreatesNewAzureProfileWithUserCredentials +{ + # Test + $actual = New-AzureProfile -SubscriptionId "058de55e-28e0-49e7-8cf2-6701d4a88ef5" -StorageAccount myStorage -Credentials $testCreds -Tenant "testTenant" + + # Assert + Assert-AreEqual "058de55e-28e0-49e7-8cf2-6701d4a88ef5" $actual.Context.Subscription.Id + Assert-AreEqual "AzureCloud" $actual.Context.Environment.Name + Assert-AreEqual "test@mail.com" $actual.Context.Account.Id + Assert-AreEqual "User" $actual.Context.Account.Type +} + +<# +.SYNOPSIS +Tests creating new azure profile with access token +#> +function Test-CreatesNewAzureProfileWithAccessToken +{ + # Test + $actual = New-AzureProfile -SubscriptionId "058de55e-28e0-49e7-8cf2-6701d4a88ef5" -StorageAccount myStorage -AccessToken "123456" -AccountId myAccount + + # Assert + Assert-AreEqual "058de55e-28e0-49e7-8cf2-6701d4a88ef5" $actual.Context.Subscription.Id + Assert-AreEqual "AzureCloud" $actual.Context.Environment.Name + Assert-AreEqual "myAccount" $actual.Context.Account.Id + Assert-AreEqual "AccessToken" $actual.Context.Account.Type +} \ No newline at end of file diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs new file mode 100644 index 000000000000..2294ff3ee9ec --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs @@ -0,0 +1,113 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Microsoft.Azure.Test; +using System; +using System.Linq; + +namespace Microsoft.Azure.Commands.Test.Profile +{ + public sealed class ProfileTestController + { + private CSMTestEnvironmentFactory csmTestFactory; + private EnvironmentSetupHelper helper; + + public static ProfileTestController NewInstance + { + get + { + return new ProfileTestController(); + } + } + + public ProfileTestController() + { + helper = new EnvironmentSetupHelper(); + } + + public void RunPsTest(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); + } + + public void RunPsTestWorkflow( + Func scriptBuilder, + Action initialize, + Action cleanup, + string callingClassType, + string mockName) + { + 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 callingClassName = callingClassType + .Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries) + .Last(); + helper.SetupModules( + AzureModule.AzureResourceManager, + "Profile\\" + callingClassName + ".ps1"); + + try + { + if (scriptBuilder != null) + { + var psScripts = scriptBuilder(); + + if (psScripts != null) + { + helper.RunPowerShellTest(psScripts); + } + } + } + finally + { + if(cleanup !=null) + { + cleanup(); + } + } + } + } + + private void SetupManagementClients() + { + helper.SetupSomeOfManagementClients(); + } + + } +} diff --git a/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs b/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs index d1c170b9786b..d3f3bbabc671 100644 --- a/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Utilities.ServiceBus; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.ServiceBus { diff --git a/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithAccessToken.json b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithAccessToken.json new file mode 100644 index 000000000000..0baaa4d02044 --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithAccessToken.json @@ -0,0 +1,9 @@ +{ + "Entries": [ + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithCertificate.json b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithCertificate.json new file mode 100644 index 000000000000..0baaa4d02044 --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithCertificate.json @@ -0,0 +1,9 @@ +{ + "Entries": [ + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithUserCredential.json b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithUserCredential.json new file mode 100644 index 000000000000..0baaa4d02044 --- /dev/null +++ b/src/ServiceManagement/Services/Commands.Test/SessionRecords/Microsoft.Azure.Commands.Test.Profile.NewAzureProfileTests/TestCreatesNewAzureProfileWithUserCredential.json @@ -0,0 +1,9 @@ +{ + "Entries": [ + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs b/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs index 9600f704a96c..6242c66b3b48 100644 --- a/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs @@ -15,7 +15,7 @@ using System; using System.Text; using Xunit; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.WAPackIaaS.WebClient; namespace Microsoft.WindowsAzure.Commands.Test.WAPackIaaS.WebClient diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs index 765191222d13..02402e166d7a 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs @@ -14,13 +14,14 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; using Xunit; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -56,7 +57,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplication() File = true, }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Test disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); @@ -85,7 +89,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplicationTableLog() TableStorage = true }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Test disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); @@ -114,7 +121,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplicationBlobLog() BlobStorage = true }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Test disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); @@ -145,7 +155,10 @@ public void DisablesApplicationDiagnosticOnSlot() Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Test disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs index 18fa8a81eb9d..fba67f007d30 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs @@ -12,17 +12,19 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; +using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.DeploymentEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; +using System; +using System.Collections.Generic; +using System.IO; +using System.Management.Automation; using Xunit; -using Microsoft.Azure.Common.Extensions; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -55,6 +57,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplication() WebsiteDiagnosticOutput.FileSystem, properties, null)); + SetupProfile(null); + enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { CommandRuntime = commandRuntimeMock.Object, @@ -64,10 +68,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplication() LogLevel = LogEntryType.Information }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( @@ -91,6 +93,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog() WebsiteDiagnosticOutput.StorageTable, properties, null)); + SetupProfile(null); + enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { CommandRuntime = commandRuntimeMock.Object, @@ -102,10 +106,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog() StorageTableName = tableName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( @@ -129,6 +131,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLogUseCurrent WebsiteDiagnosticOutput.StorageTable, properties, null)); + SetupProfile(storageName); + enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { CommandRuntime = commandRuntimeMock.Object, @@ -139,11 +143,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLogUseCurrent StorageTableName = tableName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - AzureSession.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount] = storageName; - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( @@ -167,6 +168,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLog() WebsiteDiagnosticOutput.StorageBlob, properties, null)); + SetupProfile(null); + enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { CommandRuntime = commandRuntimeMock.Object, @@ -178,10 +181,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLog() StorageBlobContainerName = blobContainerName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( @@ -205,6 +206,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLogUseCurrentS WebsiteDiagnosticOutput.StorageBlob, properties, null)); + SetupProfile(storageName); + enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { CommandRuntime = commandRuntimeMock.Object, @@ -215,11 +218,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLogUseCurrentS StorageBlobContainerName = blobContainerName }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - AzureSession.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount] = storageName; - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( @@ -240,6 +240,8 @@ public void EnableApplicationDiagnosticOnSlot() WebsiteDiagnosticOutput.FileSystem, properties, slot)); + + SetupProfile(null); enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand() { @@ -251,10 +253,8 @@ public void EnableApplicationDiagnosticOnSlot() Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new System.Guid(base.subscriptionId) }, null, null); - // Test - enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet(); + enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing(); // Assert websitesClientMock.Verify(f => f.EnableApplicationDiagnostic( diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs index 97b27ddd563d..54b65d29317d 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs @@ -17,14 +17,14 @@ using System.Linq; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -66,7 +66,10 @@ public void GetWebsiteMetricsBasicTest() CommandRuntime = new MockCommandRuntime(), WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; command.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs index 466f519b4e57..d56d94e81a2d 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs @@ -12,21 +12,22 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using Xunit; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; +using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Xunit; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -50,15 +51,15 @@ public void ProcessGetWebsiteTest() .Returns(new List { new Site { Name = "website1", WebSpace = "webspace1" }, new Site { Name = "website2", WebSpace = "webspace2" }}); + SetupProfile(null); // Test var getAzureWebsiteCommand = new GetAzureWebsiteCommand { CommandRuntime = new MockCommandRuntime(), WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); var sites = (IEnumerable)((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.FirstOrDefault(); Assert.NotNull(sites); @@ -89,6 +90,7 @@ public void GetWebsiteProcessShowTest() PublishingUsername = "user1"} ); + SetupProfile(null); // Test var getAzureWebsiteCommand = new GetAzureWebsiteCommand @@ -97,9 +99,8 @@ public void GetWebsiteProcessShowTest() Name = "website1", WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); SiteWithConfig website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig; @@ -108,6 +109,8 @@ public void GetWebsiteProcessShowTest() Assert.Equal("website1", website.Name); Assert.Equal("webspace1", website.WebSpace); + SetupProfile(null); + // Run with mixed casing getAzureWebsiteCommand = new GetAzureWebsiteCommand { @@ -115,9 +118,8 @@ public void GetWebsiteProcessShowTest() Name = "WEBSiTe1", WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig; @@ -130,15 +132,17 @@ public void GetWebsiteProcessShowTest() [Fact] public void ProcessGetWebsiteWithNullSubscription() { + currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + currentProfile.Subscriptions.Clear(); + currentProfile.Save(); + // Test var getAzureWebsiteCommand = new GetAzureWebsiteCommand { CommandRuntime = new MockCommandRuntime() }; - AzureSession.SetCurrentContext(null, null, null); - - Testing.AssertThrows(getAzureWebsiteCommand.ExecuteCmdlet, Resources.InvalidCurrentSubscription); + Testing.AssertThrows(getAzureWebsiteCommand.ExecuteWithProcessing, Resources.InvalidDefaultSubscription); } [Fact] @@ -158,6 +162,8 @@ public void TestGetAzureWebsiteWithDiagnosticsSettings() websitesClientMock.Setup(c => c.GetWebsiteConfiguration(It.IsAny(), slot)) .Returns(new SiteConfig {PublishingUsername = "user1"}); + SetupProfile(null); + var getAzureWebsiteCommand = new GetAzureWebsiteCommand { CommandRuntime = new MockCommandRuntime(), @@ -165,10 +171,9 @@ public void TestGetAzureWebsiteWithDiagnosticsSettings() WebsitesClient = websitesClientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); // Test - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); // Assert Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); @@ -199,6 +204,7 @@ public void GetsWebsiteSlot() PublishingUsername = "user1" }); + SetupProfile(null); // Test var getAzureWebsiteCommand = new GetAzureWebsiteCommand { @@ -207,9 +213,8 @@ public void GetsWebsiteSlot() WebsitesClient = clientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); var website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig; @@ -242,6 +247,8 @@ public void GetsSlots() PublishingUsername = "user1" }); + SetupProfile(null); + // Test var getAzureWebsiteCommand = new GetAzureWebsiteCommand { @@ -249,9 +256,8 @@ public void GetsSlots() WebsitesClient = clientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); - getAzureWebsiteCommand.ExecuteCmdlet(); + getAzureWebsiteCommand.ExecuteWithProcessing(); IEnumerable sites = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as IEnumerable; var website1 = sites.ElementAt(0); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs index 148fa84cd857..19318e4417fc 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs @@ -17,7 +17,7 @@ using System.Linq; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; @@ -25,7 +25,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -74,7 +74,10 @@ public void GetAzureWebsiteDeploymentTest() WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; getAzureWebsiteDeploymentCommand.ExecuteCmdlet(); @@ -129,7 +132,10 @@ public void GetAzureWebsiteDeploymentLogsTest() Details = true, CommandRuntime = new MockCommandRuntime(), }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; getAzureWebsiteDeploymentCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count); @@ -183,7 +189,10 @@ public void GetsDeploymentForSlot() CommandRuntime = new MockCommandRuntime(), Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; getAzureWebsiteDeploymentCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteLogTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteLogTests.cs index 62d8bd5421da..d93ee69a6a2e 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteLogTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteLogTests.cs @@ -85,7 +85,7 @@ public GetAzureWebsiteLogTests() } } }; - Cache.AddSite(getAzureWebsiteLogCmdlet.CurrentContext.Subscription.Id.ToString(), website); + Cache.AddSite(currentProfile.Context.Subscription.Id.ToString(), website); websitesClientMock.Setup(c => c.GetWebsite(websiteName, slot)) .Returns(website); } diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs index 2670efa213db..8455b3e38a41 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs @@ -15,15 +15,16 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; +using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Microsoft.WindowsAzure.Management.WebSites.Models; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -63,6 +64,7 @@ public void ProcessNewWebsiteTest() createdWebspaceName = space; }); + SetupProfile(null); // Test MockCommandRuntime mockRuntime = new MockCommandRuntime(); NewAzureWebsiteCommand newAzureWebsiteCommand = new NewAzureWebsiteCommand @@ -73,9 +75,8 @@ public void ProcessNewWebsiteTest() Location = webspaceName, WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); - newAzureWebsiteCommand.ExecuteCmdlet(); + newAzureWebsiteCommand.ExecuteWithProcessing(); Assert.Equal(websiteName, createdSiteName); Assert.Equal(webspaceName, createdWebspaceName); Assert.Equal(websiteName, (mockRuntime.OutputPipeline[0] as SiteWithConfig).Name); @@ -110,6 +111,8 @@ public void GetsWebsiteDefaultLocation() created = true; }); + SetupProfile(null); + // Test MockCommandRuntime mockRuntime = new MockCommandRuntime(); NewAzureWebsiteCommand newAzureWebsiteCommand = new NewAzureWebsiteCommand() @@ -119,9 +122,8 @@ public void GetsWebsiteDefaultLocation() Name = websiteName, WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); - newAzureWebsiteCommand.ExecuteCmdlet(); + newAzureWebsiteCommand.ExecuteWithProcessing(); Assert.True(created); Assert.Equal(websiteName, (mockRuntime.OutputPipeline[0] as SiteWithConfig).Name); clientMock.Verify(f => f.GetDefaultLocation(), Times.Once()); @@ -152,6 +154,7 @@ public void CreateStageSlot() clientMock.Setup(f => f.WebsiteExists(websiteName)).Returns(true); clientMock.Setup(f => f.GetWebsite(websiteName)).Returns(new Site() { Name = websiteName, Sku = SkuOptions.Standard, WebSpace = webspaceName }); + SetupProfile(null); // Test MockCommandRuntime mockRuntime = new MockCommandRuntime(); NewAzureWebsiteCommand newAzureWebsiteCommand = new NewAzureWebsiteCommand @@ -163,9 +166,8 @@ public void CreateStageSlot() WebsitesClient = clientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); - newAzureWebsiteCommand.ExecuteCmdlet(); + newAzureWebsiteCommand.ExecuteWithProcessing(); clientMock.Verify(c => c.CreateWebsite(webspaceName, It.IsAny(), slot), Times.Once()); } } diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs index 7d92d34adc01..f42157e2b5a9 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs @@ -15,14 +15,15 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; +using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -40,6 +41,8 @@ public void ProcessRemoveWebsiteTest() .Returns(new Site { Name = "website1", WebSpace = "webspace1" }); mockClient.Setup(c => c.DeleteWebsite("webspace1", "website1", slot)).Verifiable(); + SetupProfile(null); + // Test RemoveAzureWebsiteCommand removeAzureWebsiteCommand = new RemoveAzureWebsiteCommand { @@ -48,10 +51,9 @@ public void ProcessRemoveWebsiteTest() Name = "website1", Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); - + // Delete existing website - removeAzureWebsiteCommand.ExecuteCmdlet(); + removeAzureWebsiteCommand.ExecuteWithProcessing(); mockClient.Verify(c => c.DeleteWebsite("webspace1", "website1", slot), Times.Once()); } } diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs index e952048e6e09..e99200168854 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs @@ -15,13 +15,13 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -43,7 +43,11 @@ public void ProcessRestartWebsiteTest() Name = websiteName, WebsitesClient = websitesClientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restartAzureWebsiteCommand.ExecuteCmdlet(); @@ -68,7 +72,10 @@ public void RestartsWebsiteSlot() WebsitesClient = websitesClientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restartAzureWebsiteCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs index 114c851d2b8f..f5d72be4aa27 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs @@ -17,7 +17,7 @@ using System.Linq; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; @@ -25,7 +25,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -85,7 +85,10 @@ public void RestoreAzureWebsiteDeploymentTest() WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime) restoreAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count); @@ -104,7 +107,10 @@ public void RestoreAzureWebsiteDeploymentTest() WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)restoreAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count); @@ -170,7 +176,10 @@ public void RestoresDeploymentForSlot() CommandRuntime = new MockCommandRuntime(), Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet(); @@ -191,7 +200,10 @@ public void RestoresDeploymentForSlot() CommandRuntime = new MockCommandRuntime(), Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)restoreAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs index 0c878701c3c2..b2d12b5b2c66 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs @@ -18,7 +18,7 @@ using System.Text; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -86,7 +86,10 @@ public void SaveAzureWebsiteLogTest() WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); @@ -113,7 +116,10 @@ public void SaveAzureWebsiteLogWithNoFileExtensionTest() CommandRuntime = new MockCommandRuntime(), Output = "file_without_ext" }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); @@ -138,7 +144,10 @@ public void SaveAzureWebsiteLogWithSlotTest() CommandRuntime = new MockCommandRuntime(), Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs index 290079cb57d5..54f4016ff952 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs @@ -17,14 +17,14 @@ using System.Linq; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -75,7 +75,10 @@ public void SetAzureWebsiteProcess() NumberOfWorkers = 3, WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; setAzureWebsiteCommand.ExecuteCmdlet(); Assert.True(updatedSiteConfig); @@ -91,7 +94,10 @@ public void SetAzureWebsiteProcess() HostNames = new [] { "stuff.com" }, WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; setAzureWebsiteCommand.ExecuteCmdlet(); Assert.False(updatedSiteConfig); @@ -144,7 +150,10 @@ public void SetsWebsiteSlot() WebsitesClient = clientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; setAzureWebsiteCommand.ExecuteCmdlet(); Assert.True(updatedSiteConfig); @@ -161,7 +170,10 @@ public void SetsWebsiteSlot() WebsitesClient = clientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; setAzureWebsiteCommand.ExecuteCmdlet(); Assert.False(updatedSiteConfig); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs index f60098e641f8..b346e5f6ab29 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs @@ -16,7 +16,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Websites; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs index ab3c9b5129e4..5371d0ea9e1b 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs @@ -15,14 +15,14 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -49,7 +49,10 @@ public void ProcessShowWebsiteTest() Name = "website1", WebsitesClient = mockClient.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Show existing website showAzureWebsiteCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs index df9dee13dc96..494cbcfd5ad4 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs @@ -15,13 +15,13 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -44,7 +44,10 @@ public void ProcessStartWebsiteTest() Name = websiteName, WebsitesClient = websitesClientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; startAzureWebsiteCommand.ExecuteCmdlet(); @@ -69,7 +72,10 @@ public void StartsWebsiteSlot() WebsitesClient = websitesClientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; startAzureWebsiteCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs index 58c7f1acbc4b..aca3e6b47b6c 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs @@ -15,13 +15,13 @@ using System; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -44,7 +44,10 @@ public void ProcessStopWebsiteTest() Name = websiteName, WebsitesClient = websitesClientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; stopAzureWebsiteCommand.ExecuteCmdlet(); @@ -69,7 +72,10 @@ public void StopsWebsiteSlot() WebsitesClient = websitesClientMock.Object, Slot = slot }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; stopAzureWebsiteCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs index 099cbf223ca9..20c6131bfd1a 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs @@ -16,14 +16,14 @@ using System.Collections.Generic; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -56,7 +56,10 @@ public void SwitchesSlots() Name = "website1", Force = true }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Switch existing website switchAzureWebsiteCommand.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs index 5210c9759ced..87465ac96b37 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs @@ -16,14 +16,14 @@ using System.Collections.Generic; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { @@ -65,7 +65,10 @@ public void UpdatesRemote() WebsitesClient = mockClient.Object, Name = "website1", }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; // Switch existing website cmdlet.ExecuteCmdlet(); diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs index 52c4c19a050c..d372083f5f8e 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs @@ -18,14 +18,14 @@ using System.Linq; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites.WebHostingPlan; using Moq; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites.WebHostingPlans { @@ -53,7 +53,10 @@ public void ListWebHostingPlansTest() CommandRuntime = new MockCommandRuntime(), WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; command.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count); @@ -81,7 +84,10 @@ public void GetAzureWebHostingPlanBasicTest() CommandRuntime = new MockCommandRuntime(), WebsitesClient = clientMock.Object }; - AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(subscriptionId) }, null, null); + currentProfile = new AzureProfile(); + var subscription = new AzureSubscription{Id = new Guid(subscriptionId) }; + subscription.Properties[AzureSubscription.Property.Default] = "True"; + currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription; command.ExecuteCmdlet(); Assert.Equal(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count); diff --git a/src/ServiceManagement/Services/Commands.Test/packages.config b/src/ServiceManagement/Services/Commands.Test/packages.config index 8202f9e7214a..15a27217fd48 100644 --- a/src/ServiceManagement/Services/Commands.Test/packages.config +++ b/src/ServiceManagement/Services/Commands.Test/packages.config @@ -1,17 +1,19 @@  - - + + + - + + - + diff --git a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs index 3e5ceec09f22..a2dbbb599088 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs @@ -22,7 +22,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.Model; @@ -41,8 +41,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { using ConfigCertificate = Common.XmlSchema.ServiceConfigurationSchema.Certificate; using ConfigConfigurationSetting = Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; public class CloudServiceClient : ICloudServiceClient @@ -544,6 +544,7 @@ out serviceName /// Action used to log detailed client progress /// Action used to log warning messages public CloudServiceClient( + AzureProfile profile, AzureSubscription subscription, string currentLocation = null, Action debugStream = null, @@ -554,9 +555,9 @@ public CloudServiceClient( Subscription = subscription; CloudBlobUtility = new CloudBlobUtility(); - ManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); - StorageClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); - ComputeClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + ManagementClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); + StorageClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); + ComputeClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); } private CloudServiceClient(string currentLocation, Action debugStream, Action verboseStream, diff --git a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj index 3143af5c2ec6..de2c82b957c4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj @@ -57,17 +57,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -84,13 +84,13 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs index 40ef0cb6d6e2..bcf3a6d82c1d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs @@ -23,7 +23,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs index c21ea4fdb4aa..2f40429eed26 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs index 48dd6a294e94..8471a403f339 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Utilities; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs index dfff278043ad..01db3dc0ff4a 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs index d5a00b52369b..3692c859ff31 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs @@ -18,7 +18,7 @@ using System.Web.Script.Serialization; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs index efd3f357acd2..1535a9e71f19 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs @@ -16,9 +16,10 @@ using System.IO; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using Microsoft.WindowsAzure.Commands.Utilities.Properties; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { @@ -68,7 +69,7 @@ public PublishContext( { try { - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); SubscriptionId = client.Profile.Subscriptions.Values.Where(s => s.Name == settings.Subscription) .Select(s => s.Id.ToString()) diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs index f6fd5477ba61..e4182bd5e552 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs index 4d3077897178..23c0b7bf79d9 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs index 67d0f22aab6a..e85f53d8689d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PythonRules.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PythonRules.cs index 2d347a777af9..42d6064b8b5b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PythonRules.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PythonRules.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs index 9eae6d86279d..b15f56c7f452 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs @@ -20,7 +20,7 @@ using System.Xml.Linq; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs index 8a71dd4d11f4..558b7cfe530c 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceConfigurationSchema.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceConfigurationSchema.cs index 9c2e9a899813..07f097075884 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceConfigurationSchema.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceConfigurationSchema.cs @@ -10,7 +10,7 @@ // This source code was auto-generated by xsd, Version=4.0.30319.34014 using command: // xsd.exe "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\schemas\ServiceConfigurationSchema.xsd" -// /c /namespace:Microsoft.Azure.Common.Extensions.XmlSchema.ServiceConfigurationSchema +// /c /namespace:Microsoft.Azure.Common.Authentication.XmlSchema.ServiceConfigurationSchema // /language:cs namespace Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceDefinitionSchema.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceDefinitionSchema.cs index 0141831de1f5..841780eb1913 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceDefinitionSchema.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceDefinitionSchema.cs @@ -10,7 +10,7 @@ // This source code was auto-generated by xsd, Version=4.0.30319.34014 using command: // xsd.exe "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\schemas\ServiceDefinitionSchema.xsd" -// /c /namespace:Microsoft.Azure.Common.Extensions.XmlSchema.ServiceDefinitionSchema +// /c /namespace:Microsoft.Azure.Common.Authentication.XmlSchema.ServiceDefinitionSchema // /language:cs namespace Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs index 0f92dff06086..9c0591eabb4a 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs @@ -21,14 +21,14 @@ using System.ServiceModel.Dispatcher; using AutoMapper; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Management; using Microsoft.WindowsAzure.Management.Compute; using Microsoft.WindowsAzure.Management.Network; using Microsoft.WindowsAzure.Management.Storage; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; using Hyak.Common; @@ -53,22 +53,22 @@ protected ServiceManagementBaseCmdlet() public ManagementClient CreateClient() { - return AzureSession.ClientFactory.CreateClient(CurrentContext.Subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(Profile, Profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement); } public ComputeManagementClient CreateComputeClient() { - return AzureSession.ClientFactory.CreateClient(CurrentContext.Subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(Profile, Profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement); } public StorageManagementClient CreateStorageClient() { - return AzureSession.ClientFactory.CreateClient(CurrentContext.Subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(Profile, Profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement); } public NetworkManagementClient CreateNetworkClient() { - return AzureSession.ClientFactory.CreateClient(CurrentContext.Subscription, AzureEnvironment.Endpoint.ServiceManagement); + return AzureSession.ClientFactory.CreateClient(Profile, Profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement); } private Lazy client; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs index b1db82219311..dc96bb1723ec 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs @@ -21,7 +21,7 @@ using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs index ed35fcf13d2e..f2a01200577d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs @@ -22,7 +22,7 @@ using System.Xml; using System.Xml.Serialization; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services; using Microsoft.WindowsAzure.Management.MediaServices; @@ -30,7 +30,7 @@ using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Management.Storage.Models; using Newtonsoft.Json; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Utilities.MediaServices @@ -64,8 +64,11 @@ public MediaServicesClient(Action logger, IMediaServicesManagementClient /// /// The Microsoft Azure subscription data object /// The logger action - public MediaServicesClient(AzureSubscription subscription, Action logger) - : this(logger, AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement), AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement)) + public MediaServicesClient(AzureProfile profile, AzureSubscription subscription, Action logger) + : this( + logger, + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement), + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement)) { } diff --git a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerBaseCmdlet.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerBaseCmdlet.cs index f344e69c5b60..b71c4c2d5621 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerBaseCmdlet.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerBaseCmdlet.cs @@ -26,7 +26,7 @@ public SchedulerMgmntClient SMClient { if (schedulerMgmntClient == null) { - schedulerMgmntClient = new SchedulerMgmntClient(CurrentContext.Subscription); + schedulerMgmntClient = new SchedulerMgmntClient(Profile, Profile.Context.Subscription); } return schedulerMgmntClient; } diff --git a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs index c678fe40b48c..65ddcc09af41 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Model; using Microsoft.WindowsAzure.Scheduler; using Microsoft.WindowsAzure.Scheduler.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Scheduler { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs index e48cdc6edd3f..b15512878ef7 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Common; using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Model; @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Management.Scheduler.Models; using Microsoft.WindowsAzure.Scheduler; using Microsoft.WindowsAzure.Scheduler.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Utilities.Scheduler @@ -55,11 +55,11 @@ public partial class SchedulerMgmntClient /// Creates new Scheduler Management Convenience Client /// /// Subscription containing websites to manipulate - public SchedulerMgmntClient(AzureSubscription subscription) + public SchedulerMgmntClient(AzureProfile profile, AzureSubscription subscription) { currentSubscription = subscription; - csmClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); - schedulerManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + csmClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); + schedulerManagementClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); //Get RP properties IDictionary dict = schedulerManagementClient.GetResourceProviderProperties().Properties; diff --git a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs index efe36786dcb8..cc24f87f019a 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs @@ -22,7 +22,7 @@ using Microsoft.ServiceBus.Messaging; using Microsoft.ServiceBus.Notifications; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Management.ServiceBus; using Microsoft.WindowsAzure.Management.ServiceBus.Models; @@ -30,8 +30,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.ServiceBus { using ServiceBusNamespaceDescription = Management.ServiceBus.Models.NamespaceDescription; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; public class ServiceBusClientExtensions @@ -290,11 +290,11 @@ public ServiceBusClientExtensions() /// Creates new instance from ServiceBusClientExtensions /// /// - public ServiceBusClientExtensions(AzureSubscription subscription) + public ServiceBusClientExtensions(AzureProfile profile, AzureSubscription subscription) { subscriptionId = subscription.Id.ToString(); Subscription = subscription; - ServiceBusClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + ServiceBusClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); } /// diff --git a/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs index dfa975d3c4f0..2b82689bbeb8 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs @@ -19,7 +19,7 @@ using System.Security.Cryptography; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.MarketplaceServiceReference; using Microsoft.WindowsAzure.Commands.Utilities.Properties; @@ -32,8 +32,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Store { using Resource = Management.Store.Models.CloudServiceListResponse.CloudService.AddOnResource; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; public class StoreClient { @@ -139,13 +139,13 @@ public StoreClient() /// Creates new instance from the store client. /// /// The Microsoft Azure subscription - public StoreClient(AzureSubscription subscription) + public StoreClient(AzureProfile profile, AzureSubscription subscription) : this( subscription, - AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement), - AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement), + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement), + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement), new MarketplaceClient(), - AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement)) { } + AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement)) { } public StoreClient( AzureSubscription subscription, diff --git a/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs b/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs index c8b00a60b2f0..de115746f071 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs @@ -17,9 +17,10 @@ using System.Security; using System.Security.Cryptography.X509Certificates; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.Utilities.WAPackIaaS.WebClient { @@ -58,7 +59,7 @@ internal Subscription(AzureSubscription azureSubscription) throw new ArgumentNullException(); } - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); var environment = client.GetEnvironmentOrDefault(azureSubscription.Environment); this.SubscriptionName = azureSubscription.Name; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Common/WebsiteBaseCmdlet.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Common/WebsiteBaseCmdlet.cs index 1f20281e182d..8b723d20e5f4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Common/WebsiteBaseCmdlet.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Common/WebsiteBaseCmdlet.cs @@ -26,7 +26,7 @@ public IWebsitesClient WebsitesClient { if (websitesClient == null) { - websitesClient = new WebsitesClient(CurrentContext.Subscription, WriteDebug); + websitesClient = new WebsitesClient(Profile, Profile.Context.Subscription, WriteDebug); } return websitesClient; } diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs index d01d08427868..6f723e751952 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs @@ -17,8 +17,8 @@ using System.Net.Http; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Factories; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Factories; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs index b5c18f3badee..11fe3c14f9ce 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs index 2a9b78ac97af..082caae89f5b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs @@ -17,7 +17,7 @@ using System.Linq; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs index 6d081e1819c4..dd8255ef943d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs @@ -27,7 +27,7 @@ using Microsoft.Build.Logging; using Microsoft.Web.Deployment; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -47,8 +47,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Websites { using Utilities = Services.WebEntities; - using Microsoft.Azure.Common.Extensions.Models; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; public class WebsitesClient : IWebsitesClient @@ -70,11 +70,11 @@ public class WebsitesClient : IWebsitesClient /// /// Subscription containing websites to manipulate /// The logger action - public WebsitesClient(AzureSubscription subscription, Action logger) + public WebsitesClient(AzureProfile profile, AzureSubscription subscription, Action logger) { Logger = logger; - cloudServiceClient = new CloudServiceClient(subscription, debugStream: logger); - WebsiteManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + cloudServiceClient = new CloudServiceClient(profile, subscription, debugStream: logger); + WebsiteManagementClient = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.subscription = subscription; } diff --git a/src/ServiceManagement/Services/Commands.Utilities/packages.config b/src/ServiceManagement/Services/Commands.Utilities/packages.config index 728874e25f3a..430b44eccf50 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/packages.config +++ b/src/ServiceManagement/Services/Commands.Utilities/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -12,7 +12,7 @@ - + diff --git a/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs b/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs index cf1eb84ce317..e7ca9869c1a2 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs @@ -30,7 +30,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Certificate = Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.Certificate; using ConfigurationSetting = Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs index 18fe8452fa07..b8d56ff6a556 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands/CloudService/PublishAzureServiceProject.cs b/src/ServiceManagement/Services/Commands/CloudService/PublishAzureServiceProject.cs index 6864ee103316..ba3732eb5b47 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/PublishAzureServiceProject.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/PublishAzureServiceProject.cs @@ -78,7 +78,8 @@ public class PublishAzureServiceProjectCommand : AzurePSCmdlet public override void ExecuteCmdlet() { CloudServiceClient = CloudServiceClient ?? new CloudServiceClient( - CurrentContext.Subscription, + Profile, + Profile.Context.Subscription, SessionState.Path.CurrentLocation.Path, WriteDebug, WriteVerbose, diff --git a/src/ServiceManagement/Services/Commands/CloudService/RemoveAzureService.cs b/src/ServiceManagement/Services/Commands/CloudService/RemoveAzureService.cs index 8a687e3a63f8..330fb807fabe 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/RemoveAzureService.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/RemoveAzureService.cs @@ -49,7 +49,8 @@ public override void ExecuteCmdlet() () => { CloudServiceClient = CloudServiceClient ?? new CloudServiceClient( - CurrentContext.Subscription, + Profile, + Profile.Context.Subscription, SessionState.Path.CurrentLocation.Path, WriteDebug, WriteVerbose, diff --git a/src/ServiceManagement/Services/Commands/CloudService/StartAzureService.cs b/src/ServiceManagement/Services/Commands/CloudService/StartAzureService.cs index 78ae43020ec4..82257b8cc935 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/StartAzureService.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/StartAzureService.cs @@ -38,7 +38,8 @@ public class StartAzureServiceCommand : AzurePSCmdlet public override void ExecuteCmdlet() { CloudServiceClient = CloudServiceClient ?? new CloudServiceClient( - CurrentContext.Subscription, + Profile, + Profile.Context.Subscription, SessionState.Path.CurrentLocation.Path, WriteDebug, WriteVerbose, diff --git a/src/ServiceManagement/Services/Commands/CloudService/StopAzureService.cs b/src/ServiceManagement/Services/Commands/CloudService/StopAzureService.cs index aeb03bb8f8aa..bfabfcb20006 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/StopAzureService.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/StopAzureService.cs @@ -38,7 +38,8 @@ public class StopAzureServiceCommand : AzurePSCmdlet public override void ExecuteCmdlet() { CloudServiceClient = CloudServiceClient ?? new CloudServiceClient( - CurrentContext.Subscription, + Profile, + Profile.Context.Subscription, SessionState.Path.CurrentLocation.Path, WriteDebug, WriteVerbose, diff --git a/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs b/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs index 1c8f38e2ebc9..143fc7096687 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs @@ -14,12 +14,12 @@ using System.IO; using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.ServiceBus; using Microsoft.WindowsAzure.Commands.Utilities.Websites; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.CloudService { @@ -77,6 +77,7 @@ public bool IsServiceBusNamespaceAvailable(string subscriptionId, string name) private void EnsureCloudServiceClientInitialized(AzureSubscription subscription) { this.CloudServiceClient = this.CloudServiceClient ?? new CloudServiceClient( + Profile, subscription, SessionState.Path.CurrentLocation.Path, WriteDebug, @@ -97,21 +98,21 @@ public override void ExecuteCmdlet() if (Service.IsPresent) { - IsDNSAvailable(CurrentContext.Subscription, Name); + IsDNSAvailable(Profile.Context.Subscription, Name); } else if (Storage.IsPresent) { - IsStorageServiceAvailable(CurrentContext.Subscription, Name); + IsStorageServiceAvailable(Profile.Context.Subscription, Name); } else if (Website.IsPresent) { - WebsitesClient = WebsitesClient ?? new WebsitesClient(CurrentContext.Subscription, WriteDebug); + WebsitesClient = WebsitesClient ?? new WebsitesClient(Profile, Profile.Context.Subscription, WriteDebug); IsWebsiteAvailable(Name); } else { - ServiceBusClient = ServiceBusClient ?? new ServiceBusClientExtensions(CurrentContext.Subscription); - IsServiceBusNamespaceAvailable(CurrentContext.Subscription.Id.ToString(), Name); + ServiceBusClient = ServiceBusClient ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); + IsServiceBusNamespaceAvailable(Profile.Context.Subscription.Id.ToString(), Name); } } diff --git a/src/ServiceManagement/Services/Commands/Commands.csproj b/src/ServiceManagement/Services/Commands/Commands.csproj index b745dd31d91c..178cd947b869 100644 --- a/src/ServiceManagement/Services/Commands/Commands.csproj +++ b/src/ServiceManagement/Services/Commands/Commands.csproj @@ -55,17 +55,17 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.dll - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -82,13 +82,13 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll @@ -343,7 +343,9 @@ - + + Designer + diff --git a/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs b/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs index 9f32f435bd8d..2afd5c031d8f 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs @@ -14,7 +14,7 @@ using System; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.MediaServices { diff --git a/src/ServiceManagement/Services/Commands/MediaServices/GetAzureMediaServiceCommand.cs b/src/ServiceManagement/Services/Commands/MediaServices/GetAzureMediaServiceCommand.cs index 77094d3226c1..56462abba333 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/GetAzureMediaServiceCommand.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/GetAzureMediaServiceCommand.cs @@ -49,7 +49,7 @@ protected virtual void WriteMediaAccounts(IEnumerable media /// public override void ExecuteCmdlet() { - MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(CurrentContext.Subscription, WriteDebug); + MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(Profile, Profile.Context.Subscription, WriteDebug); if (!string.IsNullOrEmpty(Name)) { diff --git a/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceCommand.cs b/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceCommand.cs index 32f8dac91a4d..2291552978fc 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceCommand.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceCommand.cs @@ -44,7 +44,7 @@ public class NewAzureMediaServiceCommand : AzureMediaServicesHttpClientCommandBa public override void ExecuteCmdlet() { - MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(CurrentContext.Subscription, WriteDebug); + MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(Profile, Profile.Context.Subscription, WriteDebug); StorageAccountGetKeysResponse storageKeysResponse = null; Uri storageEndPoint = null; diff --git a/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceKeyCommand.cs b/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceKeyCommand.cs index dd909b321a2c..07706c33a72d 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceKeyCommand.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/NewAzureMediaServiceKeyCommand.cs @@ -60,7 +60,7 @@ public override void ExecuteCmdlet() string.Empty, () => { - MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(CurrentContext.Subscription, WriteDebug); + MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(Profile, Profile.Context.Subscription, WriteDebug); AzureOperationResponse result = null; diff --git a/src/ServiceManagement/Services/Commands/MediaServices/RemoveAzureMediaServiceCommand.cs b/src/ServiceManagement/Services/Commands/MediaServices/RemoveAzureMediaServiceCommand.cs index 067226918340..98e81948b3c3 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/RemoveAzureMediaServiceCommand.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/RemoveAzureMediaServiceCommand.cs @@ -43,7 +43,7 @@ public override void ExecuteCmdlet() string.Empty, () => { - MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(CurrentContext.Subscription, WriteDebug); + MediaServicesClient = MediaServicesClient ?? new MediaServicesClient(Profile, Profile.Context.Subscription, WriteDebug); AzureOperationResponse result = null; diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBAuthorizationRule.cs b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBAuthorizationRule.cs index 5be43294c85f..b482dd87d14e 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBAuthorizationRule.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBAuthorizationRule.cs @@ -62,7 +62,7 @@ public class GetAzureSBAuthorizationRuleCommand : AzurePSCmdlet public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); List rules = null; List output = new List(); AuthorizationRuleFilterOption options = new AuthorizationRuleFilterOption() diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBLocation.cs b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBLocation.cs index e53ae17c3712..6f4ef9786d5c 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBLocation.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBLocation.cs @@ -33,7 +33,7 @@ public class GetAzureSBLocationCommand : AzurePSCmdlet /// public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); WriteObject(Client.GetServiceBusRegions(), true); } } diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBNamespace.cs b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBNamespace.cs index e42970fb03c7..c60c3d2ac032 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBNamespace.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBNamespace.cs @@ -35,7 +35,7 @@ public class GetAzureSBNamespaceCommand : AzurePSCmdlet /// public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); if (string.IsNullOrEmpty(Name)) { diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBAuthorizationRule.cs b/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBAuthorizationRule.cs index 261ccab7e55d..32f2a72236d9 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBAuthorizationRule.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBAuthorizationRule.cs @@ -62,7 +62,7 @@ public class NewAzureSBAuthorizationRuleCommand : AzurePSCmdlet public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); ExtendedAuthorizationRule rule = null; PSObject output = null; diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBNamespace.cs b/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBNamespace.cs index c5bbe1e1acc3..cc063f0d1249 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBNamespace.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBNamespace.cs @@ -45,7 +45,7 @@ public class NewAzureSBNamespaceCommand : AzurePSCmdlet /// public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); if (CreateACSNamespace.HasValue) { WriteObject(Client.CreateNamespace(Name, Location, NamespaceType, CreateACSNamespace.Value)); diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBAuthorizationRule.cs b/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBAuthorizationRule.cs index 30d6a024011a..d31a46815a09 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBAuthorizationRule.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBAuthorizationRule.cs @@ -56,7 +56,7 @@ public class RemoveAzureSBAuthorizationRuleCommand : AzurePSCmdlet public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); AuthorizationRuleFilterOption options = new AuthorizationRuleFilterOption() { Namespace = Namespace, diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBNamespace.cs b/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBNamespace.cs index 8611fe921e07..ebcf49798aea 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBNamespace.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBNamespace.cs @@ -48,7 +48,7 @@ public override void ExecuteCmdlet() Name, () => { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); Client.RemoveNamespace(Name); if (PassThru) diff --git a/src/ServiceManagement/Services/Commands/ServiceBus/SetAzureSBAuthorizationRule.cs b/src/ServiceManagement/Services/Commands/ServiceBus/SetAzureSBAuthorizationRule.cs index 7dea9d882656..c18a24120d69 100644 --- a/src/ServiceManagement/Services/Commands/ServiceBus/SetAzureSBAuthorizationRule.cs +++ b/src/ServiceManagement/Services/Commands/ServiceBus/SetAzureSBAuthorizationRule.cs @@ -66,7 +66,7 @@ public class SetAzureSBAuthorizationRuleCommand : AzurePSCmdlet public override void ExecuteCmdlet() { - Client = Client ?? new ServiceBusClientExtensions(CurrentContext.Subscription); + Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription); ExtendedAuthorizationRule rule = null; PSObject output = null; diff --git a/src/ServiceManagement/Services/Commands/Store/GetAzureStoreAddOn.cs b/src/ServiceManagement/Services/Commands/Store/GetAzureStoreAddOn.cs index 1aa91436bf9f..fdbef16bed7a 100644 --- a/src/ServiceManagement/Services/Commands/Store/GetAzureStoreAddOn.cs +++ b/src/ServiceManagement/Services/Commands/Store/GetAzureStoreAddOn.cs @@ -64,14 +64,14 @@ public override void ExecuteCmdlet() private void GetAddOn() { - StoreClient = StoreClient ?? new StoreClient(CurrentContext.Subscription); + StoreClient = StoreClient ?? new StoreClient(Profile, Profile.Context.Subscription); List addOns = StoreClient.GetAddOn(new AddOnSearchOptions(Name, null, null)); WriteObject(addOns, true); } private void ListAvailableAddOns() { - StoreClient = StoreClient ?? new StoreClient(CurrentContext.Subscription); + StoreClient = StoreClient ?? new StoreClient(Profile, Profile.Context.Subscription); MarketplaceClient = MarketplaceClient ?? new MarketplaceClient(StoreClient.GetLocations().Select(l => l.Name)); diff --git a/src/ServiceManagement/Services/Commands/Store/NewAzureStoreAddOn.cs b/src/ServiceManagement/Services/Commands/Store/NewAzureStoreAddOn.cs index 648f0dec7030..8e6bed499717 100644 --- a/src/ServiceManagement/Services/Commands/Store/NewAzureStoreAddOn.cs +++ b/src/ServiceManagement/Services/Commands/Store/NewAzureStoreAddOn.cs @@ -49,7 +49,7 @@ public class NewAzureStoreAddOnCommand : ServiceManagementBaseCmdlet [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] public override void ExecuteCmdlet() { - StoreClient = StoreClient ?? new StoreClient(CurrentContext.Subscription); + StoreClient = StoreClient ?? new StoreClient(Profile, Profile.Context.Subscription); WindowsAzureAddOn addon; CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host); diff --git a/src/ServiceManagement/Services/Commands/Store/RemoveAzureStoreAddOn.cs b/src/ServiceManagement/Services/Commands/Store/RemoveAzureStoreAddOn.cs index 4934c86409f4..5e5d38a7c262 100644 --- a/src/ServiceManagement/Services/Commands/Store/RemoveAzureStoreAddOn.cs +++ b/src/ServiceManagement/Services/Commands/Store/RemoveAzureStoreAddOn.cs @@ -40,7 +40,7 @@ public class RemoveAzureStoreAddOnCommand : ServiceManagementBaseCmdlet [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] public override void ExecuteCmdlet() { - StoreClient = StoreClient ?? new StoreClient(CurrentContext.Subscription); + StoreClient = StoreClient ?? new StoreClient(Profile, Profile.Context.Subscription); CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host); string message = StoreClient.GetConfirmationMessage(OperationType.Remove); diff --git a/src/ServiceManagement/Services/Commands/Store/SetAzureStoreAddOn.cs b/src/ServiceManagement/Services/Commands/Store/SetAzureStoreAddOn.cs index 99649e45a533..6af0dc2dac6f 100644 --- a/src/ServiceManagement/Services/Commands/Store/SetAzureStoreAddOn.cs +++ b/src/ServiceManagement/Services/Commands/Store/SetAzureStoreAddOn.cs @@ -45,7 +45,7 @@ public class SetAzureStoreAddOnCommand : ServiceManagementBaseCmdlet [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] public override void ExecuteCmdlet() { - StoreClient = StoreClient ?? new StoreClient(CurrentContext.Subscription); + StoreClient = StoreClient ?? new StoreClient(Profile, Profile.Context.Subscription); CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host); WindowsAzureAddOn addon; diff --git a/src/ServiceManagement/Services/Commands/WAPackIaaS/IaaSCmdletBase.cs b/src/ServiceManagement/Services/Commands/WAPackIaaS/IaaSCmdletBase.cs index cb85e4269cdf..bcb549ec8033 100644 --- a/src/ServiceManagement/Services/Commands/WAPackIaaS/IaaSCmdletBase.cs +++ b/src/ServiceManagement/Services/Commands/WAPackIaaS/IaaSCmdletBase.cs @@ -65,9 +65,9 @@ internal Subscription Subscription { if (subscription == null) { - if (CurrentContext.Subscription != null) + if (Profile.Context.Subscription != null) { - subscription = new Subscription(CurrentContext.Subscription); + subscription = new Subscription(Profile.Context.Subscription); } } diff --git a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs index 503cc72e53c5..79d491c40c1a 100644 --- a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs +++ b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.DeploymentEntities; @@ -69,7 +69,7 @@ public override void ExecuteCmdlet() else if (TableStorage.IsPresent || BlobStorage.IsPresent) { properties[DiagnosticProperties.StorageAccountName] = string.IsNullOrEmpty(StorageAccountName) ? - CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount) : StorageAccountName; + Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount) : StorageAccountName; if (TableStorage.IsPresent) { diff --git a/src/ServiceManagement/Services/Commands/Websites/GetAzureWebSite.cs b/src/ServiceManagement/Services/Commands/Websites/GetAzureWebSite.cs index d57bf9daf246..018f305f44f6 100644 --- a/src/ServiceManagement/Services/Commands/Websites/GetAzureWebSite.cs +++ b/src/ServiceManagement/Services/Commands/Websites/GetAzureWebSite.cs @@ -60,7 +60,7 @@ private void GetByName() if (string.IsNullOrEmpty(Slot)) { List websites = WebsitesClient.GetWebsiteSlots(Name); - Cache.SaveSites(CurrentContext.Subscription.Id.ToString(), new Sites(websites)); + Cache.SaveSites(Profile.Context.Subscription.Id.ToString(), new Sites(websites)); if (websites.Count > 1) { @@ -122,7 +122,7 @@ private void GetNoName() websites = WebsitesClient.ListWebsites(Slot); } - Cache.SaveSites(CurrentContext.Subscription.Id.ToString(), new Sites(websites)); + Cache.SaveSites(Profile.Context.Subscription.Id.ToString(), new Sites(websites)); WriteWebsites(websites); }); } diff --git a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs index 60894f57babe..72d5a0f81b8c 100644 --- a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs +++ b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs @@ -32,7 +32,7 @@ namespace Microsoft.WindowsAzure.Commands.Websites { using GitClass = Utilities.Websites.Services.Git; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; using Hyak.Common; /// @@ -323,7 +323,7 @@ private Site CreateNewSite(string suffix) { // Create webspace with VirtualPlan failed, try with subscription id // This supports Windows Azure Pack - webspace.Plan = CurrentContext.Subscription.Id.ToString(); + webspace.Plan = Profile.Context.Subscription.Id.ToString(); result = CreateSite(webspace, website); } return result; @@ -369,7 +369,7 @@ private WebSpace WebSpaceForLocation(string location) { Name = Regex.Replace(location.ToLower(), " ", "") + "webspace", GeoRegion = location, - Subscription = CurrentContext.Subscription.Id.ToString(), + Subscription = Profile.Context.Subscription.Id.ToString(), Plan = "VirtualDedicatedPlan" }; } @@ -394,7 +394,7 @@ private Site CreateSite(WebSpace webspace, SiteWithWebSpace website) createdWebsite = WebsitesClient.GetWebsite(website.Name); - Cache.AddSite(CurrentContext.Subscription.Id.ToString(), createdWebsite); + Cache.AddSite(Profile.Context.Subscription.Id.ToString(), createdWebsite); SiteConfig websiteConfiguration = WebsitesClient.GetWebsiteConfiguration(createdWebsite.Name, Slot); WriteObject(new SiteWithConfig(createdWebsite, websiteConfiguration)); } diff --git a/src/ServiceManagement/Services/Commands/Websites/RemoveAzureWebSite.cs b/src/ServiceManagement/Services/Commands/Websites/RemoveAzureWebSite.cs index 626e2cb2dcfe..482fbb18ba15 100644 --- a/src/ServiceManagement/Services/Commands/Websites/RemoveAzureWebSite.cs +++ b/src/ServiceManagement/Services/Commands/Websites/RemoveAzureWebSite.cs @@ -48,7 +48,7 @@ public override void ExecuteCmdlet() { Site websiteObject = WebsitesClient.GetWebsite(Name, Slot); WebsitesClient.DeleteWebsite(websiteObject.WebSpace, Name, Slot); - Cache.RemoveSite(CurrentContext.Subscription.Id.ToString(), websiteObject); + Cache.RemoveSite(Profile.Context.Subscription.Id.ToString(), websiteObject); } catch (CloudException) { diff --git a/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs b/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs index 38c49306e520..28348ec23121 100644 --- a/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs +++ b/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs @@ -14,10 +14,10 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Websites { @@ -57,11 +57,11 @@ public override void ExecuteCmdlet() AzureEnvironment environment; if (string.IsNullOrEmpty(Environment)) { - environment = AzureSession.CurrentContext.Environment; + environment = Profile.Context.Environment; } else { - environment = DefaultProfileClient.Profile.Environments[Environment]; + environment = Profile.Environments[Environment]; } string managementPortalUrl = environment.GetManagementPortalUrlWithRealm(Realm); diff --git a/src/ServiceManagement/Services/Commands/packages.config b/src/ServiceManagement/Services/Commands/packages.config index 90675ca4f136..88f476c7a28a 100644 --- a/src/ServiceManagement/Services/Commands/packages.config +++ b/src/ServiceManagement/Services/Commands/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj index 5bf23e9e0fd6..c2b2679c0a7e 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj @@ -49,17 +49,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -73,12 +73,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs index f95acb7f8976..5aaa9d924df7 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs @@ -16,7 +16,7 @@ using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.FunctionalTests { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs index 9da5e0011c3c..5cbf27b7c832 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs @@ -19,7 +19,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs index 72b8006ee7e6..5932cc9c0070 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs @@ -18,7 +18,7 @@ using System.Management.Automation; using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs index ad8846138cd9..e44858c1c471 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs @@ -19,7 +19,7 @@ using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs index bf559a0278bc..abb8884b0d7b 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs @@ -18,7 +18,7 @@ using System.Text.RegularExpressions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.Utilities; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs index 0d7a63866b9f..62632827ee2e 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs @@ -18,7 +18,8 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; @@ -42,6 +43,19 @@ public void CleanupTest() public void TestGetManageUrl() { NewAzureSqlDatabaseServerContext contextCmdlet = new NewAzureSqlDatabaseServerContext(); + var profile = new AzureProfile(); + var account = new AzureAccount {Id = "mockAccount", Type = AzureAccount.AccountType.User}; + var subscription = new AzureSubscription + { + Account = "mockAccount", + Environment = EnvironmentName.AzureCloud, + Id = Guid.NewGuid(), + Name = "mockSubscription" + }; + profile.Accounts.Add(account.Id, account); + profile.Subscriptions.Add(subscription.Id, subscription); + profile.DefaultSubscription = subscription; + contextCmdlet.Profile = profile; // Make sure that server name to Manage Url conversion is working contextCmdlet.ServerName = "server0001"; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs index 3e4ceeac3e8d..7cba63f01036 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs index a03bd2d3594f..484e725b392d 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs @@ -22,11 +22,11 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer { @@ -171,10 +171,10 @@ public static WebException CreateWebException( public static void SetupCertificates() { TestingTracingInterceptor.AddToContext(); - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(); var newGuid = Guid.NewGuid(); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.Profile.Subscriptions[newGuid] = new AzureSubscription { Id = newGuid, @@ -209,9 +209,7 @@ public static void SetupCertificates() {AzureAccount.Property.Subscriptions, newGuid.ToString()} } }; - AzureSession.SetCurrentContext(client.Profile.Subscriptions[newGuid], - null, client.Profile.Accounts["test"]); - + client.SetSubscriptionAsDefault(newGuid, "test"); client.Profile.Save(); diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs index b83b2ae15109..3f92417cbb9e 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Database.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs index 97254adb0701..3c83905c1b6c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs @@ -23,9 +23,9 @@ using System.Security.Cryptography.X509Certificates; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests { @@ -298,7 +298,7 @@ public static AzureSubscription SetupUnitTestSubscription(System.Management.Auto "clientCertificate", certificate); - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); client.Profile.Environments[UnitTestEnvironmentName] = new AzureEnvironment { Name = UnitTestEnvironmentName, @@ -325,7 +325,7 @@ public static AzureSubscription SetupUnitTestSubscription(System.Management.Auto client.AddOrSetAccount(account); client.AddOrSetSubscription(subscription); - client.SetSubscriptionAsCurrent(UnitTestSubscriptionName, account.Id); + client.SetSubscriptionAsDefault(UnitTestSubscriptionName, account.Id); client.Profile.Save(); return subscription; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config index 3325a3b5e275..bf6a5c838efe 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj index b42fc5c279aa..cb3a7f862123 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj @@ -52,17 +52,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll - True + + False + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -77,12 +77,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs index 9c6deb7746cb..6c24bc034192 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -136,7 +136,7 @@ public override void ExecuteCmdlet() break; case ByServerName: - context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.CurrentContext.Subscription); + context = ServerDataServiceCertAuth.Create(this.ServerName, Profile, Profile.Context.Subscription); break; default: diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs index aaefb6e0c3b6..f3b907f4264f 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs @@ -22,7 +22,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; /// /// Retrieves a list of all ongoing Microsoft Azure SQL Database copy operations in the given @@ -118,7 +118,8 @@ public override void ExecuteCmdlet() // Use the provided ServerDataServiceContext or create one from the // provided ServerName and the active subscription. IServerDataServiceContext context = ServerDataServiceCertAuth.Create(this.ServerName, - AzureSession.CurrentContext.Subscription); + Profile, + Profile.Context.Subscription); try { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs index 34067c97e70b..e5b126b3a8bf 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs @@ -19,8 +19,8 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -174,7 +174,7 @@ public override void ExecuteCmdlet() var status = this.GetAzureSqlDatabaseImportExportStatusProcess( serverName, - serverName + AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix), + serverName + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix), userName, password, requestId); diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs index 2eb455284457..6d18c10a69b0 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -111,7 +111,7 @@ public override void ExecuteCmdlet() break; case ByServerName: - context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.CurrentContext.Subscription); + context = ServerDataServiceCertAuth.Create(this.ServerName, Profile, Profile.Context.Subscription); break; } ProcessWithContext(context); diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs index 1c644705ad7e..3a68f50dff60 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -98,7 +98,7 @@ public override void ExecuteCmdlet() break; case ByServerName: - context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.CurrentContext.Subscription); + context = ServerDataServiceCertAuth.Create(this.ServerName, Profile, Profile.Context.Subscription); break; default: diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs index cf085ab42159..c6612d0cbac5 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs @@ -15,12 +15,12 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -171,11 +171,11 @@ private void ProcessWithServerName(int? maxSizeGb, long? maxSizeBytes) try { // Get the current subscription data. - AzureSubscription subscription = AzureSession.CurrentContext.Subscription; + AzureSubscription subscription = Profile.Context.Subscription; // Create a temporary context ServerDataServiceCertAuth context = - ServerDataServiceCertAuth.Create(this.ServerName, subscription); + ServerDataServiceCertAuth.Create(this.ServerName, Profile, subscription); GetClientRequestId = () => context.ClientRequestId; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs index 2a1e399592c5..ac9d0bab1de3 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs @@ -18,12 +18,13 @@ using System.Management.Automation; using System.Xml.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; +using System.IO; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -151,10 +152,10 @@ private AzureSubscription CurrentSubscription { if (string.IsNullOrEmpty(SubscriptionName)) { - return AzureSession.CurrentContext.Subscription; + return Profile.Context.Subscription; } - ProfileClient client = new ProfileClient(); + ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile))); return client.Profile.Subscriptions.Values.First( s => SubscriptionName == s.Name); @@ -216,7 +217,7 @@ internal ServerDataServiceCertAuth GetServerDataServiceByCertAuth( try { - context = ServerDataServiceCertAuth.Create(serverName, subscription); + context = ServerDataServiceCertAuth.Create(serverName, Profile, subscription); } catch (ArgumentException e) { @@ -311,7 +312,7 @@ private Uri GetManageUrl(string parameterSetName) // and append the azure database DNS suffix. return new Uri( Uri.UriSchemeHttps + Uri.SchemeDelimiter + - this.ServerName + AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix)); + this.ServerName + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix)); case FullyQualifiedServerNameWithSqlAuthParamSet: case FullyQualifiedServerNameWithCertAuthParamSet: // The fully qualified server name was specified, diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs index 68bb1ccdc563..a75af47d6d32 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs @@ -16,12 +16,12 @@ using System.Globalization; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -201,11 +201,11 @@ private void ProcessWithServerName(string databaseName) try { // Get the current subscription data. - AzureSubscription subscription = AzureSession.CurrentContext.Subscription; + AzureSubscription subscription = Profile.Context.Subscription; // Create a temporary context ServerDataServiceCertAuth context = - ServerDataServiceCertAuth.Create(this.ServerName, subscription); + ServerDataServiceCertAuth.Create(this.ServerName, Profile, subscription); GetClientRequestId = () => context.ClientRequestId; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs index 7292204dabe6..4a95756f2ecd 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs @@ -16,12 +16,12 @@ using System.Globalization; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -280,11 +280,11 @@ private void ProcessWithServerName(string databaseName, int? maxSizeGb, long? ma try { // Get the current subscription data. - AzureSubscription subscription = AzureSession.CurrentContext.Subscription; + AzureSubscription subscription = Profile.Context.Subscription; // Create a temporary context ServerDataServiceCertAuth context = - ServerDataServiceCertAuth.Create(this.ServerName, subscription); + ServerDataServiceCertAuth.Create(this.ServerName, Profile, subscription); GetClientRequestId = () => context.ClientRequestId; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs index 5fa5166b8d68..ea6e1448bc06 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs @@ -24,7 +24,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; /// /// Start a copy operation for a Microsoft Azure SQL Database in the given server context. @@ -188,7 +188,8 @@ public override void ExecuteCmdlet() // Use the provided ServerDataServiceContext or create one from the // provided ServerName and the active subscription. IServerDataServiceContext context = ServerDataServiceCertAuth.Create(this.ServerName, - AzureSession.CurrentContext.Subscription); + Profile, + Profile.Context.Subscription); try { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs index f9fec0f80808..b3934c239380 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -210,7 +210,7 @@ public override void ExecuteCmdlet() // Retrieve the fully qualified server name string fullyQualifiedServerName = - this.SqlConnectionContext.ServerName + AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix); + this.SqlConnectionContext.ServerName + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix); // Issue the request ImportExportRequest context = this.ExportSqlAzureDatabaseProcess( diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs index b0736940ef05..bd64173db684 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -233,7 +233,7 @@ public override void ExecuteCmdlet() // Retrieve the fully qualified server name string fullyQualifiedServerName = - this.SqlConnectionContext.ServerName + AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix); + this.SqlConnectionContext.ServerName + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix); // Issue the request ImportExportRequest context = this.ImportSqlAzureDatabaseProcess( diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs index ceea8020e6ab..19b6149b0f8a 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { @@ -199,7 +199,7 @@ public override void ExecuteCmdlet() { string serverName = this.SourceServerName ?? connectionContext.ServerName; - connectionContext = ServerDataServiceCertAuth.Create(serverName, AzureSession.CurrentContext.Subscription); + connectionContext = ServerDataServiceCertAuth.Create(serverName, Profile, Profile.Context.Subscription); } string clientRequestId = connectionContext.ClientRequestId; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs index f838ec05af79..d7ab94491a6c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs @@ -25,7 +25,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; /// /// Stop an ongoing copy operation for a Microsoft Azure SQL Database in the given server context. @@ -132,7 +132,8 @@ public override void ExecuteCmdlet() // Use the provided ServerDataServiceContext or create one from the // provided ServerName and the active subscription. IServerDataServiceContext context = ServerDataServiceCertAuth.Create(this.ServerName, - AzureSession.CurrentContext.Subscription); + Profile, + Profile.Context.Subscription); DatabaseCopyModel databaseCopy; if (this.MyInvocation.BoundParameters.ContainsKey("DatabaseCopy")) diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs index e2ee0560b138..4e18a0e84e37 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs @@ -17,7 +17,7 @@ using System.Globalization; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; @@ -26,7 +26,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server { using DatabaseCopyModel = Model.DatabaseCopy; using WamlDatabaseCopy = Management.Sql.Models.DatabaseCopy; - using Microsoft.Azure.Common.Extensions; + using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; /// @@ -51,6 +51,8 @@ public partial class ServerDataServiceCertAuth : IServerDataServiceContext /// private readonly AzureSubscription subscription; + private AzureProfile profile; + #endregion /// @@ -59,9 +61,11 @@ public partial class ServerDataServiceCertAuth : IServerDataServiceContext /// The subscription used to connect and authenticate. /// The name of the server to connect to. private ServerDataServiceCertAuth( + AzureProfile profile, AzureSubscription subscription, string serverName) { + this.profile = profile; this.serverName = serverName; this.subscription = subscription; } @@ -112,6 +116,7 @@ public string ServerName /// An instance of class. public static ServerDataServiceCertAuth Create( string serverName, + AzureProfile profile, AzureSubscription subscription) { if (string.IsNullOrEmpty(serverName)) @@ -123,6 +128,7 @@ public static ServerDataServiceCertAuth Create( // Create a new ServerDataServiceCertAuth object to be used return new ServerDataServiceCertAuth( + profile, subscription, serverName); } @@ -170,7 +176,7 @@ public Database[] GetDatabases() this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the list of databases @@ -191,7 +197,7 @@ public Database GetDatabase(string databaseName) this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the specified database @@ -223,7 +229,7 @@ public Database CreateNewDatabase( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); DatabaseCreateParameters parameters = new DatabaseCreateParameters() @@ -267,7 +273,7 @@ public Database UpdateDatabase( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the specified database @@ -316,7 +322,7 @@ public void RemoveDatabase(string databaseName) this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the list of databases @@ -347,7 +353,7 @@ private void PopulateSloCache() this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the specified database @@ -446,7 +452,7 @@ public DatabaseOperation GetDatabaseOperation(Guid OperationGuid) this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the specified Operation @@ -469,7 +475,7 @@ public DatabaseOperation[] GetDatabaseOperations(string databaseName) this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve all operations on specified database @@ -502,7 +508,7 @@ public DatabaseOperation[] GetDatabasesOperations() this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the operations on specified server @@ -535,7 +541,7 @@ public DatabaseCopyModel[] GetDatabaseCopy( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); IEnumerable copyResponses = null; @@ -590,7 +596,7 @@ public DatabaseCopyModel GetDatabaseCopy(DatabaseCopyModel databaseCopy) this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Figure out which database is local, as that's the one we need to pass in. @@ -629,7 +635,7 @@ public DatabaseCopyModel StartDatabaseCopy( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); DatabaseCopyCreateResponse response = sqlManagementClient.DatabaseCopies.Create( @@ -659,7 +665,7 @@ public void StopDatabaseCopy( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Get the local database, as it's the one we need to pass in. @@ -695,7 +701,7 @@ public RestorableDroppedDatabase[] GetRestorableDroppedDatabases() this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the list of databases @@ -719,7 +725,7 @@ public RestorableDroppedDatabase GetRestorableDroppedDatabase( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Retrieve the specified database @@ -755,7 +761,7 @@ public RestoreDatabaseOperation RestoreDatabase( this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId(); // Get the SQL management client - SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient sqlManagementClient = AzureSession.ClientFactory.CreateClient(this.profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); this.AddTracingHeaders(sqlManagementClient); // Create the restore operation diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs index 709b58ed2f66..4a351c5a323c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs @@ -15,12 +15,12 @@ using System; using System.Globalization; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Sql; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase { @@ -61,9 +61,9 @@ public static string GenerateClientTracingId() protected SqlManagementClient GetCurrentSqlClient() { // Get the SQL management client for the current subscription - AzureSubscription subscription = AzureSession.CurrentContext.Subscription; + AzureSubscription subscription = Profile.Context.Subscription; SqlDatabaseCmdletBase.ValidateSubscription(subscription); - SqlManagementClient client = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + SqlManagementClient client = AzureSession.ClientFactory.CreateClient(Profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, clientSessionId); client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId); return client; @@ -78,7 +78,7 @@ public static void ValidateSubscription(AzureSubscription subscription) if (subscription == null) { throw new ArgumentException( - Common.Properties.Resources.InvalidCurrentSubscription); + Common.Properties.Resources.InvalidDefaultSubscription); } } diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config index 3937691ffa1c..e0ef93f35aa6 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj index 56fe46075bfb..d06acaf44179 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj @@ -34,35 +34,34 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs index 6764ee2c1598..31975b9e2d45 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs @@ -19,7 +19,7 @@ using System.Net.Security; using System.Reflection; using Microsoft.Azure; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config index fc9621a766a8..a3e5d78c8794 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj index c59e7c1813df..dd8c08f83a40 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj @@ -44,28 +44,24 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll - - - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs index 86a06a776a6e..d305ab58a859 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs @@ -20,8 +20,8 @@ using System.Net.Security; using System.Runtime.Caching; using Hyak.Common; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.Scheduler; using Microsoft.WindowsAzure.Management.StorSimple; using Microsoft.WindowsAzure.Management.StorSimple.Models; @@ -40,12 +40,19 @@ public partial class StorSimpleClient private CacheItemPolicy ResourceCachetimeoutPolicy = new CacheItemPolicy(); - public StorSimpleClient(AzureSubscription currentSubscription) + /// + /// Azure profile + /// + public AzureProfile Profile { get; set; } + + public StorSimpleClient(AzureProfile azureProfile, AzureSubscription currentSubscription) { // Temp code to be able to test internal env. ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };//IgnoreCertificateErrorHandler;//delegate { return true; }; - - this.cloudServicesClient = AzureSession.ClientFactory.CreateClient(currentSubscription, AzureEnvironment.Endpoint.ServiceManagement); + + this.Profile = azureProfile; + + this.cloudServicesClient = AzureSession.ClientFactory.CreateClient(azureProfile, currentSubscription, AzureEnvironment.Endpoint.ServiceManagement); ResourceCachetimeoutPolicy.AbsoluteExpiration = DateTimeOffset.Now.AddHours(1.0d); } @@ -63,7 +70,7 @@ private StorSimpleManagementClient GetStorSimpleClient() StorSimpleContext.ResourceName, StorSimpleContext.ResourceId, StorSimpleContext.ResourceProviderNameSpace, StorSimpleContext.StampId, this.cloudServicesClient.Credentials, - AzureSession.CurrentContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)); + Profile.Context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement)); if (storSimpleClient == null) { diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs index b3d99c159e60..253b87195582 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs @@ -55,7 +55,7 @@ internal StorSimpleClient StorSimpleClient { if (this.storSimpleClient == null) { - this.storSimpleClient = new StorSimpleClient(CurrentContext.Subscription); + this.storSimpleClient = new StorSimpleClient(Profile, Profile.Context.Subscription); } storSimpleClient.ClientRequestId = Guid.NewGuid().ToString("D") + "_PS"; WriteVerbose(string.Format(Resources.ClientRequestIdMessage, storSimpleClient.ClientRequestId)); diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config b/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config index 9ee8370476e8..3b58816e8951 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config @@ -1,14 +1,14 @@  - - + + - + - + diff --git a/src/ServiceManagement/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs b/src/ServiceManagement/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs index 4c57942c8b2e..3e88475f1426 100644 --- a/src/ServiceManagement/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs +++ b/src/ServiceManagement/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Storage.Test.Service; using Microsoft.WindowsAzure.Storage.Blob; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Storage.Test.Blob { @@ -60,7 +60,7 @@ public void InitMock() { BlobMock = new MockStorageBlobManagement(); MockCmdRunTime = new MockCommandRuntime(); - ProfileClient.DataStore = new MockDataStore(); + AzureSession.DataStore = new MockDataStore(); } [TestCleanup] diff --git a/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj b/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj index a18af39002d6..2b0d519b95f5 100644 --- a/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj +++ b/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj @@ -49,17 +49,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -73,12 +73,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config b/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config index 6409eee6fc5c..02e832c3c874 100644 --- a/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config +++ b/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj index 6099fd382a79..a3c4c82725ae 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj @@ -43,19 +43,19 @@ False - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll False - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -70,12 +70,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs b/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs index c311e9108c65..2b6b26dc4b04 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs @@ -17,12 +17,12 @@ using System.Management.Automation; using System.Security.Permissions; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet { @@ -332,7 +332,7 @@ internal CloudStorageAccount GetStorageAccountWithEndPoint(StorageCredentials cr /// /// Get storage account and use specific azure environment /// - /// Storage credentail + /// Storage credential /// Storage account name, it's used for build end point /// Use secure Http protocol /// Environment name @@ -344,13 +344,14 @@ internal CloudStorageAccount GetStorageAccountWithAzureEnvironment(StorageCreden if (string.IsNullOrEmpty(azureEnvironmentName)) { - azureEnvironment = AzureSession.CurrentContext.Environment; + azureEnvironment = Profile.Context.Environment; } else { try { - azureEnvironment = DefaultProfileClient.GetEnvironmentOrDefault(azureEnvironmentName); + var profileClient = new ProfileClient(Profile); + azureEnvironment = profileClient.GetEnvironmentOrDefault(azureEnvironmentName); } catch (ArgumentException e) { diff --git a/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs b/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs index 3effb41d97c6..c964a994d9c6 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs +++ b/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs @@ -20,7 +20,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Storage.File; using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; @@ -236,8 +236,8 @@ protected override void InitChannelCurrentSubscription(bool force) internal virtual bool ShouldInitServiceChannel() { //Storage Context is empty and have already set the current storage account in subscription - if (Context == null && HasCurrentSubscription && CurrentContext.Subscription != null && - !String.IsNullOrEmpty(CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount))) + if (Context == null && HasCurrentSubscription && Profile.Context.Subscription != null && + !String.IsNullOrEmpty(Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount))) { return true; } @@ -302,7 +302,7 @@ internal void WriteObjectWithStorageContext(IEnumerable itemLi /// A storage account private CloudStorageAccount GetStorageAccountFromSubscription() { - string CurrentStorageAccountName = CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + string CurrentStorageAccountName = Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); if (string.IsNullOrEmpty(CurrentStorageAccountName)) { @@ -310,12 +310,12 @@ private CloudStorageAccount GetStorageAccountFromSubscription() } else { - WriteDebugLog(String.Format(Resources.UseCurrentStorageAccountFromSubscription, CurrentStorageAccountName, CurrentContext.Subscription.Name)); + WriteDebugLog(String.Format(Resources.UseCurrentStorageAccountFromSubscription, CurrentStorageAccountName, Profile.Context.Subscription.Name)); try { //The service channel initialized by subscription - return CurrentContext.Subscription.GetCloudStorageAccount(); + return Profile.Context.Subscription.GetCloudStorageAccount(Profile); } catch (System.ServiceModel.CommunicationException e) { @@ -324,7 +324,7 @@ private CloudStorageAccount GetStorageAccountFromSubscription() if (e.IsNotFoundException()) { //Repack the 404 error - string errorMessage = String.Format(Resources.CurrentStorageAccountNotFoundOnAzure, CurrentStorageAccountName, CurrentContext.Subscription.Name); + string errorMessage = String.Format(Resources.CurrentStorageAccountNotFoundOnAzure, CurrentStorageAccountName, Profile.Context.Subscription.Name); System.ServiceModel.CommunicationException exception = new System.ServiceModel.CommunicationException(errorMessage, e); throw exception; } diff --git a/src/ServiceManagement/Storage/Commands.Storage/packages.config b/src/ServiceManagement/Storage/Commands.Storage/packages.config index 6409eee6fc5c..02e832c3c874 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/packages.config +++ b/src/ServiceManagement/Storage/Commands.Storage/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj index 6dd0b30b4903..015585b33d3f 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj @@ -36,17 +36,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -60,12 +60,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config index ab68cc0ddf07..bb895b4acd14 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - + diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj index 2a1e9a8a33a9..91ee7bba3f0e 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj @@ -46,17 +46,17 @@ - ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.14.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -71,12 +71,12 @@ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll - + False - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll False diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs index ddf18d9ca57c..d6afbc7a29af 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs @@ -16,8 +16,8 @@ using Microsoft.WindowsAzure.Commands.TrafficManager.Utilities; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Extensions; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.TrafficManager { @@ -36,8 +36,8 @@ public override void ExecuteCmdlet() private string GetDomainNameToCheck(string domainName) { - string TrafficManagerSuffix = !string.IsNullOrEmpty(AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix)) ? - AzureSession.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix) : + string TrafficManagerSuffix = !string.IsNullOrEmpty(Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix)) ? + Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix) : AzureEnvironmentConstants.AzureTrafficManagerDnsSuffix; if (!string.IsNullOrEmpty(domainName) && !domainName.ToLower().EndsWith(TrafficManagerSuffix)) diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerBaseCmdlet.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerBaseCmdlet.cs index a7ca64e0dd24..39fe3ee2e930 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerBaseCmdlet.cs +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerBaseCmdlet.cs @@ -26,7 +26,7 @@ public ITrafficManagerClient TrafficManagerClient { if (this.trafficManagerClient == null) { - this.trafficManagerClient = new TrafficManagerClient(this.CurrentContext.Subscription); + this.trafficManagerClient = new TrafficManagerClient(this.Profile, this.Profile.Context.Subscription); } return this.trafficManagerClient; } diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs index 50a60c5de37b..552a685d7b43 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs @@ -16,11 +16,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.TrafficManager.Models; using Microsoft.WindowsAzure.Management.TrafficManager; using Microsoft.WindowsAzure.Management.TrafficManager.Models; -using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; using Hyak.Common; @@ -30,9 +30,9 @@ public class TrafficManagerClient : ITrafficManagerClient { public TrafficManagerManagementClient Client { get; internal set; } - public TrafficManagerClient(AzureSubscription subscription) + public TrafficManagerClient(AzureProfile profile, AzureSubscription subscription) { - this.Client = AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement); + this.Client = AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); } public TrafficManagerClient(TrafficManagerManagementClient client) diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config index 54789acec117..157cbe9d28eb 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config @@ -1,9 +1,9 @@  - - + + - + @@ -11,7 +11,7 @@ - +