Following up on the generally available release of VM, ACS, Storage and Network commands in the new Azure CLI 2.0, we are today announcing a new Azure CLI interactive Shell preview mode release, in addition to the generally available release of following command modules: ACR, Batch, KeyVault, and SQL.
Interactive Shell
Azure CLI 2.0 provides an idiomatic command line interface that integrates natively with Bash and POSIX tools. It is easy to install, use and learn. You can use it to run one command at a time, as well as to run automation scripts composed of multiple commands, including other BASH commands. To support this, commands are not interactive and will error out when provided with incomplete or incorrect input.
However, there are circumstances when you might prefer an interactive experience, such as when learning the Azure CLI’s capabilities, command structures and output formats. Azure CLI Shell (az-shell) provides an interactive mode in which to run Azure CLI 2.0 commands. It provides autocomplete dropdowns, auto-cached suggestions combined with on the fly documentation, including examples of how each command is used. Azure CLI Shell provides an experience that makes it easier to learn and use Azure CLI commands.
We invite you to install and use the new interactive shell for Azure CLI 2.0. You can use it in a Docker image we created, or install it locally on your Mac or Windows machine. It works with your existing Azure CLI installations, and you can use the commands side-by-side in az-shell or another command shell of your choice (BASH on MAC/linux and cmd.exe on Windows).
New commands now generally available
Continuing with the momentum of our GA release of the first Azure CLI 2.0 command modules on Feb 27th, today we are also announcing that following command modules are now Generally Available: Azure Container Registry, Batch, KeyVault, and SQL. With this GA release, you can use these commands in production with full support from Microsoft through our Azure support channels or on GitHub. We don’t expect any breaking changes for these commands in future releases of Azure CLI 2.0.
Azure Container Registry enables developers to create and maintain Azure container registries to store and manage private Docker container images. Using the acr commands in Azure CLI 2.0, you can create and manage these registries right from the command line. After you create a registry, you can use other CLI commands to assign a service principal to it, manage admin credentials, and list the repositories within it.
Azure Batch service provides an environment developers can use to manage their compute resources, and to schedule jobs to run with specific resources and dependencies. Using the batch commands in Azure CLI 2.0, you can create Azure Batch accounts, applications, and application packages in that account. You can also create jobs, tasks and job schedules to run at specific times, and manage (create, update, delete) them directly from the command line.
Azure Key Vault helps safeguard cryptographic keys and secrets used by cloud applications and services. Developers and security administrators can generate keys, store and access them, set policies, and monitor their usage using this service. Using the keyvault commands in Azure CLI 2.0, you can create/delete a key vault, manage certificates, policies, import and create new keys, and set secrets to key vaults.
Azure SQL Database is a relational database-as-a-service using the Microsoft SQL Server engine. Using the SQL commands in Azure CLI 2.0, you can manage all aspects of this service from the command line: create/delete/update SQL server, create/delete/update databases and data warehouses and scale them individually by creating elastic pools and moving databases in and out of shared pools, etc.
In addition to the above commands being generally available, the new release also contains command modules for dev/test labs (lab) and monitoring (monitor) services that are now available in preview mode.
New features in Azure CLI 2.0
This release also contains some new features that will make working with the Azure CLI easier and more productive.
“Az find” is a new command for searching Azure CLI 2.0 commands based on simple text. As the number of commands and coverage of Azure services grows in Azure CLI 2.0, we recognize that it may become hard for developers to find the commands they need for specific tasks.
For example, the following command finds all Azure CLI 2.0 commands that contains the text “arm,” “template,” or “deploy.”
az find -q arm template deploy `az monitor autoscale-settings get-parameters-template` Scaffold fully formed autoscale-settings' parameters as json template `az group export` Captures a resource group as a template. `az group` Manage resource groups and template deployments. `az group deployment export` Export the template used for the specified deployment. `az group deployment create` Start a deployment. `az group deployment validate` Validate whether the specified template is syntactically correct and will be accepted by Azure Resource Manager. `az vm capture` Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. For an end-to-end tutorial, see https://docs.microsoft.com/azure /virtual-machines/virtual-machines-linux-capture-image. `az keyvault certificate get-default-policy` Get a default policy for a self-signed certificate This default policy can be used in conjunction with `az keyvault create` to create a self-signed certificate. The default policy can also be used as a starting point to create derivative policies. Also see: https://docs.microsoft.com/en- us/rest/api/keyvault/certificates-and-policies `az keyvault certificate create` Creates a new certificate version. If this is the first version, the certificate resource is created. Create a Key Vault certificate. Certificates can also be used as a secrets in provisioned virtual machines. `az vm format-secret` Format secrets to be used in `az vm create --secrets` Transform secrets into a form consumed by VMs and VMSS create via --secrets.
You can now set global defaults and scope for specific variables and resources that you need to use repeatedly within a command line session. You can set these defaults using the “az configure” command:
az configure --defaults group=MyResourceGroup
This sets the resource group to “MyResourceGroup” so that you don’t need to supply it as a parameter in subsequent commands that require this parameter. For example, you could then run the “vm show” command without explicitly specifying the resource group parameter:
az vm show -n MyLinuxVM Name ResourceGroup Location --------- --------------- ---------- MyLinuxVM MyResourceGroup westus2
You can also specify multiple defaults by listing them in <resource name=value> pairs in the “az configure” command, and you can reset them by simply setting an empty value in the configure command.
Start using Azure CLI 2.0 today!
Whether you are an existing CLI user, or you are starting a new Azure project, it’s easy to get started with the CLI directly, or use the interactive mode to master the command line with our updated docs and samples.
Azure CLI 2.0 is open source and on GitHub.
In the next few months, we’ll provide more updates. As ever, we want your ongoing feedback! Customers using the commands, that are now in GA release, in production can contact Azure Support for any issues, reach out via StackOverflow using the azure-cli tag, or email us directly at azfeedback@microsoft.com. You can also use the "az feedback" command directly from within the CLI to send us your feedback.