Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Common/Commands.ResourceManager.Common/RMProfileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ public AzureRMProfile Login(AzureAccount account, AzureEnvironment environment,
{
foreach(var tenant in ListAccountTenants(account, environment, password, promptBehavior))
{
if (TryGetTenantSubscription(account, environment, tenant.Id.ToString(), subscriptionId, password, ShowDialog.Auto, out newSubscription, out newTenant))
AzureTenant tempTenant;
if (TryGetTenantSubscription(account, environment, tenant.Id.ToString(), subscriptionId, password, ShowDialog.Auto, out newSubscription, out tempTenant))
{
break;
newTenant = tempTenant;
}
}
}
Expand Down Expand Up @@ -251,7 +252,8 @@ private IEnumerable<AzureSubscription> ListSubscriptionsForTenant(AzureAccount a
environment,
tenantId,
password,
promptBehavior);
promptBehavior,
TokenCache.DefaultShared);
using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient<SubscriptionClient>(
new TokenCloudCredentials(accessToken.AccessToken),
environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public class SelectAzureRMProfileCommand : AzureRMCmdlet
[Parameter(ParameterSetName = ProfileFromDiskParameterSet, Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true)]
public string Path { get; set; }

protected override void BeginProcessing()
{
// Do not access the DefaultContext when loading a profile
}

protected override void ProcessRecord()
{
if (!string.IsNullOrEmpty(Path))
Expand Down