Skip to content

Commit a17c7d5

Browse files
committed
skip classic acr from login
1 parent 7b18206 commit a17c7d5

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/ContainerRegistry/ContainerRegistry/Commands/ConnectAzureContainerRegistry.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,8 @@ public override void ExecuteCmdlet() {
5656

5757
if (ParameterSetName.Equals(WithoutNameAndPasswordParameterSet))
5858
{
59-
//try to get registry from current subscription
60-
IList<PSContainerRegistry> registries = this.RegistryClient.ListAllRegistries(null);
61-
PSContainerRegistry registry = null;
62-
if (registries != null || registries.Count != 0)
63-
{
64-
registry = registries.FirstOrDefault(x => x.Name.Equals(Name));
65-
}
66-
67-
if (registry != null && registry.SkuName.Equals("Classic"))
68-
{
69-
//use admin login if allowed for SKU == classic
70-
if (registry.AdminUserEnabled == true)
71-
{
72-
PSContainerRegistryCredential credential = new PSContainerRegistryCredential(this.RegistryClient.ListRegistryCredentials(registry.ResourceGroupName, registry.Name));
73-
this.UserName = credential.Username;
74-
this.Password = credential.Password;
75-
}
76-
else
77-
{
78-
throw new PSArgumentException("Registry " + registry.Name + "with SKU Classic has admin user disabled, please provide username and password");
79-
}
80-
}
81-
else
82-
{
83-
this.UserName = new Guid().ToString();
84-
this.Password = this.RegistryDataPlaneClient.GetRefreshToken();
85-
}
59+
this.UserName = new Guid().ToString();
60+
this.Password = this.RegistryDataPlaneClient.GetRefreshToken();
8661
}
8762

8863
string LoginScript = string.Format("'{2}' | docker login {0} -u {1} --password-stdin", this.RegistryDataPlaneClient.GetEndPoint(), this.UserName, this.Password);

0 commit comments

Comments
 (0)