In this post, let's see how we can attach an Azure Container Registry
(ACR) to an existing Azure Kubernetes Cluster (AKS), but here
the ACR is in a different subscription.
Using Azure CLI, the command to attach an ACR to an existing AKS is,
# Attach using acr-name
az aks update -n <aks-name> -g <resource-group-name> --attach-acr <acr-name>
# Attach using acr-resource-id
az aks update -n <aks-name> -g <resource-group-name> --attach-acr <acr-resource-id>
Since the ACR is in a different subscription, we can't attach using acr-name. Instead, we need to attach using the acr-resource-id.
While you can get the ResourceId from the URL after navigating to your
ACR from the Azure Portal, the best approach is to get it from Azure CLI.
# Switch to subscription where ACR resides in
az account set --subscription <SubscriptionId>
# List resource information of the ACR
az resource list --name <acr-name>
And this will list something like below.
And now you can run the attach command with Resource Id.
# Attach using acr-resource-id
az aks update -n <aks-name> -g <resource-group-name> --attach-acr <acr-resource-id>
Hope this helps.
Happy Coding.
Regards,
Jaliya
No comments:
Post a Comment