Share via


Azure: How to Detect Virtual Hard Disk Sizes Using Powershell

You can utilize the Azure PowerShell module to show the size of your Azure blob storage for any files in Azure storage. The example below assumes you have already used Set-AzureSubscription -CurrentStorageAccountName to set a storage account context, and we are also assuming your .vhd files reside in a storage container named "vhds".

 

Get-AzureStorageBlob -Container "vhds" | %{If ($_.BlobType -eq "PageBlob"){$_.Name;($_.Length)/1GB}}

 

This is essentially saying: Get my Azure storage blob from my current storage account, and target the "vhds" container where my .vhd files live. For each file in that container, if the blob type is a Page Blob, I want to know more about it (those will be your .vhd files). The information I want to show for each Page Blob type file is its Name and Length property. I have also added some PowerShell syntax in there "/1GB" which is a nice way to show you the Length property in GBs, which is likely the unit you are after.

Download the Azure Powershell module here: http://go.microsoft.com/?linkid=9811175