lost
lost

Reputation: 2391

show size of existing vm size in azure cli

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

Answers (2)

Arno Vlielander
Arno Vlielander

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

enter image description here

Which you can then access by using the query posted by Joy Wang.

Upvotes: 1

Joy Wang
Joy Wang

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

enter image description here

Upvotes: 1

Related Questions