Skip navigation

Check actual size of data in Azure storage account or container

Q. How can I check the actual size of my Azure Storage account?

A. Regular Azure Storage uses sparse storage which means you only actually pay for the amount of data written and not the size of, for example, the VHDs stored in containers. If I have a 127 GB fixed VHD but it only has 16 GB of data written to it I only pay for 16 GB of actual data cost.

A great script is available at https://gallery.technet.microsoft.com/Get-Billable-Size-of-32175802 and once downloaded I did need to make one small change to make it work. At the start of the Get-BlobBytes function for the second parameter change its cast to:

[Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel.AzureStorageBlob]$Blob)

Therefore the start of the function is:

function Get-BlobBytes
{
  param (
  [Parameter(Mandatory=$true)]
  [Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel.AzureStorageBlob]$Blob)

Once you have made this change its easy to use the script and it outputs the actual real size of used data and therefore the amount of data you would get billed for.

.\CalculateBlobCost.ps1 -storageaccountname "savtechstorenortheurope" 

[Container World  delivers real-world case studies from the cloud-native ecosystem, hands-on technical education, the best speakers and cutting-edge startups under one roof. Get your ticket.]

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish