Azure CLI Features & Examples

Glitch
3 min readFeb 18, 2023

--

Azure Command-Line Interface (Azure CLI) is a command-line tool provided by Microsoft to manage Azure services. It allows users to access and manage resources on Azure without the need to use the Azure portal. With Azure CLI, users can manage Azure resources from any platform, including Windows, macOS, and Linux.

In this blog, we will take a closer look at Azure CLI, its features, and how to get started with using it.

Features of Azure CLI

Azure CLI provides the following features:

Cross-platform support: Azure CLI is available on multiple platforms, including Windows, macOS, and Linux.

Cloud shell integration: Azure CLI is integrated with Azure Cloud Shell, a browser-based shell environment that provides access to the CLI tools, Azure services, and a file editor.

Interactive mode: Azure CLI has an interactive mode that allows users to explore and run commands without having to type them in manually.

Command grouping: Azure CLI groups related commands under a single namespace to make it easier to find and use them.

Output formats: Azure CLI supports multiple output formats, including JSON, YAML, and table formats.

Getting started with Azure CLI
To get started with Azure CLI, you need to follow these steps:

Install Azure CLI: You can install Azure CLI on Windows, macOS, and Linux. You can download the appropriate version of Azure CLI from the Azure website.

Sign in to Azure: After installing Azure CLI, you need to sign in to your Azure account using the following command:
az login

This command will open a web page where you can enter your Azure account credentials.

Select your subscription: If you have access to multiple Azure subscriptions, you need to select the subscription you want to use with the following command:

az account set --subscription <subscription-id>

Use Azure CLI: Once you have signed in and selected your subscription, you can start using Azure CLI to manage your Azure resources.
Examples of Azure CLI commands
Here are a few examples of Azure CLI commands to give you an idea of what you can do with it:

Create a virtual machine:
az vm create --resource-group <resource-group-name> --name <vm-name> --image <image-name> --admin-username <username> --admin-password <password>

Create a storage account:

az storage account create --name <storage-account-name> --resource-group <resource-group-name> --location <location>

List all virtual machines in a resource group:

az vm list --resource-group <resource-group-name> --query "[].name"

Show details of a virtual machine:

az vm show --resource-group <resource-group-name> --name <vm-name>

Conclusion
Azure CLI is a powerful tool that allows you to manage Azure resources from the command line. With its cross-platform support, interactive mode, and command grouping, Azure CLI makes it easy to work with Azure services. If you are familiar with the command line, you will find Azure CLI easy to use and a powerful addition to your toolkit.

--

--

No responses yet