Check Azure VM data disk details through PowerShell

The existing cmdlets for Azure Compute will retrieve the MAX size of the data disk, but not the ACTUAL used size. I had raised a case with Microsoft and learned that this feature is not available yet. This is why we use monitoring solutions like OMS, datadog etc, that deploy their agents inside the Virtual Machine to pull detailed information like the one you asked.


This information is not available outside the VM; the hypervisor just doesn't have any way to know how many space the VM is actually using of the allocated disk size. This is BTW true for any hypervisor, be it Hyper-V (on which Azure is based), VMware or anything else.

In order to know how much space is actually used or free, you need to look inside the VM; you can use monitoring agents (such as those included in Azure), or even run a script which calls the PowerShell cmdlet Get-Volume.

There are several ways to run scripts inside an Azure VM, of which the easiest is probably Invoke-AzVMRunCommand in Azure PowerShell.