Skip to content

Commit c68d6d8

Browse files
committed
Merge branch 'dev' of github.com:Azure/azure-powershell into bugfix
2 parents b45b070 + 7e59cda commit c68d6d8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Common/Commands.ResourceManager.Common/RMProfileClient.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ public AzureRMProfile Login(AzureAccount account, AzureEnvironment environment,
6262
{
6363
foreach(var tenant in ListAccountTenants(account, environment, password, promptBehavior))
6464
{
65-
if (TryGetTenantSubscription(account, environment, tenant.Id.ToString(), subscriptionId, password, ShowDialog.Auto, out newSubscription, out newTenant))
65+
AzureTenant tempTenant;
66+
if (TryGetTenantSubscription(account, environment, tenant.Id.ToString(), subscriptionId, password, ShowDialog.Auto, out newSubscription, out tempTenant))
6667
{
67-
break;
68+
newTenant = tempTenant;
6869
}
6970
}
7071
}
@@ -345,7 +346,8 @@ private IEnumerable<AzureSubscription> ListSubscriptionsForTenant(AzureAccount a
345346
environment,
346347
tenantId,
347348
password,
348-
promptBehavior);
349+
promptBehavior,
350+
TokenCache.DefaultShared);
349351
using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient<SubscriptionClient>(
350352
new TokenCloudCredentials(accessToken.AccessToken),
351353
environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)))

src/Common/Commands.ResourceManager.Profile/Profile/SelectAzureRMProfile.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public class SelectAzureRMProfileCommand : AzureRMCmdlet
3535
[Parameter(ParameterSetName = ProfileFromDiskParameterSet, Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true)]
3636
public string Path { get; set; }
3737

38+
protected override void BeginProcessing()
39+
{
40+
// Do not access the DefaultContext when loading a profile
41+
}
42+
3843
protected override void ProcessRecord()
3944
{
4045
if (!string.IsNullOrEmpty(Path))

0 commit comments

Comments
 (0)