зеркало из https://github.com/microsoft/AMBROSIA.git
AKS-Scripts: likewise update the service principal script.
This commit is contained in:
Родитель
713cc8318b
Коммит
b607e54c4c
|
@ -14,6 +14,9 @@ set -euo pipefail
|
||||||
echo "-----------Begin Create-AKS-ServicePrincipal-Secret-----------"
|
echo "-----------Begin Create-AKS-ServicePrincipal-Secret-----------"
|
||||||
source `dirname $0`/Defs/Common-Defs.sh
|
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.
|
# Create a 'Reader' role assignment with a scope of the ACR resource.
|
||||||
# Idempotence: retrieve the password if it already exists, otherwise create:
|
# Idempotence: retrieve the password if it already exists, otherwise create:
|
||||||
if ! $AZ ad sp show --id http://$SERVICE_PRINCIPAL_NAME >- ;
|
if ! $AZ ad sp show --id http://$SERVICE_PRINCIPAL_NAME >- ;
|
||||||
|
@ -21,7 +24,7 @@ then
|
||||||
echo "Creating 'Reader' role and password."
|
echo "Creating 'Reader' role and password."
|
||||||
ACR_REGISTRY_ID=$($AZ acr show --name $ACR_NAME --query id --output tsv)
|
ACR_REGISTRY_ID=$($AZ acr show --name $ACR_NAME --query id --output tsv)
|
||||||
set -x
|
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
|
set +x
|
||||||
else
|
else
|
||||||
echo "Service principal exists, ASSUMING it's up-to-date (manually clean w Clean-AKS.sh)"
|
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.
|
# translation so that the "--scope=$ACR_ID" below is not mangled on Windows.
|
||||||
# It should have no affect on Linux/MacOS.
|
# It should have no affect on Linux/MacOS.
|
||||||
export MSYS_NO_PATHCONV=1
|
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:
|
# Set it to empty string if there's an error:
|
||||||
EXISTING_ROLES=""
|
EXISTING_ROLES=""
|
||||||
|
|
Загрузка…
Ссылка в новой задаче