Intro to Azure CLI

Posted by

Azure CLI is available across multiple platforms like Windows, MAC, and Linux.  You can also run Azure CLI directly from Azure Cloud Shell.  Azure CLI requires a shell in order to execute commands.   For example, you can use either command prompt or PowerShell in Windows if you download/install the Windows version of Azure CLI. 

Regardless of the shell you use or platform you use, the commands you run are the same.  For Example, a Cloud Engineer may write a useful script with Azure CLI running on Windows and share it on github to make it available globally.  A user running a Mac can then download and run the azure CLI script.  This makes it great for sharing your commands you compile into a script with the global community regardless of platform.   I should state you will have some formatting differences between different shells you’ll need to get used to.   For Example,  to write a command in PowerShell that extends multiple lines, use ` at the end of the line.  For Bash, you’ll use the \. 


For Example

Creating a nic in PowerShell

Creating a routing group in Bash

A separate installation of Azure CLI is available for your desired platform. 


For Example:

Azure CLI for Windows – PowerShell or Command Prompt
Azure CLI for Linux – Bash or Shell
Azure CLI for MAC   


In a more advanced scenario, I could  run Azure CLI for Linux on a single Windows 10 install.  To do something like this I would:

  1. Install Azure MSI package for Windows
  2. Azure CLI for Linux
    • setup Windows Subsystem for Linux (WSL)
    • install Ubuntu for Windows
    • run Ubuntu and run the install

Note:  To install Azure CLI on Ubunto run the following:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

After installing azure CLI for linux subsystem running on windows, you can then run AZ commands from Ubuntu.


For Example: Typing in az

Question:  Can I have side by side installs of Azure on the same machine?

Answer:  Yes, if you have it setup in the manner I described above, you can simply download and install the Windows package. 



Getting Started with Azure CLI

To get started with Azure CLI several resources are available.   My favorite is the Get started with Azure CLI which describes installation, sign in, common commands, and a tutorial.  It’s available here.  Some other excellent resources are below:

Overview of the Azure CLI

Working with Azure CLI using a Mac

Install Azure CLI (across various platforms)


Thank You,

Russ Maxwell
Premier Field Engineer @Microsoft