Zero to Azure CLI in Seconds Using Docker

Zero to Azure CLI in Seconds Using Docker

I wanted to look into deploying a microservices based app to a Docker instance in Azure this morning. I found a guide that I wanted to walk though. In the getting started section of the guide, it directed me to install the Azure CLI 2.0.

The CLI is python based and requires a python development setup, which I don't have on my windows based development system. I am not sure I want to go this route so installing a bunch of development tools for a platform I am not using on the bare metal of my machine is not an option.

Several friends and I have all been exploring the use of Docker in our everyday development lives. So I already have Docker for Windows installed and working great.

Microsoft supplied a pre-configured Docker container with the Azure CLI installed. So, I thought I would give that option a try. It gets me up and running with the CLI and on to my task in a ridiculously short amount of time. Seriously, here is a single screen tutorial.

single screen tutorial

docker images
docker pull azuresdk/azure-cli-python:latest
docker run -it --name=azurecli azuresdk/azure-cli-python:latest
az --version

First, I list all of the images I currently have. And I only a couple related to .NET Core development on Linux. Next, I pull the latest Docker image for the Azure CLI. Then I run the image interactively (also give it a friendly name to make it easier to run again later). This drops me into a bash shell and I am ready to go. I display the version info for the Azure CLI and exit, which drops me back to PowerShell shutting down the container.

I can fire up the CLI any time I want with a simple docker start -i azurecli.

Mind Blown

"Bull sculpture along Highway 101 near Olympia, WA." By Robert Ashworth is licensed under CC BY 2.0

Follow me on Mastodon!