azure - 如何从 REST API 检索 Azure blob/文件/表/队列诊断设置列表

标签 azure

在大多数情况下,列出诊断设置的文档非常简单:

https://learn.microsoft.com/en-us/rest/api/monitor/diagnostic-settings/get?tabs=HTTP

使用以下语法执行 GET 将为我提供存储帐户级别的顶级诊断设置列表:

https://management.azure.com/subscriptions/<SUBSCRIPTIONID>/resourceGroups/<RESOURCEGROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGEACCOUNTNAME>/providers/Microsoft.Insights/diagnosticSettings?api-version=2021-05-01-preview

但是,它仅返回顶级设置。如果我设置了 blob、文件等...特定的诊断配置文件,我不确定如何从 API 检索它们的列表。我尝试过附加例如/blob 添加到资源 ID,因为这是它在门户下拉列表中的显示方式:

picture of Azure portal

但这没有用。我在任何地方都找不到这样的例子。

有人知道获取这些设置的正确 REST URL 吗?谢谢。

最佳答案

How to retrieve Azure blob/file/table/queue diagnosticSettings list from REST API

如果您需要获取特定服务(例如 blob)的诊断设置,您可以使用以下请求

请求:

GET https://management.azure.com/subscriptions/<subscriptionid>/resourceGroups/<your-resource group>/providers/Microsoft.Storage/storageAccounts/<storageaccount name>/blobServices/default/providers/Microsoft.Insights/diagnosticSettings?api-version=2021-05-01-preview

在我的存储帐户(诊断设置)中,我的 blob 有两个诊断:

enter image description here

输出:

enter image description here

enter image description here

您可以获得 file的类似(二元论设置) , queue , table 通过门户获取资源 ID:

enter image description here

关于azure - 如何从 REST API 检索 Azure blob/文件/表/队列诊断设置列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77195638/

相关文章:

azure - Microsoft Azure IoT 中心是否存储数据?

azure - 为什么 mywebsite.dll.config 没有包含在我的 cspkg 中?

c# - 使用 WinSCP Session.GetFile 从 SFTP 进行流式传输失败 – ((WinSCP.PipeStream)stream).Length' 引发类型 'System.NotSupportedException' 的异常

azure - DocumentDB 客户端 1.14 终止正在运行的进程

powershell - AzureKeyVaultSecret 备份/导入 powershell 命令在哪里?

azure - Azure 中的直线是什么?

azure - 列出集群中所有资源组

azure - Hadoop 与 MSSQL 报告的可能性

Azure vs WCF vs ASP.NET vs ...它们如何组合在一起?

csv - Azure 机器学习 Web 服务无法从 blob 读取 CSV