Working with Azure CLI

I've enjoyed working with Linux and OS X over the last years; particularly because of the various and highly robust CLI available. Just about everything in the world of web development and JavaScript comes equipped with a CLI. It just feels more natural to do things programmatically. The GA announcement of Azure CLI 2.0's prime resource commands like vm and storage earlier this year was a good day.

PowerShell, as powerful as it is, won't sway the hardcore among the Linux and OS X communities. Azure has gone hand-in-hand with PowerShell for a long time, but now everyone at the table has equal opportunity to interface with Azure on the host of their choice - through Azure CLI 20.

Setting up Azure CLI 2.0

Azure CLI 2.0 can be setup on Windows, Mac OS X, or Linux. Today I am using my trusty Mac OS X, but you can set up Azure CLI on Windows/Linux following the documentation here. I'm at a pretty hipster cafe, and didn't wanna dress up too much with my Surface Book Pro. Installation of Azure CLI 2.0 was ... simple. Too simple.

curl -L | bash
# Then we restart the shell.
exec -l $SHELL

Azure CLI is now at your control using az in your terminal. Azure CLI also includes an interactive mode which is super cool (it has tab-completion). You can launch into Azure CLI interactive mode with az interactive. It does take a little getting used to, but it quickly pays off:

Azure CLI Interactive Mode Image

Cloud Shell

Of course, we can't forget the Azure CLI Cloud Shell. Cloud Shell is just what it sounds like - Azure CLI hosted on the Azure. Cloud Shell integrates with your Azure subscription and Azure Storage account to provide a Bash terminal that behaves exactly like you would expect it to. I was at first a little apprehensive; wondering just how effective it would be. Alas, my concerns were not realized. The very same commands worked on Cloud Shell. Pro-tip: Tab-completion also works on Cloud Shell. :)

Azure Cloud Shell Image

You can launch Cloud Shell from directly within your Azure Portal. See below for sweet .gif courtesy of Microsoft Docs.


Azure CLI 2.0 Overview

Timothy Tavarez

Consultant @ Microsoft. Previously of the US Air Force and startup varieties.

Subscribe to Azure.js

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!