Azure CLI is broken Again

Joaquín Menchaca (智裕)
2 min readDec 10, 2021

Recently, I wanted to do some work with Azure Kubernetes Service, but unfortunately, the command line tools with Azure CLI yields a traceback when doing anything with AKS. This is not the first time this has happened. This is on macOS, so maybe it works on Linux, I do not know.

UPDATE: A new version of Azure CLI v2.31.0 was recently released and it seems to have fixed the issue. Thank you developers of this project.

The Bug

I usually start with Azure CLI, as this is the most direct route, and should be supported by Azure team. However, after updating, I was surprised to find the tools (Azure CLI v2.30.0) no longer work with AKS:

brew upgrade azure-cli
az login
az aks create \
--resource-group ${AZ_RESOURCE_GROUP} \
--name ${AZ_AKS_CLUSTER_NAME} \
--generate-ssh-keys \
--vm-set-type VirtualMachineScaleSets \
--node-vm-size ${AZ_VM_SIZE} \
--load-balancer-sku standard \
--node-count 3 \
--zones 1 2 3

And ka-boom:

I found that other people are experiencing this issue, and is noted in Azure/azure-cli GitHub issues 20644, 20348 , 20269. I tweeted Microsoft Azure about this, but didn’t get much of a response.

Root Cause

Apparently the root cause has to deal with python-tabulate mentioned in python-tabulate/pull/105 and Python 3.10, which is the underlying python targeted used by Azure CLI.

Alternative using Terraform

Azure CLI (az) are essentially python scripts that interact with Azure Resource Manager API. Instead of relying on these tools for infrastructure, you can use Terraform to create a cluster and retrieve the credentials needed for the Kubernetes client CLI (kubectl).

Conclusion

I typically would not write blog on such an error, but just that this has happened before, and I am shocked that the official client tools for Azure cloud can be released into the public with such bugs.

If this was a pure open source tool, then it is up to the community (all of us) to help out the best we can. However, given this is a commercial service, and these are the designated tools to access the service, I hope it is not unreasonable to expect the tools to actually work.

In the mean time, when this happens, you can use either ① the Azure Portal, ② Azure RM API through curl or scripts, or ③ use a configuration tool like Terraform.

--

--

Joaquín Menchaca (智裕)
Joaquín Menchaca (智裕)

Written by Joaquín Menchaca (智裕)

DevOps/SRE/PlatformEng — k8s, o11y, vault, terraform, ansible

Responses (1)