Skip to content

Commit a6ff859

Browse files
authored
Add acr environment extention to fix get/add/set azenvironment (#231)
* add container registry to azure environment extention * fix
1 parent 7115e20 commit a6ff859

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Authentication.Abstractions/Extensions/AzureEnvironmentExtensions.cs

+17
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ public static bool TryGetEndpointString(this IAzureEnvironment environment, stri
151151
case AzureEnvironment.Endpoint.BatchEndpointResourceId:
152152
propertyValue = environment.BatchEndpointResourceId;
153153
break;
154+
case AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix:
155+
propertyValue = environment.ContainerRegistryEndpointSuffix;
156+
break;
154157
default:
155158
// get property from the extended properties of the environment
156159
propertyValue = environment.GetProperty(endpointName);
@@ -265,6 +268,9 @@ public static void SetEndpoint(this IAzureEnvironment environment, string endpoi
265268
case AzureEnvironment.Endpoint.ServiceManagement:
266269
environment.ServiceManagementUrl = propertyValue;
267270
break;
271+
case AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix:
272+
environment.ContainerRegistryEndpointSuffix = propertyValue;
273+
break;
268274
case AzureEnvironment.ExtendedEndpoint.OperationalInsightsEndpointResourceId:
269275
environment.SetProperty(AzureEnvironment.ExtendedEndpoint.OperationalInsightsEndpointResourceId, propertyValue);
270276
break;
@@ -342,6 +348,9 @@ public static string GetTokenAudience(this IAzureEnvironment environment, string
342348
case AzureEnvironment.ExtendedEndpoint.ManagedHsmServiceEndpointResourceId:
343349
resource = AzureEnvironment.ExtendedEndpoint.ManagedHsmServiceEndpointResourceId;
344350
break;
351+
case AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix:
352+
resource = AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix;
353+
break;
345354
default:
346355
resource = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId;
347356
break;
@@ -524,6 +533,10 @@ public static void CopyFrom(this IAzureEnvironment environment, IAzureEnvironmen
524533
{
525534
environment.BatchEndpointResourceId = other.BatchEndpointResourceId;
526535
}
536+
if (other.IsEndpointSet(AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix))
537+
{
538+
environment.ContainerRegistryEndpointSuffix = other.ContainerRegistryEndpointSuffix;
539+
}
527540

528541
environment.VersionProfiles.Clear();
529542
foreach (var profile in other.VersionProfiles)
@@ -615,6 +628,10 @@ public static void Update(this IAzureEnvironment environment, IAzureEnvironment
615628
{
616629
environment.DataLakeEndpointResourceId = other.DataLakeEndpointResourceId;
617630
}
631+
if (other.IsEndpointSet(AzureEnvironment.Endpoint.ContainerRegistryEndpointSuffix))
632+
{
633+
environment.ContainerRegistryEndpointSuffix = other.ContainerRegistryEndpointSuffix;
634+
}
618635

619636
foreach (var profile in other.VersionProfiles)
620637
{

0 commit comments

Comments
 (0)