Automating Windows Azure with Windows Azure CLI
Recently, Microsoft Windows Azure team has announced the release of azure-cli 0.6.10 which can be used for automating Windows Azure in an easy and elegant manner. The azure-cli is a Node.js based cross platform command line tool for Windows Azure, which can be used for managing and deploying Windows Azure Websites, Windows Azure Storage, Mobile Services, Virtual Machines, Service Bus from command prompt on Windows, Mac and Linux.
Installing Windows Azure CLI
You can install Windows Azure CLI by either using a MSI installer for Windows or using a Node.js NPM module azure-cli. The Windows installer can download from here
The Azure CLI is a Node.js based command line tool, so the Windows installer for Azure CLI will automatically install Node.js and other required components.
Azure CLI is delivering as a Node.js NPM module so that we can install the Azure CLI using Node.js. The following command will install Azure CLI by using Node.js Package Manager.
In the above command, we install NPM module azure-cli
Using Windows Azure CLI
After installing Azure CLI, just type azure and enter in the command prompt that will show the following output which including all available commands
The information provided below is a few sample commands for automating Windows Azure with Azure CLI
Managing Windows Azure Accounts
The Azure CLI command “azure account download” will download a publishsettings file from Windows Azure portal. You have to login to the Windows Azure portal in order to download the publishsettings file.
The Azure CLI command “azure account import [publishsettings file] imports Windows Azure credentials so that you can easily manage Windows Azure Websites, Mobile Services, Virtual Machines, Service Bus by using the CLI commands.
Managing Windows Azure Storage
The Azure CLI command “azure account storage list” list out the all storage account
The Azure CLI command “azure account storage create [name] --location ["location"]” creates a storage account in the specified location.
The Azure CLI command “azure account storage delete [name]” removes the specified storage account
Managing Windows Azure Websites
The Azure CLI command “azure site list” list out the websites created in the Windows Azure account.
The Azure CLI command “azure site create [name]” creates a Website in the specified data center region. The below command creates a Website in West US region.
The Azure CLI command “azure site show [name]” shows the all details about the specified Azure Website
The Azure CLI command “azure site delete [name]” removes the specified Windows Azure Website
More Information on Azure CLI
For more details on the commands and reference on Azure CLI, check out the following links:
- Windows Azure command-line tool for Mac and Linux
- How to use the Windows Azure Command-Line Tools
- azure-cli 0.6.9 ships, pure joy
- Simple bash scripting for “azure” cli
- Teach your Azure Website new deployment tricks with azure-cli 1 of XXX: Running Mocha Tests
Summary
The Azure CLI is a great command line tool which lets Windows Azure developers to automate Windows Azure by using your favorite command line tools regardless of operating systems. By using Windows Azure CLI, we can manage and deploy Windows Azure Websites, Windows Azure Storage, Mobile Services, Virtual Machines, Service Bus from command prompt on Windows, Mac and Linux.