Wednesday Tidbit: Administering your Microsoft Azure account in Docker

20151204 - 1The other day I was working with a developer friend (I know right… who knew developers had friends?) when we discussed moving his test app into my Azure Cloud. As this was a whistle-stop tour I didn’t have my MacBook with me…

Thankfully his workstation ran Docker, which was just enough of what I needed.

Inside your Linux host, run Docker using:

docker run -d -it microsoft/azure-cli

Attach to the container by specifying the ID (substitute accordingly):

docker attach dcfd1a824d70

Once inside the container, login to Azure using:

azure login

This will ask you to browse to https://aka.ms/devicelogin and enter a code. Once you have done that the CLI will authenticate you and grant you access. Pretty cool huh?

Alternatively you can login with a simple username and password using the following (substitute accordingly):

azure login -u tony@stark.onmicrosoft.com

It will then prompt you for a password.

As with with Azure PowerShell module, you can use a publish settings file with the CLI. To do this, once logged in use:

azure account download

This opens your default browser and prompts you to sign in to the Azure classic portal. After you sign in, a .publishsettings file downloads. Make note of where this file is saved. You can import the file using:

azure account import publishsettings file

Make sure to delete the file after it has been imported.

Once connected to Azure, you can view your subscription using:

azure account list

Or

azure account show

Once authenticated I then went on to create a resource group with ARM and migrate my friend’s workload. More on this to follow!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.