Skip to content

Commit 7115e20

Browse files
authored
Update environment when updating context (#229)
* managed hsm endpoints * fix * Update env when updating context * do not update the same context
1 parent 6fe949c commit 7115e20

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Authentication.Abstractions/Extensions/AzureContextExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,12 @@ public static IAzureAccount GetAccount(this IAzureContextContainer container, st
139139
/// <param name="other">The context to update from</param>
140140
public static void Update(this IAzureContext context, IAzureContext other)
141141
{
142-
if (context != null && other != null)
142+
if (context != null && other != null && context != other)
143143
{
144144
context.Account.Update(other.Account);
145145
context.Subscription.Update(other.Subscription);
146146
context.Tenant.Update(other.Tenant);
147+
context.Environment.Update(other.Environment);
147148
context.UpdateProperties(other);
148149
}
149150
}

src/Authentication.Abstractions/Extensions/AzureEnvironmentExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ public static void CopyFrom(this IAzureEnvironment environment, IAzureEnvironmen
538538

539539
public static void Update(this IAzureEnvironment environment, IAzureEnvironment other)
540540
{
541-
if (environment != null && other != null)
541+
if (environment != null && other != null && environment != other)
542542
{
543543
environment.OnPremise = other.OnPremise;
544544
if (other.IsEndpointSet(AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId))

0 commit comments

Comments
 (0)