diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj
index d225629ecc44..b5ad19e29f69 100644
--- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj
+++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj
@@ -58,7 +58,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
False
diff --git a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs
index c2868687af36..0ba9d67a5da3 100644
--- a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs
+++ b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs
@@ -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 35fdf380afda..5de5ac5fa711 100644
--- a/src/Common/Commands.Common.Storage/packages.config
+++ b/src/Common/Commands.Common.Storage/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/Common/Commands.Common.Test/Commands.Common.Test.csproj b/src/Common/Commands.Common.Test/Commands.Common.Test.csproj
index 48ac0a4c76fe..bfd448bb6637 100644
--- a/src/Common/Commands.Common.Test/Commands.Common.Test.csproj
+++ b/src/Common/Commands.Common.Test/Commands.Common.Test.csproj
@@ -56,7 +56,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs b/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs
index 23e220518717..c0a1396f60bb 100644
--- a/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs
+++ b/src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs
@@ -45,7 +45,6 @@ public ProfileCmdltsTests() : base()
AzureSession.DataStore = dataStore;
commandRuntimeMock = new MockCommandRuntime();
SetMockData();
- AzureSession.Profile = new AzureProfile();
}
[Fact]
@@ -89,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();
@@ -507,16 +506,15 @@ public void SelectAzureSubscriptionByNameUpdatesProfile()
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.SetParameterSet("SelectSubscriptionByNameParameterSet");
cmdlt.SubscriptionName = azureSubscription2.Name;
- Assert.NotEqual(azureSubscription2.Id, AzureSession.Profile.CurrentContext.Subscription.Id);
// Act
cmdlt.InvokeBeginProcessing();
cmdlt.ExecuteCmdlet();
cmdlt.InvokeEndProcessing();
-
+
// Verify
- Assert.NotNull(AzureSession.Profile.CurrentContext.Subscription);
- Assert.Equal(azureSubscription2.Id, AzureSession.Profile.CurrentContext.Subscription.Id);
+ Assert.NotNull(cmdlt.Profile.Context.Subscription);
+ Assert.Equal(azureSubscription2.Id, cmdlt.Profile.Context.Subscription.Id);
}
[Fact]
@@ -637,7 +635,6 @@ public void SelectAzureSubscriptionByInvalidGuidThrowsException()
cmdlt.SetParameterSet("SelectSubscriptionByIdParameterSet");
string invalidGuid = "foo";
cmdlt.SubscriptionId = invalidGuid;
- Assert.Null(AzureSession.Profile.CurrentContext.Subscription);
// Act
cmdlt.InvokeBeginProcessing();
diff --git a/src/Common/Commands.Common.Test/Common/TestBase.cs b/src/Common/Commands.Common.Test/Common/TestBase.cs
index 79335482dc29..eab7d2c7dfbf 100644
--- a/src/Common/Commands.Common.Test/Common/TestBase.cs
+++ b/src/Common/Commands.Common.Test/Common/TestBase.cs
@@ -28,6 +28,8 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common
///
public abstract class TestBase
{
+ protected AzureProfile currentProfile;
+
public TestBase()
{
BaseSetup();
@@ -43,11 +45,13 @@ public void BaseSetup()
{
AzureSession.DataStore = new MockDataStore();
}
- if (AzureSession.Profile.CurrentContext.Subscription == null)
+ currentProfile = new AzureProfile();
+
+ if (currentProfile.Context.Subscription == null)
{
var newGuid = Guid.NewGuid();
- AzureSession.Profile.Subscriptions[newGuid] = new AzureSubscription { Id = newGuid, Name = "test", Environment = EnvironmentName.AzureCloud, Account = "test" };
- AzureSession.Profile.Accounts["test"] = 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,
@@ -56,7 +60,7 @@ public void BaseSetup()
{AzureAccount.Property.Subscriptions, newGuid.ToString()}
}
};
- AzureSession.Profile.DefaultSubscription = AzureSession.Profile.Subscriptions[newGuid];
+ currentProfile.DefaultSubscription = currentProfile.Subscriptions[newGuid];
}
AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory();
}
diff --git a/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs b/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs
index c56e5d1f4de6..9f7bebd3b208 100644
--- a/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs
+++ b/src/Common/Commands.Common.Test/Mocks/MockClientFactory.cs
@@ -53,12 +53,18 @@ 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
{
SubscriptionCloudCredentials creds = new TokenCloudCredentials(subscription.Id.ToString(), "fake_token");
if (HttpMockServer.GetCurrentMode() != HttpRecorderMode.Playback)
{
- ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
+ ProfileClient profileClient = new ProfileClient(
+ profile ?? new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
AzureContext context = new AzureContext(
subscription,
profileClient.GetAccount(subscription.Account),
@@ -68,7 +74,7 @@ public TClient CreateClient(AzureSubscription subscription, AzureEnviro
creds = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(context);
}
- Uri endpointUri = (new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)))).Profile.Environments[subscription.Environment].GetEndpointAsUri(endpoint);
+ Uri endpointUri = (new ProfileClient(profile ?? new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)))).Profile.Environments[subscription.Environment].GetEndpointAsUri(endpoint);
return CreateCustomClient(creds, endpointUri);
}
diff --git a/src/Common/Commands.Common.Test/packages.config b/src/Common/Commands.Common.Test/packages.config
index 2707ae71c417..7634e0601346 100644
--- a/src/Common/Commands.Common.Test/packages.config
+++ b/src/Common/Commands.Common.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/Common/Commands.Common/AzurePSCmdlet.cs b/src/Common/Commands.Common/AzurePSCmdlet.cs
index 646ae316570f..a4ec8b56d41e 100644
--- a/src/Common/Commands.Common/AzurePSCmdlet.cs
+++ b/src/Common/Commands.Common/AzurePSCmdlet.cs
@@ -25,7 +25,10 @@ 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()
{
@@ -37,24 +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()
{
- AzureSession.Profile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
+ InitializeProfile();
+
+ if (string.IsNullOrEmpty(ParameterSetName))
+ {
+ 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);
- DefaultProfileClient = new ProfileClient(AzureSession.Profile);
+ base.BeginProcessing();
}
- public AzureContext CurrentContext
+ private void InitializeProfile()
{
- get { return AzureSession.Profile.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.Profile.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()
{
@@ -192,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/CloudBaseCmdlet.cs b/src/Common/Commands.Common/CloudBaseCmdlet.cs
index 73da454a508c..9d9463a3e207 100644
--- a/src/Common/Commands.Common/CloudBaseCmdlet.cs
+++ b/src/Common/Commands.Common/CloudBaseCmdlet.cs
@@ -81,12 +81,12 @@ protected virtual void InitChannelCurrentSubscription(bool force)
protected void DoInitChannelCurrentSubscription(bool force)
{
- if (CurrentContext.Subscription == null)
+ if (Profile.Context.Subscription == null)
{
throw new ArgumentException(Resources.InvalidDefaultSubscription);
}
- if (CurrentContext.Account == null)
+ if (Profile.Context.Account == null)
{
throw new ArgumentException(Resources.AccountNeedsToBeSpecified);
}
@@ -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),
+ 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 f39e79594410..927d5c5b294d 100644
--- a/src/Common/Commands.Common/Commands.Common.csproj
+++ b/src/Common/Commands.Common/Commands.Common.csproj
@@ -60,7 +60,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
False
diff --git a/src/Common/Commands.Common/SubscriptionCmdletBase.cs b/src/Common/Commands.Common/SubscriptionCmdletBase.cs
index cfb9c0c74ff5..53c8f04ca45b 100644
--- a/src/Common/Commands.Common/SubscriptionCmdletBase.cs
+++ b/src/Common/Commands.Common/SubscriptionCmdletBase.cs
@@ -13,10 +13,7 @@
// ----------------------------------------------------------------------------------
using Microsoft.Azure.Common.Authentication;
-using Microsoft.Azure.Common.Authentication.Models;
-using Microsoft.WindowsAzure.Commands.Common.Properties;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
-using System.Management.Automation;
namespace Microsoft.WindowsAzure.Commands.Utilities.Profile
{
@@ -27,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(new AzureProfile(SubscriptionDataFile));
- WriteWarning(Resources.SubscriptionDataFileDeprecated);
- }
- else
- {
- ProfileClient = new ProfileClient(AzureSession.Profile);
- }
+ 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 db144df8abb5..3cbd0df65765 100644
--- a/src/Common/Commands.Common/packages.config
+++ b/src/Common/Commands.Common/packages.config
@@ -4,7 +4,7 @@
-
+
diff --git a/src/Common/Commands.Profile/Account/AddAzureAccount.cs b/src/Common/Commands.Profile/Account/AddAzureAccount.cs
index db7cc6697a4e..d2efb315a0d1 100644
--- a/src/Common/Commands.Profile/Account/AddAzureAccount.cs
+++ b/src/Common/Commands.Profile/Account/AddAzureAccount.cs
@@ -17,7 +17,6 @@
using Microsoft.WindowsAzure.Commands.Common;
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 39044de505f7..d088ebddc317 100644
--- a/src/Common/Commands.Profile/Account/GetAzureAccount.cs
+++ b/src/Common/Commands.Profile/Account/GetAzureAccount.cs
@@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using System.Linq;
using System.Management.Automation;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.Azure.Common.Authentication.Models;
@@ -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/Commands.Profile.csproj b/src/Common/Commands.Profile/Commands.Profile.csproj
index 253cd39c6a88..4c9a47095d81 100644
--- a/src/Common/Commands.Profile/Commands.Profile.csproj
+++ b/src/Common/Commands.Profile/Commands.Profile.csproj
@@ -55,7 +55,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs
index 522f7a7dd686..f5824b361792 100644
--- a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs
+++ b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs
@@ -64,7 +64,7 @@ public override void ExecuteCmdlet()
switch (ParameterSetName)
{
case "ByName":
- WriteSubscriptions(ProfileClient.RefreshSubscriptions(AzureSession.Profile.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.Profile.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.Profile.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.Profile.CurrentContext.Subscription != null && AzureSession.Profile.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))
diff --git a/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs b/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs
index 91e3ab826627..8b47e0c1832b 100644
--- a/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs
+++ b/src/Common/Commands.Profile/Subscription/ImportAzurePublishSettings.cs
@@ -54,7 +54,7 @@ public override void ExecuteCmdlet()
}
AzureSubscription defaultSubscription = ProfileClient.Profile.DefaultSubscription;
- Debug.Assert(AzureSession.Profile.CurrentContext != null);
+ Debug.Assert(Profile.Context != null);
}
private bool IsDirectory()
diff --git a/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs
index 853af3211163..52545c5afa31 100644
--- a/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs
+++ b/src/Common/Commands.Profile/Subscription/SetAzureSubscription.cs
@@ -16,6 +16,7 @@
using System.Linq;
using System.Management.Automation;
using System.Security.Cryptography.X509Certificates;
+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/packages.config b/src/Common/Commands.Profile/packages.config
index bf0dd9af7051..01b9d2845069 100644
--- a/src/Common/Commands.Profile/packages.config
+++ b/src/Common/Commands.Profile/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj b/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
index 795f9ddda7dc..e2f334120fa9 100644
--- a/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
+++ b/src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
@@ -46,7 +46,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/Common/Commands.ScenarioTest/packages.config b/src/Common/Commands.ScenarioTest/packages.config
index d25a5db1bb64..3b07cffeb3bb 100644
--- a/src/Common/Commands.ScenarioTest/packages.config
+++ b/src/Common/Commands.ScenarioTest/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj
index 59414c63252d..289d184e5a5e 100644
--- a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj
+++ b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj
@@ -45,7 +45,7 @@
False
- ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/Common/Commands.ScenarioTests.Common/packages.config b/src/Common/Commands.ScenarioTests.Common/packages.config
index 4f30bbcb364b..8b0293ef82cf 100644
--- a/src/Common/Commands.ScenarioTests.Common/packages.config
+++ b/src/Common/Commands.ScenarioTests.Common/packages.config
@@ -3,7 +3,7 @@
-
+
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 df49acdc80cd..cc001aad9cdd 100644
--- a/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj
@@ -46,7 +46,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/packages.config b/src/ResourceManager/Batch/Commands.Batch.Test/packages.config
index dc0aa2e697c8..9ef36be9d5b2 100644
--- a/src/ResourceManager/Batch/Commands.Batch.Test/packages.config
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs b/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs
index 9c61be34f770..c90a5e47d34d 100644
--- a/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs
+++ b/src/ResourceManager/Batch/Commands.Batch/BatchCmdletBase.cs
@@ -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 960028cff124..4130681388e8 100644
--- a/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj
+++ b/src/ResourceManager/Batch/Commands.Batch/Commands.Batch.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/Batch/Commands.Batch/packages.config b/src/ResourceManager/Batch/Commands.Batch/packages.config
index 76068479a94e..5ca95f6fc4bb 100644
--- a/src/ResourceManager/Batch/Commands.Batch/packages.config
+++ b/src/ResourceManager/Batch/Commands.Batch/packages.config
@@ -3,7 +3,7 @@
-
+
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 2b35393f5620..5bee80c9a32c 100644
--- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj
+++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config
index 1744d861dc3a..fd86874d57ac 100644
--- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config
+++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj
index 56750a19af96..19b8a407e9f0 100644
--- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj
+++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config
index 7d7c0204ee32..ba93236d031b 100644
--- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config
+++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj
index 2e5f4870e2ee..95a38d80b084 100644
--- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj
+++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj
@@ -57,7 +57,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs
index d71ce5b79081..a892a7b2b565 100644
--- a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs
+++ b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs
@@ -39,7 +39,7 @@ protected 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/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj
index 50d6de1ea5a8..a6d7ade2ace4 100644
--- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj
+++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config
index fca898d05968..d92f1c7b9f50 100644
--- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config
+++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj
index 78b6276e889f..0cad5c85e09e 100644
--- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj
+++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj
@@ -115,7 +115,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs
index 5fdf071b4230..f819deabfdda 100644
--- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs
+++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs
@@ -34,7 +34,7 @@ internal IKeyVaultDataServiceClient DataServiceClient
{
this.dataServiceClient = new KeyVaultDataServiceClient(
AzureSession.AuthenticationFactory,
- AzureSession.Profile.CurrentContext,
+ Profile.Context,
new HttpClient());
}
diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config
index bf0dd9af7051..01b9d2845069 100644
--- a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config
+++ b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config
@@ -3,7 +3,7 @@
-
+
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 4bc08c7feaef..d3b13b34e1b4 100644
--- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj
+++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config
index 33e768d20585..e6bfc6c0d899 100644
--- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config
+++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj
index b866603d0421..68a19893391a 100644
--- a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj
+++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj
@@ -54,7 +54,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 1af98a461687..c2d2ff29e9d4 100644
--- a/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config
+++ b/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config
@@ -3,7 +3,7 @@
-
+
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 aa257482c2d9..b2f23187aba1 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
@@ -51,7 +51,7 @@
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config
index c9afaa91fa43..59dd1cb38a75 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
index 83d7b7f2264b..a813f92effd2 100644
--- a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
+++ b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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.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/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 0bb307e278d8..3ef5c2bbeb5a 100644
--- a/src/ResourceManager/Resources/Commands.Resources/packages.config
+++ b/src/ResourceManager/Resources/Commands.Resources/packages.config
@@ -3,7 +3,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 1649a66e057d..08994afc9db4 100644
--- a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj
+++ b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj
@@ -49,7 +49,7 @@
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config
index 69b2e5a146af..7371265817ff 100644
--- a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config
+++ b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj
index a5c8d149d55d..d9c5d55a1dcb 100644
--- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj
+++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj
@@ -97,7 +97,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.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 e97103bee6dc..7dc75c742c2b 100644
--- a/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs
+++ b/src/ResourceManager/Sql/Commands.Sql/Security/Services/EndpointsCommunicator.cs
@@ -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 992d98d4fb06..65a4575a4e47 100644
--- a/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs
+++ b/src/ResourceManager/Sql/Commands.Sql/Security/Services/SqlClient.cs
@@ -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 0b3e1a01e3e2..6d82c717c4e6 100644
--- a/src/ResourceManager/Sql/Commands.Sql/packages.config
+++ b/src/ResourceManager/Sql/Commands.Sql/packages.config
@@ -3,7 +3,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 294fd86c93b6..48a9a108b27f 100644
--- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj
+++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj
@@ -47,7 +47,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config
index 837f3cebd76b..2be54573596f 100644
--- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config
+++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj
index a4be081da17d..2833fad31013 100644
--- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj
+++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config
index 82bb6d81d01b..b017eee11aed 100644
--- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config
+++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj
index c811f907536a..c3746b6cabca 100644
--- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj
+++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 8e1fbc18614c..5a9dd56d3c6b 100644
--- a/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs
+++ b/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs
@@ -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 bf0dd9af7051..01b9d2845069 100644
--- a/src/ResourceManager/Tags/Commands.Tags/packages.config
+++ b/src/ResourceManager/Tags/Commands.Tags/packages.config
@@ -3,7 +3,7 @@
-
+
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 0d516bd59f53..4a3775d36a2d 100644
--- a/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj
+++ b/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj
@@ -55,7 +55,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config
index 9a337de7c28a..cccdce8cedae 100644
--- a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config
+++ b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs
index 915e5347b8b1..bb921bf455a3 100644
--- a/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs
+++ b/src/ServiceManagement/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs
@@ -46,7 +46,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 7a2685c0b7e5..bd73b6919232 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/Commands.Automation.csproj b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj
index 46746d127f39..16eddca496fa 100644
--- a/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj
+++ b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj
@@ -60,7 +60,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs
index 0a00aea3d466..b53290142a0e 100644
--- a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs
+++ b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs
@@ -40,9 +40,9 @@ public AutomationClient()
{
}
- public AutomationClient(AzureSubscription subscription)
- : this(subscription,
- AzureSession.ClientFactory.CreateClient(subscription, AzureEnvironment.Endpoint.ServiceManagement))
+ public AutomationClient(AzureProfile profile, AzureSubscription subscription)
+ : this(subscription,
+ AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement))
{
}
diff --git a/src/ServiceManagement/Automation/Commands.Automation/packages.config b/src/ServiceManagement/Automation/Commands.Automation/packages.config
index 06c6efdec015..d63a31e1e694 100644
--- a/src/ServiceManagement/Automation/Commands.Automation/packages.config
+++ b/src/ServiceManagement/Automation/Commands.Automation/packages.config
@@ -3,7 +3,7 @@
-
+
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 db035e1b5182..1db2aac4bb38 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
@@ -45,7 +45,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config
index bf0dd9af7051..01b9d2845069 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Extensions.Test/packages.config
@@ -3,7 +3,7 @@
-
+
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 ec81c7fe5a5b..2110a8d206fb 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj
@@ -67,7 +67,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config
index 64582a651642..d0c29c42e95b 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config
@@ -4,7 +4,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 f20dfc223828..aa5bec3d44c1 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj
@@ -67,7 +67,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config
index 2f7b63646102..57f4a9a2969e 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config
@@ -4,7 +4,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 68bc0426746e..4b309f87ad2a 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj
@@ -61,7 +61,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config
index 9404b9e85272..8336fdeca0a1 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config
@@ -4,7 +4,7 @@
-
+
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj
index 9444abac0edf..6545b184fdbb 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj
@@ -69,7 +69,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 bc8433a68a2e..49a1360269e5 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs
@@ -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) ||
@@ -266,7 +266,7 @@ protected virtual void ValidateParameters()
this.Label = this.Name;
}
- if (string.IsNullOrEmpty(this.CurrentContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount)))
+ if (string.IsNullOrEmpty(this.Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount)))
{
throw new ArgumentException(Resources.CurrentStorageAccountIsNotSet);
}
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs
index dc950e493f00..7d34c6d4dee8 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs
@@ -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 5ee3ac9dd02c..0ca4f5dc3a39 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs
@@ -166,7 +166,7 @@ protected Collection GetDataDisks()
protected void ValidateParameters()
{
- var currentSubscription = AzureSession.Profile.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/CustomScript/SetAzureVMCustomScriptExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs
index e44e441303ac..04945834e219 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs
@@ -179,7 +179,7 @@ protected override void ValidateParameters()
if (string.Equals(this.ParameterSetName, SetCustomScriptExtensionByContainerBlobsParamSetName))
{
this.StorageEndpointSuffix = string.IsNullOrEmpty(this.StorageEndpointSuffix) ?
- AzureSession.Profile.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/DSC/ServiceManagementBaseCmdletExtentions.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs
index 5c8cec55de91..f2f1c14da975 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/ServiceManagementBaseCmdletExtentions.cs
@@ -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/Network/GetAzureNetworkSecurityGroupConfig.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs
index 1c8dbf6a7fb8..43173452b9df 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Network/GetAzureNetworkSecurityGroupConfig.cs
@@ -48,7 +48,7 @@ protected override void ProcessRecord()
else
{
- var networkClient = new NetworkClient(AzureSession.Profile.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 f125b87e9884..820076ba1aef 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs
@@ -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 4b042c7d393c..f4a4d4f297c5 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs
@@ -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 f5e2ca5798f6..ded3f7ab2bcc 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs
@@ -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 147142fa565a..ac18a9524c38 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs
@@ -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/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config
index 2f7b63646102..57f4a9a2969e 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config
@@ -4,7 +4,7 @@
-
+
diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj
index 4cd249eba491..b6efe2f9f383 100644
--- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj
+++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 88ee168743e8..25181cc9d77d 100644
--- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs
+++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs
@@ -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 90d4ec702484..789157023f24 100644
--- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config
+++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config
@@ -3,7 +3,7 @@
-
+
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 232b2cbaeac4..f825d1d459dd 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.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 bc7c75117961..bd4d6ea0519f 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs
@@ -105,7 +105,7 @@ public void CanGetSubscriptionsCertificateCredentialFromCurrentSubscription()
var waSubscription = GetCurrentSubscription();
ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
- var subscriptionCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, AzureSession.Profile.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;
@@ -136,7 +136,7 @@ public void CanGetAccessTokenCertificateCredentialFromCurrentSubscription()
profileClient.Profile.Save();
waSubscription.Account = "test";
- var accessTokenCreds = getClustersCommand.GetSubscriptionCredentials(waSubscription, AzureSession.Profile.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);
@@ -153,7 +153,7 @@ public void CanGetJobSubmissionCertificateCredentialFromCurrentSubscription()
var subscriptionCreds = getClustersCommand.GetJobSubmissionClientCredentials(
waSubscription,
- AzureSession.Profile.CurrentContext.Environment,
+ profileClient.Profile.Context.Environment,
IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName,
profileClient.Profile);
@@ -187,7 +187,7 @@ public void CanGetJobSubmissionAccessTokenCredentialFromCurrentSubscription()
profileClient.Profile.Save();
var accessTokenCreds = getClustersCommand.GetJobSubmissionClientCredentials(
waSubscription,
- AzureSession.Profile.CurrentContext.Environment,
+ profileClient.Profile.Context.Environment,
IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName,
profileClient.Profile);
Assert.IsInstanceOfType(accessTokenCreds, typeof(HDInsightAccessTokenCredential));
@@ -208,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.Profile.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/Utilities/IntegrationTestBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs
index 430a7d0a1be2..d6ccf49809e7 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs
@@ -87,9 +87,7 @@ public static AzureSubscription GetCurrentSubscription()
profileClient.Profile.Subscriptions[newSubscription.Id] = newSubscription;
profileClient.Profile.Save();
-
- AzureSession.Profile = profileClient.Profile;
-
+
return profileClient.Profile.Subscriptions[newSubscription.Id];
}
diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config
index 02feb028f4d4..724e43a1039d 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs
index 589397c83336..8e9bcdd35219 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs
@@ -147,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 207fa409daee..d00df8f33b89 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj
@@ -57,7 +57,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
False
diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config
index e8dbd9804cf0..4dd47aa79b37 100644
--- a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config
+++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config
@@ -3,7 +3,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 28202cd4c3f7..928eb62f3c0b 100644
--- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj
+++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj
@@ -46,7 +46,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config
index 9cac8db684e0..248fa53c0141 100644
--- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config
+++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj
index af1fd6c5a629..85dacd83505d 100644
--- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj
+++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj
@@ -49,7 +49,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 529c0ee06ed1..fcc90b488c34 100644
--- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs
+++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs
@@ -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 0cceeac04233..20c97d605228 100644
--- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config
+++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config
@@ -3,7 +3,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 cbdcf3d1ee9c..8b3fb12867aa 100644
--- a/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj
+++ b/src/ServiceManagement/Network/Commands.Network.Test/Commands.Network.Test.csproj
@@ -46,7 +46,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Network/Commands.Network.Test/packages.config b/src/ServiceManagement/Network/Commands.Network.Test/packages.config
index ecba787f8f19..ee343fab6796 100644
--- a/src/ServiceManagement/Network/Commands.Network.Test/packages.config
+++ b/src/ServiceManagement/Network/Commands.Network.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj
index 66c2713122bc..f80aa8db4e99 100644
--- a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj
+++ b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj
@@ -57,7 +57,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs
index fa4685cb98c4..47f09d01efd1 100644
--- a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs
+++ b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs
@@ -40,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)
{
}
@@ -361,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 24fc41a9e61f..48d233165bc6 100644
--- a/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs
+++ b/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs
@@ -29,7 +29,7 @@ public abstract class NetworkCmdletBase : AzurePSCmdlet
protected AzureSubscription CurrentSubscription
{
- get { return AzureSession.Profile.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 61e1a72087a2..7a784cddca58 100644
--- a/src/ServiceManagement/Network/Commands.Network/packages.config
+++ b/src/ServiceManagement/Network/Commands.Network/packages.config
@@ -4,7 +4,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 8f6e4f20c50b..5f7b97b474be 100644
--- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj
+++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj
@@ -44,7 +44,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config
index 5b19687606a9..a0051cddb2d2 100644
--- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config
+++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj
index b9b4c962c73d..3eb03dd5cbd4 100644
--- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj
+++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj
@@ -51,7 +51,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs
index ea4845e69b5b..036ed620ac41 100644
--- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs
+++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs
@@ -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.Profile.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/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config
index 2db9b10fdfba..c932a7c90f99 100644
--- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config
+++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config
@@ -3,7 +3,7 @@
-
+
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 f6700e6a47f1..ceca157f60e1 100644
--- a/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj
+++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj
@@ -50,7 +50,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 ca22069d8a6c..c37aa64d951c 100644
--- a/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config
+++ b/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj
index 4e9c80fb4f10..9243bdaa4074 100644
--- a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj
+++ b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj
@@ -55,7 +55,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs
index 1a32b1f1bfc5..8382976cbd81 100644
--- a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs
@@ -40,7 +40,7 @@ public AddAzureEnvironmentTests()
public void Cleanup()
{
- AzureSession.Profile = new AzureProfile();
+ currentProfile = null;
}
[Fact]
diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs
index 8475f8338712..7b1a0776761a 100644
--- a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs
@@ -40,7 +40,7 @@ public RemoveAzureEnvironmentTests()
public void Cleanup()
{
- AzureSession.Profile = new AzureProfile();
+ currentProfile = null;
}
[Fact]
diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs
index af430eed55b3..486ff8d32bc6 100644
--- a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs
@@ -42,7 +42,7 @@ public SetAzureEnvironmentTests()
public void Cleanup()
{
- AzureSession.Profile = new AzureProfile();
+ currentProfile = null;
}
[Fact]
diff --git a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs
index 6053bf428236..6a9fb4f6fd4f 100644
--- a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs
@@ -71,10 +71,10 @@ public void ProcessGetMediaServicesTest()
MediaServicesClient = clientMock.Object,
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(SubscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(SubscriptionId)] = subscription;
getAzureMediaServiceCommand.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.Count);
@@ -107,10 +107,10 @@ public void ProcessGetMediaServiceByNameShouldReturnOneMatchingEntry()
MediaServicesClient = clientMock.Object,
Name = expectedName
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(SubscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(SubscriptionId)] = subscription;
getAzureMediaServiceCommand.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.Count);
MediaServiceAccountDetails accounts = (MediaServiceAccountDetails)((MockCommandRuntime)getAzureMediaServiceCommand.CommandRuntime).OutputPipeline.FirstOrDefault();
@@ -148,10 +148,10 @@ public void ProcessGetMediaServiceByNameShouldNotReturnEntriesForNoneMatchingNam
Name = mediaServicesAccountName
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(SubscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(SubscriptionId)] = subscription;
+ 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/Websites/DisableAzureWebsiteDiagnosticTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs
index 5a690dbb913b..02402e166d7a 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs
@@ -57,10 +57,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplication()
File = true,
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
// Test
disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
@@ -89,10 +89,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplicationTableLog()
TableStorage = true
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
// Test
disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
@@ -121,10 +121,10 @@ public void DisableAzureWebsiteApplicationDiagnosticApplicationBlobLog()
BlobStorage = true
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
// Test
disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
@@ -155,10 +155,10 @@ public void DisablesApplicationDiagnosticOnSlot()
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 a3d46cf0b365..fba67f007d30 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs
@@ -12,18 +12,19 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
-using System.Collections.Generic;
-using System.Management.Automation;
-using Microsoft.WindowsAzure.Commands.Common;
+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 Xunit;
-using Microsoft.Azure.Common.Authentication;
using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Management.Automation;
+using Xunit;
namespace Microsoft.WindowsAzure.Commands.Test.Websites
{
@@ -56,6 +57,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplication()
WebsiteDiagnosticOutput.FileSystem,
properties, null));
+ SetupProfile(null);
+
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
CommandRuntime = commandRuntimeMock.Object,
@@ -65,13 +68,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplication()
LogLevel = LogEntryType.Information
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
-
// Test
- enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
+ enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();
// Assert
websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
@@ -95,6 +93,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
WebsiteDiagnosticOutput.StorageTable,
properties, null));
+ SetupProfile(null);
+
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
CommandRuntime = commandRuntimeMock.Object,
@@ -106,13 +106,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
StorageTableName = tableName
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
-
// Test
- enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
+ enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();
// Assert
websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
@@ -136,6 +131,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLogUseCurrent
WebsiteDiagnosticOutput.StorageTable,
properties, null));
+ SetupProfile(storageName);
+
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
CommandRuntime = commandRuntimeMock.Object,
@@ -146,14 +143,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLogUseCurrent
StorageTableName = tableName
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- AzureSession.Profile.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount] = storageName;
-
// Test
- enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
+ enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();
// Assert
websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
@@ -177,6 +168,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLog()
WebsiteDiagnosticOutput.StorageBlob,
properties, null));
+ SetupProfile(null);
+
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
CommandRuntime = commandRuntimeMock.Object,
@@ -188,13 +181,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLog()
StorageBlobContainerName = blobContainerName
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
-
// Test
- enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
+ enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();
// Assert
websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
@@ -218,6 +206,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLogUseCurrentS
WebsiteDiagnosticOutput.StorageBlob,
properties, null));
+ SetupProfile(storageName);
+
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
CommandRuntime = commandRuntimeMock.Object,
@@ -228,14 +218,8 @@ public void EnableAzureWebsiteApplicationDiagnosticApplicationBlobLogUseCurrentS
StorageBlobContainerName = blobContainerName
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- AzureSession.Profile.CurrentContext.Subscription.Properties[AzureSubscription.Property.StorageAccount] = storageName;
-
// Test
- enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();
+ enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();
// Assert
websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
@@ -256,6 +240,8 @@ public void EnableApplicationDiagnosticOnSlot()
WebsiteDiagnosticOutput.FileSystem,
properties,
slot));
+
+ SetupProfile(null);
enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
{
@@ -267,13 +253,8 @@ public void EnableApplicationDiagnosticOnSlot()
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
-
// 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 7af06a2a5cd5..54b65d29317d 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs
@@ -66,10 +66,10 @@ public void GetWebsiteMetricsBasicTest()
CommandRuntime = new MockCommandRuntime(),
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 165274dda7f9..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.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.Authentication;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Xunit;
namespace Microsoft.WindowsAzure.Commands.Test.Websites
{
@@ -50,18 +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.Profile = new AzureProfile();
- var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- getAzureWebsiteCommand.ExecuteCmdlet();
+ getAzureWebsiteCommand.ExecuteWithProcessing();
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count);
var sites = (IEnumerable)((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.FirstOrDefault();
Assert.NotNull(sites);
@@ -92,6 +90,7 @@ public void GetWebsiteProcessShowTest()
PublishingUsername = "user1"}
);
+ SetupProfile(null);
// Test
var getAzureWebsiteCommand = new GetAzureWebsiteCommand
@@ -100,12 +99,8 @@ public void GetWebsiteProcessShowTest()
Name = "website1",
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
- getAzureWebsiteCommand.ExecuteCmdlet();
+ getAzureWebsiteCommand.ExecuteWithProcessing();
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count);
SiteWithConfig website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig;
@@ -114,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
{
@@ -121,12 +118,8 @@ public void GetWebsiteProcessShowTest()
Name = "WEBSiTe1",
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
- subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
- getAzureWebsiteCommand.ExecuteCmdlet();
+ getAzureWebsiteCommand.ExecuteWithProcessing();
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count);
website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig;
@@ -139,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.Profile = new AzureProfile();
-
- Testing.AssertThrows(getAzureWebsiteCommand.ExecuteCmdlet, Resources.InvalidDefaultSubscription);
+ Testing.AssertThrows(getAzureWebsiteCommand.ExecuteWithProcessing, Resources.InvalidDefaultSubscription);
}
[Fact]
@@ -167,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(),
@@ -174,13 +171,9 @@ public void TestGetAzureWebsiteWithDiagnosticsSettings()
WebsitesClient = websitesClientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
// Test
- getAzureWebsiteCommand.ExecuteCmdlet();
+ getAzureWebsiteCommand.ExecuteWithProcessing();
// Assert
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count);
@@ -211,6 +204,7 @@ public void GetsWebsiteSlot()
PublishingUsername = "user1"
});
+ SetupProfile(null);
// Test
var getAzureWebsiteCommand = new GetAzureWebsiteCommand
{
@@ -219,12 +213,8 @@ public void GetsWebsiteSlot()
WebsitesClient = clientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
- getAzureWebsiteCommand.ExecuteCmdlet();
+ getAzureWebsiteCommand.ExecuteWithProcessing();
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count);
var website = ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline[0] as SiteWithConfig;
@@ -257,6 +247,8 @@ public void GetsSlots()
PublishingUsername = "user1"
});
+ SetupProfile(null);
+
// Test
var getAzureWebsiteCommand = new GetAzureWebsiteCommand
{
@@ -264,12 +256,8 @@ public void GetsSlots()
WebsitesClient = clientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
- 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 cb40e8630aaa..19318e4417fc 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs
@@ -74,10 +74,10 @@ public void GetAzureWebsiteDeploymentTest()
WebsitesClient = clientMock.Object,
CommandRuntime = new MockCommandRuntime(),
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription;
getAzureWebsiteDeploymentCommand.ExecuteCmdlet();
@@ -132,10 +132,10 @@ public void GetAzureWebsiteDeploymentLogsTest()
Details = true,
CommandRuntime = new MockCommandRuntime(),
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription;
getAzureWebsiteDeploymentCommand.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime)getAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count);
@@ -189,10 +189,10 @@ public void GetsDeploymentForSlot()
CommandRuntime = new MockCommandRuntime(),
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
+ 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 603e7a490a1d..8455b3e38a41 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs
@@ -18,6 +18,7 @@
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;
@@ -63,6 +64,7 @@ public void ProcessNewWebsiteTest()
createdWebspaceName = space;
});
+ SetupProfile(null);
// Test
MockCommandRuntime mockRuntime = new MockCommandRuntime();
NewAzureWebsiteCommand newAzureWebsiteCommand = new NewAzureWebsiteCommand
@@ -73,12 +75,8 @@ public void ProcessNewWebsiteTest()
Location = webspaceName,
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- newAzureWebsiteCommand.ExecuteCmdlet();
+ newAzureWebsiteCommand.ExecuteWithProcessing();
Assert.Equal(websiteName, createdSiteName);
Assert.Equal(webspaceName, createdWebspaceName);
Assert.Equal(websiteName, (mockRuntime.OutputPipeline[0] as SiteWithConfig).Name);
@@ -113,6 +111,8 @@ public void GetsWebsiteDefaultLocation()
created = true;
});
+ SetupProfile(null);
+
// Test
MockCommandRuntime mockRuntime = new MockCommandRuntime();
NewAzureWebsiteCommand newAzureWebsiteCommand = new NewAzureWebsiteCommand()
@@ -122,12 +122,8 @@ public void GetsWebsiteDefaultLocation()
Name = websiteName,
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- newAzureWebsiteCommand.ExecuteCmdlet();
+ newAzureWebsiteCommand.ExecuteWithProcessing();
Assert.True(created);
Assert.Equal(websiteName, (mockRuntime.OutputPipeline[0] as SiteWithConfig).Name);
clientMock.Verify(f => f.GetDefaultLocation(), Times.Once());
@@ -158,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
@@ -169,12 +166,8 @@ public void CreateStageSlot()
WebsitesClient = clientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
- 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 fa892d27f5d1..f42157e2b5a9 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs
@@ -17,6 +17,7 @@
using Microsoft.WindowsAzure.Commands.Common;
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;
@@ -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,14 +51,9 @@ public void ProcessRemoveWebsiteTest()
Name = "website1",
Slot = slot
};
-
- AzureSession.Profile = new AzureProfile();
- var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
- subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
// 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 35e84a6b6d22..e99200168854 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs
@@ -43,11 +43,11 @@ public void ProcessRestartWebsiteTest()
Name = websiteName,
WebsitesClient = websitesClientMock.Object
};
-
- AzureSession.Profile = new AzureProfile();
+
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
restartAzureWebsiteCommand.ExecuteCmdlet();
@@ -72,10 +72,10 @@ public void RestartsWebsiteSlot()
WebsitesClient = websitesClientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 1531b5189550..f5d72be4aa27 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs
@@ -85,10 +85,10 @@ public void RestoreAzureWebsiteDeploymentTest()
WebsitesClient = clientMock.Object,
CommandRuntime = new MockCommandRuntime(),
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime) restoreAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count);
@@ -107,10 +107,10 @@ public void RestoreAzureWebsiteDeploymentTest()
WebsitesClient = clientMock.Object,
CommandRuntime = new MockCommandRuntime(),
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime)restoreAzureWebsiteDeploymentCommand.CommandRuntime).OutputPipeline.Count);
@@ -176,10 +176,10 @@ public void RestoresDeploymentForSlot()
CommandRuntime = new MockCommandRuntime(),
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
restoreAzureWebsiteDeploymentCommand.ExecuteCmdlet();
@@ -200,10 +200,10 @@ public void RestoresDeploymentForSlot()
CommandRuntime = new MockCommandRuntime(),
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 f58686733dcd..b2d12b5b2c66 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs
@@ -86,10 +86,10 @@ public void SaveAzureWebsiteLogTest()
WebsitesClient = clientMock.Object,
CommandRuntime = new MockCommandRuntime(),
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
getAzureWebsiteLogCommand.DefaultCurrentPath = "";
getAzureWebsiteLogCommand.ExecuteCmdlet();
@@ -116,10 +116,10 @@ public void SaveAzureWebsiteLogWithNoFileExtensionTest()
CommandRuntime = new MockCommandRuntime(),
Output = "file_without_ext"
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
getAzureWebsiteLogCommand.DefaultCurrentPath = "";
getAzureWebsiteLogCommand.ExecuteCmdlet();
@@ -144,10 +144,10 @@ public void SaveAzureWebsiteLogWithSlotTest()
CommandRuntime = new MockCommandRuntime(),
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 a7b86114af28..54f4016ff952 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs
@@ -75,10 +75,10 @@ public void SetAzureWebsiteProcess()
NumberOfWorkers = 3,
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
setAzureWebsiteCommand.ExecuteCmdlet();
Assert.True(updatedSiteConfig);
@@ -94,10 +94,10 @@ public void SetAzureWebsiteProcess()
HostNames = new [] { "stuff.com" },
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
setAzureWebsiteCommand.ExecuteCmdlet();
Assert.False(updatedSiteConfig);
@@ -150,10 +150,10 @@ public void SetsWebsiteSlot()
WebsitesClient = clientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
setAzureWebsiteCommand.ExecuteCmdlet();
Assert.True(updatedSiteConfig);
@@ -170,10 +170,10 @@ public void SetsWebsiteSlot()
WebsitesClient = clientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
setAzureWebsiteCommand.ExecuteCmdlet();
Assert.False(updatedSiteConfig);
diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs
index 0b9a0ababe43..5371d0ea9e1b 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs
@@ -49,10 +49,10 @@ public void ProcessShowWebsiteTest()
Name = "website1",
WebsitesClient = mockClient.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 4b25d9188b3a..494cbcfd5ad4 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs
@@ -44,10 +44,10 @@ public void ProcessStartWebsiteTest()
Name = websiteName,
WebsitesClient = websitesClientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
startAzureWebsiteCommand.ExecuteCmdlet();
@@ -72,10 +72,10 @@ public void StartsWebsiteSlot()
WebsitesClient = websitesClientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 630bf00ca013..aca3e6b47b6c 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs
@@ -44,10 +44,10 @@ public void ProcessStopWebsiteTest()
Name = websiteName,
WebsitesClient = websitesClientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
stopAzureWebsiteCommand.ExecuteCmdlet();
@@ -72,10 +72,10 @@ public void StopsWebsiteSlot()
WebsitesClient = websitesClientMock.Object,
Slot = slot
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 d59171ec4dc5..20c6131bfd1a 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs
@@ -56,10 +56,10 @@ public void SwitchesSlots()
Name = "website1",
Force = true
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 f286080b9abe..87465ac96b37 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs
@@ -65,10 +65,10 @@ public void UpdatesRemote()
WebsitesClient = mockClient.Object,
Name = "website1",
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(base.subscriptionId)] = subscription;
+ 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 293f1ba7a06e..d372083f5f8e 100644
--- a/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs
+++ b/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs
@@ -53,10 +53,10 @@ public void ListWebHostingPlansTest()
CommandRuntime = new MockCommandRuntime(),
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
+ currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription;
command.ExecuteCmdlet();
Assert.Equal(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count);
@@ -84,10 +84,10 @@ public void GetAzureWebHostingPlanBasicTest()
CommandRuntime = new MockCommandRuntime(),
WebsitesClient = clientMock.Object
};
- AzureSession.Profile = new AzureProfile();
+ currentProfile = new AzureProfile();
var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
subscription.Properties[AzureSubscription.Property.Default] = "True";
- AzureSession.Profile.Subscriptions[new Guid(subscriptionId)] = subscription;
+ 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 f9b92e396b8f..301d6419547c 100644
--- a/src/ServiceManagement/Services/Commands.Test/packages.config
+++ b/src/ServiceManagement/Services/Commands.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs
index 9b2fac11b74f..a2dbbb599088 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs
@@ -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 c1d4a7cd11f8..f3acd3b7c2da 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj
+++ b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj
@@ -64,7 +64,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs
index 97f62c919442..9c0591eabb4a 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs
@@ -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/MediaServices/MediaServicesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs
index a20fc8286f47..f2a01200577d 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs
@@ -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.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs
index 9a885e130277..b15512878ef7 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs
@@ -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 2a6d6c5666c7..cc24f87f019a 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs
@@ -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 0bae6ab24d5c..2b82689bbeb8 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs
@@ -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/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/WebsitesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs
index 74835271bf51..dd8255ef943d 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs
+++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs
@@ -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 6e6da83c6288..44113bdc7ad7 100644
--- a/src/ServiceManagement/Services/Commands.Utilities/packages.config
+++ b/src/ServiceManagement/Services/Commands.Utilities/packages.config
@@ -4,7 +4,7 @@
-
+
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 5fe9ede444d2..143fc7096687 100644
--- a/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs
+++ b/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs
@@ -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 6f0e04b89a90..dd1aee30e185 100644
--- a/src/ServiceManagement/Services/Commands/Commands.csproj
+++ b/src/ServiceManagement/Services/Commands/Commands.csproj
@@ -62,7 +62,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 90ba2cb8809a..79d491c40c1a 100644
--- a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs
+++ b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs
@@ -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 cfcc634ba61c..72d5a0f81b8c 100644
--- a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs
+++ b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs
@@ -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 14c341f5f621..28348ec23121 100644
--- a/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs
+++ b/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs
@@ -57,11 +57,11 @@ public override void ExecuteCmdlet()
AzureEnvironment environment;
if (string.IsNullOrEmpty(Environment))
{
- environment = AzureSession.Profile.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 aa0ce34ed040..1a6eed314f4e 100644
--- a/src/ServiceManagement/Services/Commands/packages.config
+++ b/src/ServiceManagement/Services/Commands/packages.config
@@ -3,7 +3,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 17a09b7c80f7..8c39640cda1c 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
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 40a846c80384..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
@@ -19,6 +19,7 @@
using System.Management.Automation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
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/MockServer/MockHttpServer.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs
index 51c4c0f153f0..484e725b392d 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs
@@ -210,8 +210,6 @@ public static void SetupCertificates()
}
};
client.SetSubscriptionAsDefault(newGuid, "test");
- AzureSession.Profile = client.Profile;
-
client.Profile.Save();
diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config
index d5d73d52c57e..a3a38960a70b 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj
index 604e3b20940c..ba07df4d9a6d 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj
@@ -59,7 +59,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs
index 2b1c49a3d524..6c24bc034192 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs
@@ -136,7 +136,7 @@ public override void ExecuteCmdlet()
break;
case ByServerName:
- context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.Profile.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 30735cba962f..f3b907f4264f 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs
@@ -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.Profile.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 453bcbfeaa17..e5b126b3a8bf 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs
@@ -174,7 +174,7 @@ public override void ExecuteCmdlet()
var status = this.GetAzureSqlDatabaseImportExportStatusProcess(
serverName,
- serverName + AzureSession.Profile.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 c6fc1d5df18b..6d18c10a69b0 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs
@@ -111,7 +111,7 @@ public override void ExecuteCmdlet()
break;
case ByServerName:
- context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.Profile.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 cc3a72454ca5..3a68f50dff60 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs
@@ -98,7 +98,7 @@ public override void ExecuteCmdlet()
break;
case ByServerName:
- context = ServerDataServiceCertAuth.Create(this.ServerName, AzureSession.Profile.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 994c27a7ebba..c6612d0cbac5 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs
@@ -171,11 +171,11 @@ private void ProcessWithServerName(int? maxSizeGb, long? maxSizeBytes)
try
{
// Get the current subscription data.
- AzureSubscription subscription = AzureSession.Profile.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 18f51d223a14..ac9d0bab1de3 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs
@@ -152,7 +152,7 @@ private AzureSubscription CurrentSubscription
{
if (string.IsNullOrEmpty(SubscriptionName))
{
- return AzureSession.Profile.CurrentContext.Subscription;
+ return Profile.Context.Subscription;
}
ProfileClient client = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
@@ -217,7 +217,7 @@ internal ServerDataServiceCertAuth GetServerDataServiceByCertAuth(
try
{
- context = ServerDataServiceCertAuth.Create(serverName, subscription);
+ context = ServerDataServiceCertAuth.Create(serverName, Profile, subscription);
}
catch (ArgumentException e)
{
@@ -312,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.Profile.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 a591d44da49d..a75af47d6d32 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs
@@ -201,11 +201,11 @@ private void ProcessWithServerName(string databaseName)
try
{
// Get the current subscription data.
- AzureSubscription subscription = AzureSession.Profile.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 e282d454fd92..4a95756f2ecd 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs
@@ -280,11 +280,11 @@ private void ProcessWithServerName(string databaseName, int? maxSizeGb, long? ma
try
{
// Get the current subscription data.
- AzureSubscription subscription = AzureSession.Profile.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 23dadc019a5b..ea6e1448bc06 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs
@@ -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.Profile.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 c28cfe6302cf..b3934c239380 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs
@@ -210,7 +210,7 @@ public override void ExecuteCmdlet()
// Retrieve the fully qualified server name
string fullyQualifiedServerName =
- this.SqlConnectionContext.ServerName + AzureSession.Profile.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 bd51e1e8a7c3..bd64173db684 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs
@@ -233,7 +233,7 @@ public override void ExecuteCmdlet()
// Retrieve the fully qualified server name
string fullyQualifiedServerName =
- this.SqlConnectionContext.ServerName + AzureSession.Profile.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 d5d5f9e8a1c5..19b6149b0f8a 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs
@@ -199,7 +199,7 @@ public override void ExecuteCmdlet()
{
string serverName = this.SourceServerName ?? connectionContext.ServerName;
- connectionContext = ServerDataServiceCertAuth.Create(serverName, AzureSession.Profile.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 88ffcc275dd7..d7ab94491a6c 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs
@@ -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.Profile.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 80b83babdbfb..4e18a0e84e37 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs
@@ -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 673b5a3e3660..4a351c5a323c 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs
@@ -61,9 +61,9 @@ public static string GenerateClientTracingId()
protected SqlManagementClient GetCurrentSqlClient()
{
// Get the SQL management client for the current subscription
- AzureSubscription subscription = AzureSession.Profile.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;
diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config
index cb3d2ca2ca78..bbee4f31b955 100644
--- a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config
+++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config
@@ -3,7 +3,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 39ace81b853e..dbc7b0130e04 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj
@@ -40,7 +40,7 @@
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config
index e71d93d6a048..08d838fd16c6 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj
index f7e2ca3491ea..0f7248a00d12 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj
@@ -50,7 +50,7 @@
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs
index 83618d5751a4..d305ab58a859 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs
@@ -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.Profile.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 44ef561d0beb..e55d01d4ce58 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config
@@ -3,7 +3,7 @@
-
+
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 d27e0571dab8..cfc379fa22f2 100644
--- a/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj
+++ b/src/ServiceManagement/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj
@@ -56,7 +56,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config b/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config
index 35ab063bad06..b5315e8cb7fe 100644
--- a/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config
+++ b/src/ServiceManagement/Storage/Commands.Storage.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj
index 7abcb2302b12..3e31db20f90b 100644
--- a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj
+++ b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj
@@ -51,7 +51,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.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 e8fe21106612..2b6b26dc4b04 100644
--- a/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs
+++ b/src/ServiceManagement/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs
@@ -344,13 +344,14 @@ internal CloudStorageAccount GetStorageAccountWithAzureEnvironment(StorageCreden
if (string.IsNullOrEmpty(azureEnvironmentName))
{
- azureEnvironment = AzureSession.Profile.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 d8cc2980e061..c964a994d9c6 100644
--- a/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs
+++ b/src/ServiceManagement/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs
@@ -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 35ab063bad06..b5315e8cb7fe 100644
--- a/src/ServiceManagement/Storage/Commands.Storage/packages.config
+++ b/src/ServiceManagement/Storage/Commands.Storage/packages.config
@@ -3,7 +3,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 4cf87f076eca..5cbe15f668de 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj
@@ -43,7 +43,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config
index e58259eb252c..719f00a92dad 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj
index e0bfb030b291..9025aa609182 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj
@@ -53,7 +53,7 @@
False
- ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.4-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
+ ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.6-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll
..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll
diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs
index fc652d83e066..d6afbc7a29af 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs
@@ -36,8 +36,8 @@ public override void ExecuteCmdlet()
private string GetDomainNameToCheck(string domainName)
{
- string TrafficManagerSuffix = !string.IsNullOrEmpty(AzureSession.Profile.CurrentContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix)) ?
- AzureSession.Profile.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 fe2321015698..552a685d7b43 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs
@@ -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 98a2269e824e..b683f97a5f39 100644
--- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config
+++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config
@@ -3,7 +3,7 @@
-
+