forked from Azure/kubernetes-hackfest
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added script to grant AKS access to ACR
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
AKS_RESOURCE_GROUP=myAKSResourceGroup | ||
AKS_CLUSTER_NAME=myAKSCluster | ||
ACR_RESOURCE_GROUP=myACRResourceGroup | ||
ACR_NAME=myACRRegistry | ||
|
||
# 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 |