Skip to content

Instantly share code, notes, and snippets.

@mikamboo
Last active April 2, 2020 23:02
Show Gist options
  • Save mikamboo/fd2468c2b4b13711ba6623f78b62a163 to your computer and use it in GitHub Desktop.
Save mikamboo/fd2468c2b4b13711ba6623f78b62a163 to your computer and use it in GitHub Desktop.
Azure CLI : Quick az cli with Docker
title author date slug cover
Quick az cli with docker
mikamboo
2020-04-02 23:43
post-about-lorem-ipsum

Quick az cli with docker

Use Docker to creadte an quick and up to date az cli alias on Linux.

Setup

Create local container with lastest image

docker run -it --name azure-cli -v $HOME/.azure/:/root/.azure mcr.microsoft.com/azure-cli

Create az alias for azure-cli

echo "alias az='docker start -i azure-cli'" >> ~/.bashrc
source  ~/.bashrc

Test : Type az on terminal must display bash promt. Inside it, type az --version must display cli version infos.

Authentication

az login

Azure config folder will be created $HOME/.azure and will be mounted inside azure-cli every time it started.

More

@mikamboo
Copy link
Author

Test :

az
bash-5.0# az --version

Output :

azure-cli                          2.2.0

command-modules-nspkg              2.0.3
core                               2.2.0
nspkg                              3.0.4
telemetry                          1.0.4

Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.9 (default, Nov 15 2019, 03:58:01) 
[GCC 8.3.0]

Legal docs and information: aka.ms/AzureCliLegal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment