Top 10 Azure CLI Commands You Must Know

The Azure Command-Line Interface (Azure CLI) is more than just a tool; it is the fundamental bridge between your local machine and the global power of Microsoft’s cloud. In this guide, I will walk you through the top 10 Azure CLI commands that every professional must master.

Top 10 Azure CLI Commands You Must Know

1. az login – The Gateway to the Cloud

The az login command is your entry point.

  • Why it’s essential: In the USA market, security is paramount. This command leverages Microsoft Entra ID (formerly Azure AD) to authenticate your device.
  • The Pro Tip: For those working in a hybrid environment or managing multiple tenants, use az login --tenant <TenantID> to ensure you are hitting the correct directory from the start.

Check out Az login –identity

2. az account set – Managing Subscription Context

In the enterprise landscape, it is rare to manage just one subscription. You likely have separate environments for Development, Staging, and Production.

  • The Command: az account set --subscription "Production-Internal-App"
  • The Workflow: I always recommend running az account list --output table first to see your active subscriptions. Once identified, use set to pin your CLI to the specific project you are auditing. This prevents accidental deployments to the wrong environment.

Check out az account set subscription

3. az group create

Everything in Azure lives inside a Resource Group. If you are building a new microservice for a logistics firm, this is your first structural step.

  • Key Parameters: You must specify a --name and a --location.
  • Authority Insight: For US users, choosing the right region is critical for latency and compliance. I typically recommend eastus (Virginia) or westus2 (Washington) for the most robust service availability.
    • Example: az group create --name ProjectPhoenix-RG --location eastus

Check out: Az group create

4. az vm create

Deploying a Virtual Machine via the portal involves a dozen screens and a hundred clicks. With the CLI, a single command handles the OS, networking, and storage.

  • Why it’s powerful: You can specify the image (Ubuntu, WindowsServer, etc.) and the size (Standard_DS2_v2) in seconds.
  • Table: Common VM Sizes for US Projects
SizeUse CaseTarget Market
B-SeriesSmall dev serversStartups in Portland
D-SeriesGeneral purpose productionEnterprise apps in Dallas
F-SeriesCompute intensive (Batch processing)Financial modeling in NYC

Check out Az VM create

5. az resource list

As a consultant, the first thing I do when taking over a messy environment for a firm is run a resource inventory.

  • The Command: az resource list --output table
  • Advanced Filtering: To find a specific type of resource across your entire American infrastructure, use:az resource list --resource-type "Microsoft.Storage/storageAccounts" --output table
  • Insight: This command is vital for identifying “orphan” resources that are driving up your monthly bill without providing value.

Check out: az resource list

6. az storage account create

Managing storage accounts via CLI allows for rapid, repeatable deployments.

  • Critical Settings: When running this, always consider the --sku. For mission-critical data in the USA, Standard_GRS (Geo-Redundant Storage) ensures your data is backed up in a secondary region (like moving data from East US to West US) in case of a regional disaster.
  • The Command: az storage account create --name storageprodx01 --resource-group MyRG --location eastus --sku Standard_LRS

Check out Create a storage account in Azure

7. az network vnet create

In the age of Zero Trust, your networking must be airtight. Whether you’re setting up a VPN for a remote team or a private link, the CLI gives you granular control.

  • Pro Strategy: Don’t just create a VNet; define your subnets and address prefixes immediately.
  • Command Scope: az network vnet create --name USA-Corp-VNet --resource-group MyRG --address-prefix 10.0.0.0/16 --subnet-name FrontEnd --subnet-prefix 10.0.1.0/24

8. az webapp up

  • Functionality: This command creates a service plan, creates the web app, and zips up your local code to deploy it—all in one go.
  • Authority Note: While great for rapid prototyping, I always advise my teams to transition to formal CI/CD pipelines (Azure DevOps or GitHub Actions) once the project moves toward a formal release in the market.

9. az lock create

In high-pressure environments, accidental deletions occur. I’ve seen production databases vanish because of a misclick. az lock Is your policy.

  • The Two Types:
    1. CanNotDelete: Users can read and modify, but not delete.
    2. ReadOnly: Users can only read (perfect for frozen legacy systems).
  • Command: az lock create --name ProtectProdLock --lock-type CanNotDelete --resource-group Production-RG

10. az group delete

  • The Power: This command deletes the group and every single resource inside it.
  • The Safety Flag: Always use the --no-wait flag if you want your terminal back immediately, but use --yes with extreme caution.
  • Final Command: az group delete --name Temporary-Lab-RG --yes --no-wait

Check out: Az group delete

Troubleshooting Common CLI Errors

Here is how to handle the “Big Three” errors:

  • “Subscription Not Found”: Run az account list and ensure your subscription is enabled and that you have “Contributor” access.
  • “Resource Provider Not Registered”: Some new services require manual registration. Run az provider register --namespace Microsoft.Batch (or whichever service is failing).
  • “az: command not found”: This is usually a PATH issue on your local Windows or macOS machine. Ensure you’ve restarted your terminal after installation.

Conclusion

The Azure CLI is the definitive tool for the modern cloud professional. By mastering these 10 commands—from the initial az login to the final az group delete—You transition from a casual user to a Cloud Architect with real authority.

You may also like the following articles:

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!