Retrieve OS Caching Setting of Azure VM Using Azure CLI in PowerShell



To retrieve the OS Caching setting of the Azure VM using CLI, we can use the below command.

PS C:\> az vm show -n VMName -g VMRG --query storageProfile.osDisk.caching -otsv

Output

ReadWrite

You can also get the caching setting on the Azure VM without using the resource group name using the command below.

PS C:\> az vm list --query "[?name=='vmname'].storageProfile.osDisk.caching" -otsv

If you need to retrieve the setting for all VMs then,

PS C:\> az vm list --query "[].{VMName:name, ResourceGroup:resourceGroup,
caching:storageProfile.osDisk.caching}" -otable
Updated on: 2021-09-02T11:02:24+05:30

173 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements