[Avg. reading time: 7 minutes]
Demo
- Subscription
- Create a new Resource Group
- EntraID
- Create a VM
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/quick-create-portal
Azure CLI
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli
Azure Login
az login
Azure Group
az group list --output table
# Create a new Resource Group
az group create --name resgroup_via_cli --location eastus2
# delete the Resource Group
az group delete --name resgroup_via_cli
# Delete the Resource Group without Prompt
az group delete --name resgroup_via_cli -y
Azure VM
# List all VMs.
az vm list
# Azure List Sizes
az vm list-sizes --location eastus
az vm list-sizes --location eastus --output table
az vm list-sizes --location eastus --query "[].{AccountName:name, Cores:numberOfCores}" --output table
az vm list-sizes --location eastus | jq -r 'sort_by([.numberOfCores,.maxDataDiskCount]) | .[] | "\(.name) \(.numberOfCores) \(.memoryInMB)MB \(.osDiskSizeInMB)MB \(.resourceDiskSizeInMB)MB \(.maxDataDiskCount)"'
az vm create --resource-group resgroup_via_cli --name myubuntu --image Ubuntu2204 --generate-ssh-keys
az vm show --resource-group resgroup_via_cli --name myubuntu --query "{username:osProfile.adminUsername}" --output tsv
az vm list-ip-addresses --resource-group resgroup_via_cli --name myubuntu
az vm show --resource-group resgroup_via_cli --name myubuntu --query "hardwareProfile.vmSize" --output tsv
# Start a VM:
az vm start --resource-group resgroup_via_cli --name myubuntu
# Stop a VM:
az vm stop --resource-group resgroup_via_cli --name myubuntu
# Deallocate a VM
az vm deallocate --resource-group resgroup_via_cli --name myubuntu
az vm resize -g resgroup_via_cli -n myubuntu --size Standard_DS3_v2
# Resize all VMs in a resource group.
az vm resize --size Standard_DS3_v2 --ids $(az vm list -g resgroup_via_cli --query "[].id" -o
tsv)
# Delete a VM
az vm delete --resource-group resgroup_via_cli --name myubuntu
Azure Storage
az storage account list -g gc-resourcegroup --output table
az storage account list --resource-group gc-resourcegroup --query "[].{AccountName:name, Location:location}" --output table
az storage account show-connection-string --name gcstorage007 -g gc-resourcegroup
# Create a storage account:
az storage account create --name newstorage --resource-group MyResourceGroup --location eastus --sku Standard_LRS
````<span id='footer-class'>Ver 5.5.3</span>
<footer id="last-change">Last change: 2025-10-15</footer>````