Management Group Diagnostic Settings - Create Or Update

为指定资源创建或更新管理组诊断设置。

PUT https://management.azure.com/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}?api-version=2020-01-01-preview

URI 参数

名称 必需 类型 说明
managementGroupId
path True

string

管理组 ID。

name
path True

string

诊断设置的名称。

api-version
query True

string

minLength: 1

用于此作的 API 版本。

请求正文

名称 类型 说明
___location

string

资源的位置

properties.eventHubAuthorizationRuleId

string

事件中心授权规则的资源 ID。

properties.eventHubName

string

事件中心的名称。 如果未指定任何事件,则会选择默认事件中心。

properties.logs

ManagementGroupLogSettings[]

日志设置的列表。

properties.serviceBusRuleId

string

诊断设置的服务总线规则 ID。 这是为了保持向后兼容性。

properties.storageAccountId

string

要向其发送诊断日志的存储帐户的资源 ID。

properties.workspaceId

string

要向其发送诊断日志的 Log Analytics 工作区的完整 ARM 资源 ID。 示例:/subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

响应

名称 类型 说明
200 OK

ManagementGroupDiagnosticSettingsResource

成功请求创建管理组诊断设置

Other Status Codes

ErrorResponse

描述操作失败的原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

Creates or Updates the management group diagnostic setting

示例请求

PUT https://management.azure.com/providers/microsoft.management/managementGroups/testChildMG7/providers/microsoft.insights/diagnosticSettings/setting1?api-version=2020-01-01-preview

{
  "properties": {
    "storageAccountId": "/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5",
    "workspaceId": "/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace",
    "eventHubAuthorizationRuleId": "/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
    "eventHubName": "myeventhub",
    "logs": [
      {
        "category": "Administrative",
        "enabled": true
      },
      {
        "category": "Policy",
        "enabled": true
      }
    ]
  }
}

示例响应

{
  "id": "providers/Microsoft.Management/managementGroups/testChildMG7/providers/microsoft.insights/diagnosticSettings/setting1",
  "type": "Microsoft.Insights/diagnosticSettings",
  "name": "setting1",
  "___location": "global",
  "properties": {
    "storageAccountId": "/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5",
    "workspaceId": "/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace",
    "eventHubAuthorizationRuleId": "/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
    "logs": [
      {
        "category": "Administrative",
        "enabled": true
      },
      {
        "category": "Policy",
        "enabled": true
      }
    ]
  }
}

定义

名称 说明
ErrorResponse

描述错误响应的格式。

ManagementGroupDiagnosticSettingsResource

管理组诊断设置资源。

ManagementGroupLogSettings

管理组诊断设置的一部分。 指定特定日志的设置。

ErrorResponse

描述错误响应的格式。

名称 类型 说明
code

string

错误代码

message

string

指示操作失败的原因的错误消息。

ManagementGroupDiagnosticSettingsResource

管理组诊断设置资源。

名称 类型 说明
id

string

Azure 资源 ID

___location

string

资源的位置

name

string

Azure 资源名称

properties.eventHubAuthorizationRuleId

string

事件中心授权规则的资源 ID。

properties.eventHubName

string

事件中心的名称。 如果未指定任何事件,则会选择默认事件中心。

properties.logs

ManagementGroupLogSettings[]

日志设置的列表。

properties.serviceBusRuleId

string

诊断设置的服务总线规则 ID。 这是为了保持向后兼容性。

properties.storageAccountId

string

要向其发送诊断日志的存储帐户的资源 ID。

properties.workspaceId

string

要向其发送诊断日志的 Log Analytics 工作区的完整 ARM 资源 ID。 示例:/subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

type

string

Azure 资源类型

ManagementGroupLogSettings

管理组诊断设置的一部分。 指定特定日志的设置。

名称 类型 说明
category

string

将此设置应用到的资源类型的管理组诊断日志类别的名称。

enabled

boolean

一个值,该值指示是否启用此日志。