Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Get Azure VM Disk Caching Settings Using PowerShell



To get the azure disk caching settings using PowerShell, we first need to retrieve the VM information using the Get-AzVM command. Before running this command, make sure that you are connected to the Azure account (Connect-AzAccount) and the proper subscription (Set-AzContext).

In this example, we have a TestVM.

$vm = Get-AzVM -Name TestVM

We will use the StorageProfile property and OSdisk sub-property to get the encryption settings.

PS C:\> $vm.StorageProfile.OsDisk.Caching

Output

To retrieve the caching settings on all the Azure VMs from the specific subscription, we can use the below command.

Get-AzVM | Select Name, ResourceGroupName,
@{N='Caching';E={$_.StorageProfile.OSDisk.Caching}}
Updated on: 2021-08-31T10:05:55+05:30

635 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements