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)