From 3cfbec623a149da5e3c24e2301bcad89583bca4d Mon Sep 17 00:00:00 2001 From: Mykola Marzhan Date: Fri, 30 Mar 2018 09:23:31 +0300 Subject: [PATCH] handle multiple Azure accounts correctly --- contrib/azure-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/azure-setup.sh b/contrib/azure-setup.sh index 8ccd0cbc0..6149b38d0 100755 --- a/contrib/azure-setup.sh +++ b/contrib/azure-setup.sh @@ -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" }