The xPlat Azure CLI allows users to manage their Azure cloud resources from non-Windows devices.
This is the first of a series of articles on xPlat: the Microsoft Azure CLI tool. Did you know that the Microsoft Azure platform can be managed from non-Windows devices? It’s true. The most powerful automation capabilities are offered through the Windows-only Microsoft Azure PowerShell module, however there is a cross-platform (xPlat) CLI tool, that enables you to perform management tasks from Mac OS X or Linux systems. The Azure xPlat CLI tool runs on top of the Node.js application framework, which is what enables it to run cross-platform.
xPlat Azure CLI: what can it do
Let’s explore some of the capabilities that this tool offers.
- Authenticate to Microsoft Azure via Azure Active Directory (AAD) or Microsoft Account
- List and select an Azure subscription to operate on
- Retrieve account billing / consumption details
- Create and manage Microsoft Azure Storage Accounts, Blob Containers, Blobs, and permissions
- Deploy Microsoft Azure Resource Manager (ARM) JSON Templates
- Create and manage Microsoft Azure App Service Web Jobs
- Create and manage Microsoft Azure App Service Web Apps
- Create and manage IaaSv1 & IaaSv2 Windows and Linux Virtual Machines, VM Endpoints
- Create and manage Docker container hosts
- And much more!
The Azure xPlat CLI tool interfaces with both the older Azure Service Management (ASM) REST API and the newer Azure Resource Manager (ARM) REST API. You can deploy ARM JSON templates with the xPlat CLI Tool, which enable you to rapidly provision Cloud Resources into a Resource Group.
xPlat Azure CLI: installation and authentication
Installing the Azure xPlat CLI is fairly straightforward. First, you need to install the Node.js application framework. This framework includes a package manager called NPM (Node Package Manager). Next, you need to call npm install -g azure-cli. That’s it! Once you’ve got the Azure CLI Node.js package installed, you will be able to call it directly from the command line. The command name is simply “azure.”
Now that you have installed the Azure xPlat CLI Tool, you will need to authenticate against Azure, using either Azure Active Directory (AAD) or your Microsoft Account (MSA). This account would be the same one that you use to access the Microsoft Azure Portal. To authenticate, simply call “azure login –username email@example.com”. You’ll be prompted for your password, so go ahead and enter that.
Once you’re authenticated to Azure, you’ll want to make sure that your future command calls are operating on the correct subscription (aka. Azure account). Your user account could have access to more than one Azure subscription, so first you’ll need to “select” the appropriate subscription context. To select a subscription, use the command “azure account set <MySubscriptionName>”. If you don’t know the name of your subscription, you can easily discover them by using the “azure account list” command.
Great, now you’ve installed the Azure CLI, logged into Azure, and gotten the basics down for subscription management! In the next article, we’ll take a look at provisioning resources into your subscription using the Azure CLI using xPlat.
In the meantime, perhaps you’d like to take Cloud Academy’s Getting started with Azure Cross-Platform CLI Tool course or the Getting Started with Azure Virtual Machines course.