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

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

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

Install on Windows

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli

Install on Linux

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

Install on Mac

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos

Some Examples:

To Login

az login
or 
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 `
    --verbose

Delete the Resource Group to delete all the resources

az group delete --name learn-azure-cli

Related Posts

Secure supply chain: SBOM, SLSA, signing, provenance (plain English)

If you ship software today, you don’t just ship your code. You ship: That whole chain is your software supply chain. And attackers love it, because instead…

Read More

CI/CD for Cloud Apps: Build → Scan → Deploy → Rollback (a practical reference pipeline)

CI/CD sounds simple until you’re responsible for a production system and realize: This guide gives you a reference CI/CD pipeline you can adopt for most cloud apps…

Read More

Policy as Code: OPA/Rego basics + how it prevents bad infra

You know that feeling when an incident starts with a sentence like: Most “bad infra” isn’t malicious. It’s normal engineering drift:new hires, rushed PRs, copy-paste manifests, unclear…

Read More

Reusable IaC Module Design: naming, inputs/outputs, versioning (the engineer’s playbook)

Reusable IaC modules are like internal libraries: if the “API” is clean, teams move fast. If it’s messy, everyone forks it, patches it, and you end up…

Read More

GitOps explained: Argo CD vs Flux, patterns, and anti-patterns

GitOps is one of those ideas that sounds like buzzwords… until you run it for 30 days and suddenly you can’t imagine operating Kubernetes without it. Because…

Read More

Terraform vs CloudFormation vs Pulumi: which fits which team (the practical, engineer-first guide)

You’re not really choosing a tool. You’re choosing how your team will think about infrastructure for the next 2–5 years: This guide helps you decide fast, without…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x