Reputation: 2391
How can you find the size of an existing VM using the Azure CLI? I can see how to find what sizes are available, or what sizes a VM can be resized to, but not simply what the existing size is. You'd think that might be one of the details in az vm show --show-details
but it's not.
Upvotes: 0
Views: 1720
Reputation: 11
Just as additional info, when using
az vm show -g <resourcegroupname> -n <vmname>
you can see which info is available to access.
For the VMSize you would notice in the responsetree: JSONResponse
Which you can then access by using the query posted by Joy Wang.
Upvotes: 1
Reputation: 42143
In the screenshot in my comment, I use the command.
az vm show -g '<resource group name>' -n '<VM name>' -d
You could use --query 'hardwareProfile.vmSize'
to get the vmSize
directly.
az vm show -g '<resource group name>' -n '<VM name>' --query 'hardwareProfile.vmSize' -o tsv
Upvotes: 1