如何查询Azure存储账户读写操作与数据检索指标用于定价
获取Azure存储账户关键指标的最佳方式
方法1:Azure门户(直观易用,适合快速获取)
- 登录Azure门户,定位到目标存储账户
- 进入「监视」>「指标」页面
- 选择对应存储类型的指标命名空间(如Blob Storage、File Storage)
- 直接筛选并添加所需指标:
Write Operations→ 选择「写入操作」指标Read operations→ 选择「读取操作」指标Iterative read/write operations→ 选择「列表操作」(迭代类操作如列出Blob/容器均归类于此)Data Retrieval→ 选择「数据检索」(对应读取的数据量)Data write→ 选择「数据写入」(对应写入的数据量)
- 调整时间范围(推荐过去30天),点击「导出」将数据保存为CSV,直接用于Azure计算器。
方法2:Azure Monitor日志(适合细粒度历史数据分析)
- 进入存储账户的「监视」>「日志」面板
- 使用Kusto查询语言编写自定义查询,聚合所需指标:
StorageBlobLogs | where OperationName has_any ("Write", "Read", "List") | summarize WriteOperations = countif(OperationName has "Write"), ReadOperations = countif(OperationName has "Read"), IterativeReadOperations = countif(OperationName has "List" and OperationName has "Read"), IterativeWriteOperations = countif(OperationName has "List" and OperationName has "Write"), DataRetrieval = sum(ResponseContentLength), DataWrite = sum(RequestContentLength) | project WriteOperations, ReadOperations, IterativeReadOperations, IterativeWriteOperations, DataRetrieval, DataWrite - 执行查询后,导出结果为CSV或JSON格式。
方法3:Azure CLI/PowerShell(适合自动化批量获取)
Azure CLI示例:
az monitor metrics list --resource-group <你的资源组名称> --resource <存储账户名称> --resource-type Microsoft.Storage/storageAccounts --metrics "WriteOperations" "ReadOperations" "ListOperations" "DataIngress" "DataEgress" --interval PT1H --start-time 2024-01-01T00:00:00Z --end-time 2024-01-31T00:00:00Z
注:
DataIngress对应Data write,DataEgress对应Data Retrieval;ListOperations对应迭代类读写操作。
PowerShell示例:
$storageAccountId = "/subscriptions/<订阅ID>/resourceGroups/<资源组>/providers/Microsoft.Storage/storageAccounts/<存储账户名>" Get-AzMetric -ResourceId $storageAccountId -MetricName "WriteOperations","ReadOperations","ListOperations","DataIngress","DataEgress" -StartTime (Get-Date).AddDays(-30) -EndTime (Get-Date) -TimeGrain 01:00:00
注意事项
- 不同存储类型(Blob、File、Table、Queue)的指标命名可能略有差异,需选择对应存储类型的指标命名空间。
- 建议采用过去30天的平均数据作为Azure计算器的输入,确保定价估算更贴合实际使用情况。
内容的提问来源于stack exchange,提问作者itye1970
相关产品推荐
相关产品推荐

