Latest Updates for the Cross platform Microsoft Azure CLI

The Azure Cross-Platform Command-Line Interface (xplat-cli) is an important tool which helps to ensure all Microsoft Azure users, regardless of their chosen operating system, can manage Azure resources in scripting environments. The project is a collaboration between Microsoft Open Technologies, Inc. and Microsoft Azure, and it provides users with much of the same functionality as the Azure Management Portal via the command line.

As an open source project, these tools are rapidly evolving in response to user needs. In some cases, developer contributions. In this post, I aim to provide an overview of the current major features, as well as to highlight some important ones that have been added in the most recent release (v0.8.10).

Key Updates in the Latest Release (v0.8.10)

Version 0.8.10 of the Azure CLI tools includes a number of bug fixes and improvements, along with a few additional MS Open Tech-developed features requested by users.

The most noteworthy of these features include:

Support for Virtual Machine Extensions

Virtual machine extensions provide mechanisms for managing critical functionality in your Virtual Machines. New extensions are being added all the time and so the number of possible features your VMs support in Azure continues to increase. Until this release it was necessary to use the Azure portal or PowerShell CLI to manage extensions. However, now you can use the new "azure vm extension" family of commands. You can "list" available extensions, retrieve details about specific extensions (use “list” along with the –n option to name a specific extensiton), "get" the list of extensions enabled on a given VM and enable/disable extensions on specific VMs using the “set” command.

As an example, to add the Docker extension to an existing Linux Virtual Machine you would run a command similar to this:

azure vm extension set rgdockerext2 DockerExtension MSOpenTech.Extensions 0.3

In this command, “rgdockerext2” is the VM name, “DockerExtension” is the name of the extension, “MSOpenTech.Extensions” is the name of the publisher and 0.3 is the version of the extension we want installed. Once your extension is enabled you will need to set appropriate endpoints using the “azure vm endpoint” command.

For more information execute the command "azure help vm extension".

Static IP Addresses for Virtual Machines

Using the "azure vm static-ip" commands you can now define and configure a specific internal IP address that can be statically assigned to a Virtual Machine deployed in a Virtual Network. This feature allows you to maintain a VMs IP address when starting/stopping the machine, in fact it will remain available even if the VM is deleted and then redeployed months later.

For more information on this family of commands execute "azure help vm static-ip". You can also use the new "--static-ip" option for "azure vm create" and "azure vm docker create".

Reserved IP Addresses for Cloud Services

When a cloud service is created it is randomly assigned a Virtual IP address (VIP). This VIP is a public IP address that can be used to access the cloud service. Virtual Machines within the cloud service can then be configured to receive inbound communication via the VIP by using a specified port number. Using reserved IP addresses it is possible to ensure that this VIP won't change unless you choose to disassociate it from your service.

The new "azure network reserved-ip" commands provide commands for working with reserved IPs, for more information execute the command "azure help network reserved-ip".

Overview of Major Features

The x-plat CLI tool is feature rich. Once installed, commands can be executed with "azure [options] [command]". The table below briefly summarizes the major commands available. Additional narrative explanation of each command is provided with appropriate links below.

The majority of these commands also have subcommands. For example, the “vm” command contains sub commands such as "azure vm list" and "azure vm create". Some of the primary sub-commands are listed in the table below. You may run the "azure help [command]" (e.g. “azure help vm”), to obtain more information about each of the commands, as well as a complete list of available subcommands.

I wish to manage Azure …

Command

Subscription information and publish settings account
Virtual machines vm
Virtual machine endpoints vm endpoint
Virtual machine images vm image
Data disks for virtual machines vm disk
Storage account storage
Cloud services service
SSL certificates for services service cert
Mobile Services mobile
Service Bus sb
SQL Server sql
SQL databases sql db

Further explanation of these primary Azure commands:

“azure account”

The CLI will reference your Azure subscription details to connect to your account. You may use "azure login" and provide your username and password. However, this can be problematic in the case that you have multiple subscriptions or want to use the CLI tools in automation scripts. The "azure account" command will allow you to configure the CLI tools using your Azure publish settings file. All subsequent CLI commands will then reference these settings automatically.

For more details, see our how to on configuring the CLI or execute "azure help account".

“azure vm”

Using the "azure vm …" family of commands you can create and manage virtual machines and Docker hosts on Microsoft Azure. You may list VMs in your subscription, create new ones, start and stop existing machines and more.

For more details, see our documentation on deploying images from VM Depot, the reference documentation for "azure vm", or execute "azure help vm".

“azure vm endpoint”

