bozx
bozx

Reputation: 53

Query Azure Storage Account Used Capacity - PowerShell Script?

I was wondering is there a reliable PowerShell script that gets Used Capacity for a storage account in Azure? Current script we are using is inconsistent- sometimes it returns results and sometimes it is blank values.

The script here works fine, just sometimes returns blank values for some accounts, or all.

Script:
#CAPACITY
$SAID = $storageAccount.Id
$usedCapacity = (Get-AzMetric -ResourceId $SAID -MetricName "UsedCapacity").Data
$usedCapacityInMB = $usedCapacity.Average/1024/1024

Many thanks everyone for your help!

Upvotes: 1

Views: 1293

Answers (1)

kobulloc
kobulloc

Reputation: 259

Your script is correct (and you can find examples of other Stack Overflow users using it as well), but unfortunately, this is a known issue. Although it doesn't help from a scripting standpoint, it should be noted that this doesn't seem to affect the portal.

Reference:

Upvotes: 1

Related Questions