繁体   English   中英

从Azure Powershell查询Azure存储帐户指标

[英]Query Azure Storage Account metrics from Azure Powershell

Azure和Powershell的新功能。 我使用以下脚本连接到我的Azure订阅和存储帐户。

Import-Module "C:\Program Files (x86)\Microsoft SDKs\WindowsAzure\PowerShell\Azure\Azure.psd1"
Import-AzurePublishSettingsFile 'C:\AZURE_POWERSHELL\DETAILS.publishsettings'
Set-AzureSubscription -SubscriptionName subname -CurrentStorageAccount storagename
Select-AzureSubscription -SubscriptionName subname

我想立即查询存储帐户:

  • 计算Blob中的容器数量。
  • 计算这些容器的文档数量。
  • 返回所有文档的文件存储大小。
  • 返回具有指定日期范围的文档的文件存储大小。

这可能来自Azure Powershell吗?

谢谢。

获取容器数量

(Get-AzureStorageContainer).Count

获取容器中的blob数量

(Get-AzureStorageBlob -Container "ContainerName").Count

不确定您是希望每个文件的文件大小还是聚合大小。

可以使用Get-AzureStorageBlob -Container "ContainerName"显示单个文件大小,其中列出了每个blob的Length属性。 Length是以字节为单位的blob大小。

这样做可以检索文件总大小

Get-AzureStorageBlob -Container "ContainerName" | %{ $_.Length } | measure -Sum

要获取在特定日期范围内上次修改的文件,请执行此操作

Get-AzureStorageBlob -Container "ContainerName" | where { $_.LastModified -gt (Get-Date -Date "specific date") -and $_.LastModified -lt (Get-Date -Date "specific date") }

暂无
暂无

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

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