要使用 CLI 检索 Azure VM 的操作系统缓存设置,我们可以使用以下命令。
PS C:\> az vm show -n VMName -g VMRG --query storageProfile.osDisk.caching -otsv输出结果
ReadWrite
您还可以使用以下命令在不使用资源组名称的情况下获取 Azure VM 上的缓存设置。
PS C:\> az vm list --query "[?name=='vmname'].storageProfile.osDisk.caching" -otsv
如果您需要检索所有 VM 的设置,则
PS C:\> az vm list --query "[].{VMName:name, ResourceGroup:resourceGroup, caching:storageProfile.osDisk.caching}" -otable