Skip to content

Instantly share code, notes, and snippets.

@mrtarkhan
Created February 16, 2023 21:36
Show Gist options
  • Save mrtarkhan/42acde8506c0362930051076b6e8e980 to your computer and use it in GitHub Desktop.
Save mrtarkhan/42acde8506c0362930051076b6e8e980 to your computer and use it in GitHub Desktop.
All list command that is helpful when you are using azur cli
-- List supported regions for the current subscription
z account list-locations -o table
az account list-locations --query [].name -o tsv
-- Gets all resource providers for a subscription
az provider list -o table
az provider list --query [].namespace -o tsv
-- List the VM image publishers available in the Azure Marketplace.
az vm image list-publishers --location '{a_region_name_ex_centralus}' -o table
az vm image list-publishers --location '{a_region_name_ex_centralus}' --query [].name -o tsv
-- List the VM image offers available in the Azure Marketplace
az vm image list-offers --location 'centralus' --publisher 'MicrosoftWindowsServer' -o table
az vm image list-offers --location 'centralus' --publisher 'MicrosoftWindowsServer' --query [].name -o tsv
-- List the VM image SKUs available in the Azure Marketplace (use -p instead of --publisher & -l for location)
az vm image list-skus --location 'centralus' --publisher 'MicrosoftWindowsServer' --offer 'WindowsServer' -o table
az vm image list-skus --location 'centralus' --publisher 'MicrosoftWindowsServer' --offer 'WindowsServer' --query [].name -o tsv
-- List the VM/VMSS images available in the Azure Marketplace (use -p instead of --publisher & -l for location & -f for offer)
az vm image list --all --location 'centralus' --publisher 'MicrosoftWindowsServer' --offer 'WindowsServer' --sku '2016-Datacenter' -o jsonc
-- List all sizes available within a region
az vm list-sizes -l 'westus' --output table
-- another sample with query
az vm list-sizes -l 'centralus' --query "[?numberOfCores==\`8\` && memoryInMb==\`65536\` && resourceDiskSizeInMb==\`131072\`]" -o table
... i will add more on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment