Skip to content

Instantly share code, notes, and snippets.

@abderrazak-bouadma
Created April 26, 2018 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abderrazak-bouadma/80a024a9e0da0a06f4e18a7fdfd5c443 to your computer and use it in GitHub Desktop.
Save abderrazak-bouadma/80a024a9e0da0a06f4e18a7fdfd5c443 to your computer and use it in GitHub Desktop.
#!/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