I found a bug in Azure's az
CLI when it parses variables.
I was tagging a lot of resources and initially did this:
export ENV=demo
export VERSION=
export RG=rg-apps-${ENV}${VERSION}
export LOCATION=eastus
export SUBSCRIPTION="my-subscription-id"
export TENANT_ID=$(az account show --query tenantId -o tsv)
export DOMAIN=strongholdresourcepartners.com
# Now, set TAGS, but notice how I added the flag in the variable. az doesn't care for that
export TAGS="--tags env=${ENV} owner=technology business_unit=technology"
# add a nodepool to the cluster I made in the previous step:
az aks nodepool add --name userpool \
--resource-group ${RG} \
--cluster-name ${CLUSTER} \
--node-count 1 \
--enable-cluster-autoscaler \
--min-count 1 \
--max-count 6 \
--node-vm-size Standard_D2s_v3 \
${TAGS} \
--zones 1 2 \
--mode User \
But this would fail with an error complaining about not supporting the tags flag on the CLI. But, az aks nodepool add -h
clearly shows that it takes --tags
. This also happened in a bunch of other commands -- BUT NOT ALL of them which made this a little confusing.
The solution is to do this, instead:
# Now, set TAGS, but notice how I added the flag in the variable. az doesn't care for that
export TAGS="env=${ENV} owner=technology business_unit=technology"
# add a nodepool to the cluster I made in the previous step:
az aks nodepool add --name userpool \
--resource-group ${RG} \
--cluster-name ${CLUSTER} \
--node-count 1 \
--enable-cluster-autoscaler \
--min-count 1 \
--max-count 6 \
--node-vm-size Standard_D2s_v3 \
--tags ${TAGS} \
--zones 1 2 \
--mode User \
az
is your friend again if you this.