Once you have a VM up and running you may need to open endpoints/ports so that it can communicate with the outside world. The "azure vm endpoint …" commands improve your ability to manage these endpoints.

For more details, see the reference documentation for "azure vm endpoint" or execute "azure help vm endpoint".

“azure vm image”

Virtual machine images are captures of pre-configured virtual machines. To create virtual machines of a known state, you would use the "vm create" command. A large number of images are publicly available via repositories such as VM Depot, and can be readily discovered using these commands. You can also create and manage your own images with these commands.

For more details, see the instruction for deploying images from VM Depot, the reference documentation for "azure vm image" or execute "azure help vm image".

“azure vm disk”

Use this command to create and manage data disks in Azure blob storage. These disks can then be attached to virtual machines.

For more details, see the reference documentation for "azure vm disk" or execute "azure help vm disk".

“azure storage”

The "azure storage" group of commands help to configure, monitor and scale the storage services in which you store and access data, either as unstructured blobs, queues for messaging or structured data in tables.

For details specific to this family of CLI commands, see the reference documentation for "azure storage" or execute "azure help storage". For more information about Azure Storage, see the Azure Storage Account documentation.

“azure service”

This family of commands enables the creation of cloud services. Azure cloud services are applications that run on Microsoft Azure. They consist of the code and service configuration. Services enable the deployment of multi-tier web applications in a distributed, flexible and scalable way. Once Azure services have been created, other commands may reference these services through command line options.

For more information on cloud services, see the Azure document "What is a cloud service?" For details on this family of CLI commands, see the reference documentation for "azure service" or execute "azure help service".

“azure service cert”

In order to secure communications between users and Azure services, you must provide an SSL certificate. These certificates can be managed using the "azure service cert" family of commands.

For more information about Azure certificates, see the Azure document "Manage Certificates". For details on this family of CLI commands, see the reference documentation for "azure service cert" or execute "azure help service cert".

“azure site”

Azure web sites utilize the fully managed Platform-as-a-Service (PaaS) features of Azure that enable you to build, deploy and scale enterprise-grade web Apps. Using these CLI commands, it is possible to manage and configure web sites.

For more information on Azure web sites, see the Azure website tutorials and guides. For details about this family of CLI commands, see the reference documentation for "azure site" or execute "azure help site".

“azure mobile”

Azure mobile services allow you to add a back-end to your cross platform mobile applications quickly and easily. Using the "azure mobile" family of commands, you gain access to powerful features that enable you to manage and monitor your mobile services.

For more information on Azure mobile services, see the Azure Mobile Services site. For details on this family of CLI commands, see the reference documentation for "azure mobile" or execute "azure help mobile".

“azure sb”

The Azure Service Bus is a flexible messaging platform which sits between the various components of your app. The Service Bus enables these components to be loosely coupled and hosted in Azure or on-premise. The result is improved scalability and resiliency for your applications.

For more information on Azure Service Bus, see the Azure Service Bus documentation. For details on this family of CLI commands, see the reference documentation for "azure sb" or execute "azure help sb".

“azure sql”

Azure SQL Databases provide relational databases as a service, while the "azure sql" family of commands make it possible to manage the SQL servers and their firewalls, along with databases contained on those servers.

For more information, see the Azure SQL Database documentation. For details on this family of CLI commands, see the reference documentation for "azure sql" or execute "azure help sql".

“azure network”

Virtual networks make it possible to create logically isolated sections of Windows Azure which can then be securely connected to on premise clients and servers. A virtual network makes it easy for you to take advantage of Windows Azure’s scalable, on-demand infrastructure while providing connectivity to data and applications on-premises. The "azure network" group of CLI commands enable you to configure and manage virtual networks.

For more information see the Azure Virtual Networks documentation. For details on this family of CLI commands see the reference documentation for "azure network" or execute "azure help network".

“azure hdinsight” command

Using the Azure HD Insight service it is possible to leverage the power of Apache Hadoop to process, analyze and gain new insights from big data. The CLI provides a set of commands for managing HDInsight clusters.

For more information see the Azure HDInsight (Apache Hadoop) documentation. For details on this family of CLI execute "azure help network".

Accessing and Improving X-Plat Tools

The latest release of the CLI Toolkit for Microsoft Azure is available from the Node Package Manager. For installation and configuration guidance, see "Installing the Microsoft Azure Cross Platform CLI Tools".

These CLI tools are written in JavaScript and have been are implemented using the Azure SDK for Node.js. The latest version of the source code is available on GitHub under the Apache License v2.0. We welcome your feedback (and patches!) via the usual GitHub channels.