image
Getting Started with Azure Cross-Platform CLI Automation
About the Azure Cross-Platform (xPlat) CLI Tool
Difficulty
Advanced
Duration
59m
Students
548
Ratings
5/5
Description

During this course, we will take a look at the Microsoft Azure Cross-Platform (xPlat) CLI Tool. The Azure xPlat CLI is a Node.js application that enables you to automate many common tasks within Microsoft Azure. Microsoft is developing the Azure xPlat CLI as an open source project, which is hosted on GitHub. If you run into any problems, have questions about how the tool works, or need clarification in the documentation, you can register for GitHub, and post a new issue on the issue tracker, for the Azure xPlat CLI project. The Azure xPlat CLI tool works with both the newer Azure Resource Manager (ARM) and the classic Azure Service Management (ASM) REST APIs.

Some of the common tasks that you might perform with the Azure xPlat CLI are: deploying Azure Resource Manager (ARM) JSON Templates into ARM Resource Groups, deleting Resource Groups, starting or stopping Azure IaaS Virtual Machines, deploying or deleting Virtual Machines, resizing Virtual Machines on-demand, managing Virtual Networks, Subnets, Network Security Groups (NSG), VPN Gateways, custom Route Tables, and much more!

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.

Transcript

Hi. My name is Trevor Sullivan, a Microsoft MVP for Windows PowerShell. Today I'm here to talk to you about the Azure cross-platform CLI tool that allows you to automate tasks around Microsoft Azure from your Linux, Windows, or Mac OSX system.

Let's start by taking a look at an introduction to how the tool works. In this section, we're going to cover applicable scenarios, GitHub projects page, the application's architecture, and the basic functions of the tool.

When you want to automate tasks against Microsoft Azure, such as provisioning cloud resources, or managing existing resources, or administering functions of your subscription, you'll want to use a variety of different platforms, such as Linux, Mac OSX, and the Windows platform.

We need a solution that allows us to automate these tasks from across any of these platforms. The Azure cross-platform CLI tool is a project that's hosted by Microsoft on GitHub. It's an open source development project, and it allows us to manage Azure resources from the command line. So on the GitHub project page, we can track the tool's development, we can report new issues that we encounter, such as documentation bugs or functional gaps, or functional bugs, and we can also contribute bug or documentation fixes, because we can issue pull requests against the official GitHub repository.

Let's take a look at the application's architecture. As we mentioned before, Mac OSX, Linux, and Windows are all supported platforms by this tool. The Node.js application framework can be installed on any of these three platforms. And then finally, the Microsoft Azure cross-platform CLI tool sits on top of that and allows us to perform automation tasks through the Node.js application framework.

There's two different modes of operation for the cross-platform CLI tool. The first mode is the Azure resource manager mode, and what this allows us to do is perform operational tasks against the Microsoft Azure Resource Manager API. Now, this isn't a focal topic of this course. However, we will be talking about how to perform automation tasks against both the Azure Resource Manager rest API, in addition to the Azure Service Management API. The Microsoft Azure platform provides two different rest APIs, and Microsoft is in the process of migrating all of the functionality from the service management API, which is an XML imperative provisioning rest API, over to the Azure Resource Manager API, which is both an imperative and a declarative management API for our cloud resources.

Let's take a look at the basic structure of the Azure cross-platform CLI tool. Once the tool's been installed, which we'll look at later, the Azure tool can be called simply by calling Azure at the command line. There's a couple of different groupings of child commands, and the Azure command is basically broken out into a tree of commands.

So first we have kind of a category of administrative tasks, and those could be things like looking at our Azure subscriptions or accounts, looking at subscription cloud consumption, Active Directory tasks, roles in Active Directory, managing resource groups, managing Azure resource providers, configuration, which is basically the ASM or ARM mode, and then individual features of each Azure resource provider.

On the resource side, we have the actual management of cloud resource instances, such as virtual networks, virtual machines, application insights, web apps, API apps, and much more.

One of the great features of the Azure cross-platform CLI tool is the ability to provide JSON output. Because the Unix shell is not object-oriented like PowerShell is, we can actually take the output from the Azure command, convert it to JSON, and then pass it into a command that's able to read those JSON objects and parse them, and then sort them, and we can manage our data more effectively that way. Most of the Azure cross-platform CLI tools commands enable this capability by simply appending the --json parameter.

About the Author

Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and enjoys working with cloud and automation technologies. As a strong, vocal veteran of the Microsoft-centric IT field since 2004, Trevor has developed open source projects, provided significant amounts of product feedback, authored a large variety of training resources, and presented at IT functions including worldwide user groups and conferences.