如何通过REST API获取Azure Blob/File/Table/Queue的诊断设置列表
获取存储账户子服务(Blob/File等)诊断设置的正确REST API路径
要获取存储账户下Blob、File等特定子服务的诊断设置,需使用针对子服务资源的完整规范ID构造请求URL,而非简单追加/blob这类友好名称。正确的URL格式如下:
https://management.azure.com/subscriptions/<SUBSCRIPTIONID>/resourceGroups/<RESOURCEGROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGEACCOUNTNAME>/<SERVICETYPE>/providers/Microsoft.Insights/diagnosticSettings?api-version=2021-05-01-preview
其中<SERVICETYPE>需替换为对应子服务的标准资源标识符:
- Blob服务:
blobServices/default - File服务:
fileServices/default - Queue服务:
queueServices/default - Table服务:
tableServices/default
举个Blob服务的具体请求示例:
https://management.azure.com/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mystorageaccount/blobServices/default/providers/Microsoft.Insights/diagnosticSettings?api-version=2021-05-01-preview
补充说明
Azure门户中显示的Blob是简化的友好名称,但Azure资源管理器API要求使用符合规范的资源路径格式(即[ServiceType]Services/default),这是存储账户子服务在ARM体系中的标准命名规则。
内容的提问来源于stack exchange,提问作者Nick Schroeder
相关产品推荐
相关产品推荐

