Azure Storage Explorer
An Azure tool that is used to manage cloud storage resources on Windows, macOS, and Linux.
266 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
how to get storage accounts capacity usage for 1400 storage accounts
You can use scripting:
# Define your subscription ID
$subscriptionId = "YourSubscriptionId"
# Get all storage accounts in the subscription
$storageAccounts = Get-AzStorageAccount -SubscriptionId $subscriptionId
# Loop through each storage account
foreach ($storageAccount in $storageAccounts) {
# Get storage account name
$storageAccountName = $storageAccount.StorageAccountName
# Get storage account key (assuming you have the necessary permissions)
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccount.ResourceGroupName -Name $storageAccountName).Value[0]
# Create a storage context
$context = New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
# Get storage account properties
$properties = Get-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName -Name $storageAccountName
# Extract relevant information (adjust as needed)
$capacity = $properties.PrimaryEndpoints.Blob + "?comp=properties"
$capacityInfo = Invoke-RestMethod -Uri $capacity -Method GET -Headers @{"x-ms-version"="2020-08-04"} -UseBasicParsing
# Output storage account and capacity information
Write-Host "Storage Account: $($storageAccount.StorageAccountName)"
Write-Host "Capacity Usage: $($capacityInfo.totalCapacity)"
Write-Host "---------------------------"
}
hth Marcin