Check space used in azure storage accounts in my subscription

前端 未结 6 537
面向向阳花
面向向阳花 2021-01-17 07:36

How can I check how much space I used in each of my azure storage accounts in my subscription resource group wise.

I am not able to find a way to check space used in

6条回答
  •  有刺的猬
    2021-01-17 08:30

    To get this in Powershell, it is kind of a pain, but might be useful for other folks (such as cleaning out old backups): Here's what I came up with, and it should work with AzureRM module 6.13.0 at least:

    $azstorcontext = New-AzureStorageContext -StorageAccountName storageaccounthere -StorageAccountKey storageaccountkeyhere
    $sizesOverall = @()
    $containers = Get-AzureStorageContainer -Context $azstorcontext
    foreach ($container in $containers)
    {
        Write-Output $container.Name
        $contblobs = get-azurestorageblob -container $container.name -Context $azstorcontext
        Write-Output "  Blobs: $($contblobs.count)"
        $containersize = ($contblobs | Measure-Object -Sum Length).Sum
        Write-Output "    Container Size: $containersize) (bytes)"
        $sizesOverall    
    }
    

提交回复
热议问题