[英]Query Azure Storage Account metrics from Azure Powershell
New to Azure and Powershell. Azure和Powershell的新功能。 I used the following script to connect to my Azure subscription and storage account.
我使用以下脚本连接到我的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
I wish to query the storage account now to: 我想立即查询存储帐户:
Is this possible from Azure Powershell? 这可能来自Azure Powershell吗?
Thank you. 谢谢。
Get number of containers 获取容器数量
(Get-AzureStorageContainer).Count
Get number of blobs in container 获取容器中的blob数量
(Get-AzureStorageBlob -Container "ContainerName").Count
Not sure if you want file sizes for each individual file or an aggregate size. 不确定您是希望每个文件的文件大小还是聚合大小。
Individual file sizes can be shown with Get-AzureStorageBlob -Container "ContainerName"
which list a Length
attribute for each blob. 可以使用
Get-AzureStorageBlob -Container "ContainerName"
显示单个文件大小,其中列出了每个blob的Length
属性。 Length
is the blob size in bytes. Length
是以字节为单位的blob大小。
Total file size can be retrieved by doing this 这样做可以检索文件总大小
Get-AzureStorageBlob -Container "ContainerName" | %{ $_.Length } | measure -Sum
To get files that were last modified in a specific date range just do 要获取在特定日期范围内上次修改的文件,请执行此操作
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.