LoginSignup
0
0

More than 5 years have passed since last update.

Azure のストレージ毎の合計サイズを取得する

Last updated at Posted at 2015-02-03

Azure の StorageAccount 毎のサイズを計算する PowerShell スクリプトを作った。

Function Get-AzureStorageSize {
    [CmdletBinding()]
    Param ()
    Process {
        Get-AzureStorageAccount | Get-AzureStorageKey | Foreach-Object {
            $context = New-AzureStorageContext -StorageAccountName $_.StorageAccountName `
                                               -StorageAccountKey $_.Primary

            $total = Get-AzureStorageContainer -Context $context |
                         Get-AzureStorageBlob |
                         Measure-Object -Sum -Property Length

            [PSCustomObject] @{
                StorageAccountName = $_.StorageAccountName
                Length = $total.Sum
            }
        }
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0