簡體   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