handle multiple Azure accounts correctly

This commit is contained in:
Mykola Marzhan 2018-03-30 09:23:31 +03:00
parent 3f94a49b70
commit 3cfbec623a
1 changed files with 2 additions and 2 deletions

View File

@ -85,9 +85,9 @@ askSubscription() {
if [ "$azure_subscription_id" != "" ]; then
az account set --subscription $azure_subscription_id
else
azure_subscription_id=$(az account list | jq -r .[].id)
azure_subscription_id=$(az account list | jq -r '.[] | select(.isDefault==true) | .id')
fi
azure_tenant_id=$(az account list | jq -r '.[] | select(.tenantId) | .tenantId')
azure_tenant_id=$(az account list | jq -r '.[] | select(.id=="'$azure_subscription_id'") | .tenantId')
echo "Using subscription_id: $azure_subscription_id"
echo "Using tenant_id: $azure_tenant_id"
}