DEV Community

Cover image for Getting Started with Azure CLI: Manage Your Cloud Like a Pro from CMD and VS Code
Habeeb Hameed
Habeeb Hameed

Posted on • Edited on

Getting Started with Azure CLI: Manage Your Cloud Like a Pro from CMD and VS Code

πŸš€ Getting Started with Azure CLI on Windows (via CMD and VS Code)

Whether you're just exploring Azure or managing cloud infrastructure at scale, Azure CLI gives you powerful control from your terminal. In this guide, we’ll walk through installing Azure CLI on Windows, logging in, managing resource groups, VMs, storage accounts, and executing Bash scripts in VS Code.

πŸ“₯ 1. Install Azure CLI on Windows

πŸ‘‰ Install Azure CLI on Windows

az --version
Enter fullscreen mode Exit fullscreen mode

Azure CLI installation

πŸ” 2. Login to Azure

az login
az login --tenant <your-tenant-id>
Enter fullscreen mode Exit fullscreen mode

Login using tenant ID

βœ… 3. Subscription Selection

az account set --subscription "<your-subscription-name>"
Enter fullscreen mode Exit fullscreen mode

Login success confirmation

πŸ“‚ 4. List Resource Groups

az group list --output table
Enter fullscreen mode Exit fullscreen mode

Group list
Group list table

az group list --output yaml
Enter fullscreen mode Exit fullscreen mode

Group list yaml

πŸ“ 5. Create a Resource Group

az group create --name azurecli-rg --location westus
Enter fullscreen mode Exit fullscreen mode

Create group

az group list --output table
Enter fullscreen mode Exit fullscreen mode

Updated group list (https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tf5pq9c7qaxhyrr7kn5.jpg)

πŸ’» 6. View Virtual Machines

az vm list --output table
Enter fullscreen mode Exit fullscreen mode

VM list

πŸ’Ύ 7. List Storage Accounts

az storage account list
Enter fullscreen mode Exit fullscreen mode

Storage list

🧠 8. Use Bash for Variables

VS Code makes it easy to define variables for more advanced scripts.

Variables in Bash

πŸ§ͺ 9. Create a VM and Network

Run all setup commands together using defined variables.

Run commands at once (https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpkzx18lluqlx19w0ncg.JPG)

🧹 10. Delete Resources

az vm delete --resource-group azurecli-rg --name TutorialVNet1 --yes
az group delete -n azurecli-rg
Enter fullscreen mode Exit fullscreen mode

Delete resources

🧡 Wrapping Up

You’ve now seen how to:

  • Install and run Azure CLI from CMD
  • Authenticate and manage subscriptions
  • Create/list/delete Azure resource groups and VMs
  • Use Bash in VS Code for efficient scripting

πŸ’¬ Got feedback or tips? Drop a comment below!

Top comments (0)