Changed Service Principal Creation sequence to comply with newer CLI reqs
This commit is contained in:
parent
ab48ed3fe6
commit
403fe17f96
|
@ -11,6 +11,7 @@ azure_subscription_id= # Derived from the account after login
|
||||||
azure_tenant_id= # Derived from the account after login
|
azure_tenant_id= # Derived from the account after login
|
||||||
location=
|
location=
|
||||||
azure_object_id=
|
azure_object_id=
|
||||||
|
azureversion=
|
||||||
|
|
||||||
showhelp() {
|
showhelp() {
|
||||||
echo "azure-setup"
|
echo "azure-setup"
|
||||||
|
@ -156,7 +157,20 @@ createApplication() {
|
||||||
|
|
||||||
createServicePrincipal() {
|
createServicePrincipal() {
|
||||||
echo "==> Creating service principal"
|
echo "==> Creating service principal"
|
||||||
azure ad sp create $azure_client_id
|
# Azure CLI 0.10.2 introduced a breaking change, where appId must be supplied with the -a switch
|
||||||
|
# prior version accepted appId as the only parameter without a switch
|
||||||
|
newer_syntax = false
|
||||||
|
IFS='.' read -ra azureversionsemver <<< "$azureversion"
|
||||||
|
if [[ ${azureversionsemver[0]} -ge 0 && ${azureversionsemver[1]} -ge 10 && ${azureversionsemver[2]} -ge 2]]; then
|
||||||
|
newer_syntax = true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [newer_syntax -eq true ]; then
|
||||||
|
azure ad sp create -a $azure_client_id
|
||||||
|
else
|
||||||
|
azure ad sp create $azure_client_id
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error creating service principal: $azure_client_id"
|
echo "Error creating service principal: $azure_client_id"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue