Managing Microsoft Azure from A Docker Container

In this blog post, I’ll show you how I manage my Microsoft Azure subscription from a Docker Container running Azure CLI command line.

Azure CLI

First released 3 years ago, Azure CLI Is a command line tool for Azure Resources management, The tool can be Install on Linux, MAC, Windows Systems and In the browser using Azure Cloud Shell.

Using Azure CLI on Docker, Is perfect because of there no need to Install the tool on a management computer or Server and keep It up to date.

The Azure CLI Container Image Is Linux based and you can Install it on a Windows 10 machine In Linux Mode.

Download Image

The first step In this process Is to download the Azure CLI Image using the line below:

docker pull microsoft/azure-cli

docker run -it microsoft/azure-cli

To start Azure CLI from the running Container, all I need to do Is type

azure

Now as you can Azure CLI started and I’ll log in to the Azure Service

Login To Azure

Azure CLI requires authentication token In order to log in to the service, To get the token I type the cmdlet below.

azure login

Next, I’ll go the URL https://aka.ms/devicelogin and I’ll copy the token code

When I open the browser, I’ll be asked to type the code from the Azure CLI shell

Once the code verified access will be granted

to view all available command I can type azure

To view my VMs for example, I’ll type the command below:

azure vm list

Conclusion

Managing Azure using the Azure CLI Container Is simple, secure and portable, There Is no need to Install the tool or use the browser Is much slower.

Leave a Reply

Your email address will not be published. Required fields are marked *