Azure Fundamental – Azure CLI -Command Line Interface (Part-9)

Posted by

Azure CLI

Azure Command-Line Interface (CLI) is a set of commands used to create and manage Azure resources. It is designed for those who prefer to manage Azure resources through a command-line interface rather than through the Azure Portal.

Key Features:

  1. Cross-Platform: Available on Windows, macOS, and Linux.
  2. Scriptable: Can be used in scripts to automate Azure resource management.
  3. Interactive: Supports an interactive mode that helps users discover and execute commands.
  4. Resource Management: Allows for the creation, deletion, updating, and querying of Azure resources.

Benefits of Using Azure CLI

  1. Efficiency: Quick and efficient management of Azure resources.
  2. Automation: Enables automation of routine tasks, reducing manual effort.
  3. Consistency: Provides a consistent interface for managing resources across different platforms.
  4. Integration: Easily integrates with CI/CD pipelines and other automation tools.
  5. Accessibility: Accessible from any command-line interface, providing flexibility and convenience.

Install Azure CLI

Installation Overview


Install on Windows


Install on Linux


Install on Mac


Some Examples:

To Login

az login
az login tenant_id

To Check AZ version

az version

Create VM using Azure CLI

Start with creating a Resource Group

az group create --name learn-azure-cli --location eastus

Set the Resource Group as default (Optional)

az config set defaults.group=learn-azure-cli

Create VM with Vnet

# Create PowerShell variable
$vmName = "TutorialVM1"

az vm create `
    --resource-group $resourceGroup `
    --name $vmName `
    --image Ubuntu2204 `
    --vnet-name $vnetName `
    --subnet $subnetName `
    --generate-ssh-keys `
    --output json `

Delete the Resource Group to delete all the resources

az group delete --name learn-azure-cli
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x