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
1 change: 1 addition & 0 deletions src/Aks/Aks/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed the issue that `Set-AzAks` will fail in Automation Runbook. [#15006]

## Version 2.1.0
* Added support `AcrNameToAttach` in `Set-AzAksCluster`. [#14692]
Expand Down
18 changes: 11 additions & 7 deletions src/Aks/Aks/Commands/SetAzureRmAks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,18 @@ public override void ExecuteCmdlet()
cluster = BuildNewCluster();
}

acsServicePrincipal = EnsureServicePrincipal(ServicePrincipalIdAndSecret?.UserName, ServicePrincipalIdAndSecret?.Password?.ConvertToString());
if (this.IsParameterBound(c => c.AcrNameToAttach))
if (this.IsParameterBound(c => c.AcrNameToAttach) ||
this.IsParameterBound(c => c.AcrNameToDetach))
{
AddAcrRoleAssignment(AcrNameToAttach, nameof(AcrNameToAttach), acsServicePrincipal);
}
if (this.IsParameterBound(c => c.AcrNameToDetach))
{
RemoveAcrRoleAssignment(AcrNameToDetach, nameof(AcrNameToDetach), acsServicePrincipal);
acsServicePrincipal = EnsureServicePrincipal(ServicePrincipalIdAndSecret?.UserName, ServicePrincipalIdAndSecret?.Password?.ConvertToString());
if (this.IsParameterBound(c => c.AcrNameToAttach))
{
AddAcrRoleAssignment(AcrNameToAttach, nameof(AcrNameToAttach), acsServicePrincipal);
}
if (this.IsParameterBound(c => c.AcrNameToDetach))
{
RemoveAcrRoleAssignment(AcrNameToDetach, nameof(AcrNameToDetach), acsServicePrincipal);
}
}

var kubeCluster = Client.ManagedClusters.CreateOrUpdate(ResourceGroupName, Name, cluster);
Expand Down