AKS-Scripts: likewise update the service principal script.

This commit is contained in:
Ryan Newton 2018-12-06 13:51:14 -08:00
Родитель 713cc8318b
Коммит b607e54c4c
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -14,6 +14,9 @@ set -euo pipefail
echo "-----------Begin Create-AKS-ServicePrincipal-Secret-----------"
source `dirname $0`/Defs/Common-Defs.sh
# See Grant-AKS-acess-ACR.sh for more explanation:
export MSYS_NO_PATHCONV=1
# Create a 'Reader' role assignment with a scope of the ACR resource.
# Idempotence: retrieve the password if it already exists, otherwise create:
if ! $AZ ad sp show --id http://$SERVICE_PRINCIPAL_NAME >- ;
@ -21,7 +24,7 @@ then
echo "Creating 'Reader' role and password."
ACR_REGISTRY_ID=$($AZ acr show --name $ACR_NAME --query id --output tsv)
set -x
$AZ ad sp create-for-rbac --name http://$SERVICE_PRINCIPAL_NAME --role Reader --scopes $ACR_REGISTRY_ID
$AZ ad sp create-for-rbac --name http://$SERVICE_PRINCIPAL_NAME --role Reader "--scopes=$ACR_REGISTRY_ID"
set +x
else
echo "Service principal exists, ASSUMING it's up-to-date (manually clean w Clean-AKS.sh)"

Просмотреть файл

@ -34,6 +34,8 @@ ACR_ID=$($AZ acr show --name $ACR_NAME --resource-group $AZURE_RESOURCE_GROUP --
# translation so that the "--scope=$ACR_ID" below is not mangled on Windows.
# It should have no affect on Linux/MacOS.
export MSYS_NO_PATHCONV=1
# For reference, see this discussion:
# https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line
# Set it to empty string if there's an error:
EXISTING_ROLES=""