HowTo: Install Azure CLI on a Mac computer

This tutorial will show how to install Microsoft Azure CLI on a Mac computer.


Step #1: Download the installer


Open Safari

and navigate to this page:
https://azure.microsoft.com/en-gb/documentation/articles/xplat-cli-install/
From the section “Use an installer” click on “OS X Installer”, download will start.

Once finished, click on the “Show downloads” button (normally located at the right of Safari’s toolbar). The list of recent downloads will show.
To open the installer just double click the related item in the list.

The installer window will appear.
The installer can now be run by double clicking on the package icon.

Once the Installer window appears, just click on “Continue”:

again on “Continue”:

You need to agree to the License terms:

Then proceed with the installation:

You’re required to enter your OS X credentials before starting the process:

Once the process is done you can close the installer:

 

 


Step #2: First Run


 

You can now run Azure CLI.
To open the Terminal click on the Spotlight icon:

and type (excluding quotes) “terminal”, then hit Enter.

The terminal window will appear:

TIP

For a terminal old fashioned look and feel, change the theme to “Homebrew”

Go to terminal preferences using the menu or pressing [command ,] then select “Homebrew” as a startup profile and “Same profile” for new windows. You need to restart the terminal in order to see the new theme.


Step #3: Authentication


You now need to authenticate the CLI using your Azure credentials.
Go back to the terminal and type:

azure login

CLI will ask you to open the page https://aka.ms/devicelogin and enter the code shown.

You can copy and paste the link into Safari and enter the code in the related page:

Then click on the “Continue” button that appeared at the bottom:

You’ll be redirected to a login page:

Redirection might occur twice:

Once authenticated a confirmation page will be shown:

and the command will complete:

You’re now all set to use Azure CLI.

NOTE

If you have more than one subscription in your account the following commands might be useful

azure account list #will show the list of your subscriptions

azure account set subscription-id #will set the specified subscription as a default

Leave a Reply