xPlat Azure CLI: the cross-platform Microsoft Cloud CLI tool

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.
azure cli - xplat

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.
One of the benefits of the Azure xPlat CLI Tool is that it can emit JavaScript Object Notation (JSON) output from nearly any command you issue to it. Because the Unix command shell is text-based, instead of object-based, using JSON output can help to pass objects down the command pipeline. For example, there is a command line tool called jsawk that makes working with JSON objects possible. When calling web services, including the Azure Resource Manager REST API, JSON is a commonly used format to exchange objects.

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 at https://portal.azure.com. To authenticate, simply call “azure login –username username@domain.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 Virtual Machines course.

Written by

Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and a Curriculum Director for Cloud Academy. Trevor is passionate about technology, community, and social media, and enjoys sharing information with the world at large, through a variety of mediums. As a public speaker, Trevor also enjoys delivering webcasts, presenting live at conferences, and both live and virtually at user groups across the world.

Related Posts

— November 21, 2018

Google Cloud Certification: Preparation and Prerequisites

Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2018, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the first time. In t...

Read more
  • AWS
  • Azure
  • Google Cloud
— October 30, 2018

Azure Stack Use Cases and Applications

This is the second of a two-part series covering Azure Stack. Our first post provided an introduction to Azure Stack. Why would your organization consider using Azure Stack? What are the key differences between Azure Stack and Microsoft Azure? In this post, we'll begin to answer bot...

Read more
  • Azure
  • Hybrid Cloud
  • Virtualization
— October 3, 2018

Highlights from Microsoft Ignite 2018

Microsoft Ignite 2018 was a big success. Over 26,000 people attended Microsoft’s flagship conference for IT professionals in sunny Orlando, Florida. As usual, Microsoft made a huge number of announcements, ranging from minor to major in importance. To save you the trouble of sifting thr...

Read more
  • Azure
  • Ignite
— September 20, 2018

Planning for Microsoft Ignite 2018 Sessions: What Not to Miss

Cloud Academy is proud to be a sponsor of the Microsoft Ignite Conference to be held September 24 - 28 in Orlando, Florida. This is Microsoft’s biggest event of the year and is a great way to stay up to date on how to get the most from Microsoft’s products. In this post, I’ll help you p...

Read more
  • Azure
— September 18, 2018

How to Optimize Cloud Costs with Spot Instances: New on Cloud Academy

One of the main promises of cloud computing is access to nearly endless capacity. However, it doesn’t come cheap. With the introduction of Spot Instances for Amazon Web Services’ Elastic Compute Cloud (AWS EC2) in 2009, spot instances have been a way for major cloud providers to sell sp...

Read more
  • AWS
  • Azure
  • Google Cloud
— August 23, 2018

What are the Benefits of Machine Learning in the Cloud?

A Comparison of Machine Learning Services on AWS, Azure, and Google CloudArtificial intelligence and machine learning are steadily making their way into enterprise applications in areas such as customer support, fraud detection, and business intelligence. There is every reason to beli...

Read more
  • AWS
  • Azure
  • Google Cloud
  • Machine Learning
— July 5, 2018

How Does Azure Encrypt Data?

In on-premises environments, data security is typically a siloed activity, with a company's security team telling the internal technology groups (server administration, database, networking, and so on) what needs to be protected against intrusion.This approach is absolutely a bad...

Read more
  • Azure
— June 26, 2018

Disadvantages of Cloud Computing

If you want to deliver digital services of any kind, you’ll need to compute resources including CPU, memory, storage, and network connectivity. Which resources you choose for your delivery, cloud-based or local, is up to you. But you’ll definitely want to do your homework first.Cloud ...

Read more
  • AWS
  • Azure
  • Cloud Computing
  • Google Cloud
Albert Qian
— June 19, 2018

Preparing for the Microsoft Azure 70-535 Exam

The credibility of Microsoft Azure continues to grow in the first quarter of 2018 with an increasing number of enterprises migrating their workloads, resulting in a jump for Azure from 10% to 13% in market share. Most organizations will find that simply “lifting and shifting” applicatio...

Read more
  • Azure
  • Compute
  • Database
  • Security
— April 12, 2018

Azure Migration Strategy: A Checklist to Get Started

By now, you’ve heard it many times and from many sources: cloud technology is the future of IT. If your organization isn’t already running critical workloads on a cloud platform (and, if your career isn’t cloud-focused), you’re running the very real risk of being overtaken by nimbler co...

Read more
  • Azure
— March 2, 2018

Three Must-Use Azure Security Services

Keeping your cloud environment safe continues to be the top priority for the enterprise, followed by spending, according to RightScale’s 2018 State of the Cloud report.The safety of your cloud environment—and the data and applications that your business runs on—depends on how well you...

Read more
  • Azure
  • Security
— February 15, 2018

Is Multi-Cloud a Solution for High Availability?

With the average cost of downtime estimated at $8,850 per minute, businesses can’t afford to risk system failure. Full access to services and data anytime, anywhere is one of the main benefits of cloud computing.By design, many of the core services with the public cloud and its underl...

Read more
  • AWS
  • Azure
  • Cloud Adoption
  • Google Cloud