Skip to content

Commit

Permalink
Attempt to assign data reader role to MI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jont828 committed Nov 26, 2024
1 parent 1ac9271 commit d013d4b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/aks-as-mgmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ create_aks_cluster() {
sleep 5
done

# If storage account var is set:
if [ -n "${AZURE_STORAGE_ACCOUNT}" ]; then
echo "assigning storage blob data reader role to the service principal"
until az role assignment create --assignee-object-id "${AKS_MI_OBJECT_ID}" --role "Storage Blob Data Reader" \
--scope "/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${AZURE_STORAGE_ACCOUNT_RESOURCE_GROUP}/providers/Microsoft.Storage/storageAccounts/${AZURE_STORAGE_ACCOUNT}/blobServices/default/containers/${AZURE_BLOB_CONTAINER_NAME}" \
--assignee-principal-type ServicePrincipal; do
echo "retrying to assign storage blob data reader role to the service principal"
sleep 5
done
fi

echo "using ASO_CREDENTIAL_SECRET_MODE as podidentity"
ASO_CREDENTIAL_SECRET_MODE="podidentity"
}
Expand Down

0 comments on commit d013d4b

Please sign in to comment.