简体   繁体   English

查询 Azure 存储帐户已用容量 - PowerShell 脚本?

[英]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?我想知道是否有一个可靠的 PowerShell 脚本可以获取 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!非常感谢大家的帮助!

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 .您的脚本是正确的(您也可以找到其他 Stack Overflow 用户使用它的示例),但不幸的是,这是一个已知问题 Although it doesn't help from a scripting standpoint, it should be noted that this doesn't seem to affect the portal.尽管从脚本的角度来看它没有帮助,但应该注意的是这似乎并不影响门户。

Reference:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM