azure-cli output config check added

Adds a check to contrib/azure-setup.sh which ensure the users azure-cli is configured to output json.
This commit is contained in:
andrew-best-diaxion 2018-04-13 14:02:55 +10:00
parent 545b2c4e0f
commit 0f0fc1b99c
1 changed files with 202 additions and 192 deletions

View File

@ -12,6 +12,7 @@ azure_tenant_id= # Derived from the account after login
location=
azure_object_id=
azureversion=
azurecliconfig=
create_sleep=10
showhelp() {
@ -59,6 +60,15 @@ requirements() {
echo "Alternatively, you can use the Cloud Shell https://docs.microsoft.com/en-us/azure/cloud-shell/overview right from the Azure Portal or even VS Code."
fi
azurecliconfig=$(cat $HOME/.azure/config | grep output | awk -F'[ ]' '{print $3}')
if [ "$azurecliconfig" == "json" ]; then
found=$((found +1))
echo "Found correct azure-cli output configuration: output = $azurecliconfig."
else
echo "azure-cli is configured for $azurecliconfig output."
echo "Please reconfigure your azure-cli client to output using json."
fi
jqversion=$(jq --version)
if [ $? -eq 0 ]; then
found=$((found + 1))
@ -68,7 +78,7 @@ requirements() {
echo "https://stedolan.github.io/jq/"
fi
if [ $found -lt 2 ]; then
if [ $found -lt 3 ]; then
exit 1
fi
}