Azure Tips and Tricks Part 34 - Working with the Azure CLI using a Mac

1 minute read


Most folks aren’t aware of how powerful the Azure platform really is. As I’ve been presenting topics on Azure, I’ve had many people say, “How did you do that?” So I’ll be documenting my tips and tricks for Azure in these posts.

The Complete List of Azure Tips and Tricks

Available Now!

Working with the Azure CLI using a Mac

The Azure CLI 2.0 provides a command-line experience for managing Azure resources. You can use it with Azure Cloud Shell which sits inside your web browser, or you can install it on macOS, Linux, and Windows. In this post, we’ll install it on a Mac.

My preferred way to work with the Azure CLI 2.0 on a Mac is to have Homebrew installed. Basically, homebrew is a package manager for Mac that makes it easy to install application.

Once it is installed, you’ll want to run these two commands:

brew update
brew install azure-cli

The first command just updates the homebrew database and the next command installs the Azure CLI 2.0 as shown below.

Wow, that was pretty easy! You can type az -h to get help documentation or go to to read the docs.

Log in to Azure

You’ll want to use the az login command to log in to your Azure account. You’ll see the following message:

To sign in, use a web browser to open the page and enter the code XXX to authenticate.

Open a web browser and navigate to and enter your code. You’ll be prompted to enter the code to authenticate.

Switch back to the terminal app and you’ll see something similar to the following if you logged in successfully:

    "cloudName": "AzureCloud",
    "id": "xxx",
    "isDefault": true,
    "name": "Visual Studio Enterprise",
    "state": "Enabled",
    "tenantId": "xxx",
    "user": {
      "name": "",
      "type": "user"

Keep in mind that you can always get back to this screen with az account list. You can now try to create a Ubuntu VM using only the CLI. Here is a great doc to get started.

Make sure to read the complete CLI docs to learn more.

Want more Azure Tips and Tricks?

If you’d like to learn more Azure Tips and Tricks, then follow me on twitter or stay tuned to this blog! I’d also love to hear your tips and tricks for working in Azure, just leave a comment below.

Leave a Comment