Installing Azure CLI

·
1 min read
notes
#ubuntu #aks

How to install Azure CLI

We can install from Microsoft’s repo or install from PIP. However, when using system’s PIP, it would get:

Terminal window
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "

The message is harmless, but annoying. I want to install it as my own user.

Install venv:

Terminal window
sudo apt -y install python3-venv

Create an environment for Azure CLI:

Terminal window
mkdir -p ~/.local/share/python3
python3 -m venv ~/.local/share/python3/env-az

Enable that:

Terminal window
source ~/.local/share/python3/env-az/bin/activate

Install Azure CLI:

Terminal window
pip install azure-cli

Notes

Everytime want to use the Azure CLI, just activate:

Terminal window
source ~/.local/share/python3/env-az/bin/activate

add to ~/.bashrc to have it permanent.

I’m using ~/.local/share path to have it FHS compliant.