List all databases with sizes
To list all databases along with their size in bytes on a particular server.
$resource_group="rg-demo"
$server="mssql-demo-dev"
$databases=$(az sql db list --resource-group $resource_group --server $server --query "[].{name:name}" -o tsv)
foreach ($db in $databases) {
$size=az sql db show --resource-group $resource_group --server $server --name $db --query "maxSizeBytes" -o tsv
if ($db -ne "master") {
echo "$db, $size"
}
}