Created
April 26, 2018 16:18
-
-
Save abderrazak-bouadma/80a024a9e0da0a06f4e18a7fdfd5c443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
AKS_RESOURCE_GROUP=DIOR-AKS-CLUSTER-RG | |
AKS_CLUSTER_NAME=akscluster | |
ACR_RESOURCE_GROUP=DIOR-CONTAINER-REGISTRY-RG | |
ACR_NAME=dioracr | |
# Get the id of the service principal configured for AKS | |
CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv) | |
# Get the ACR registry resource id | |
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $ACR_RESOURCE_GROUP --query "id" --output tsv) | |
# Create role assignment | |
az role assignment create --assignee $CLIENT_ID --role Reader --scope $ACR_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment