Management Group Diagnostic Settings - Create Or Update

Creates or updates management group diagnostic settings for the specified resource.

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

URI Parameters

Name In Required Type Description
managementGroupId
path True

string

The management group id.

name
path True

string

The name of the diagnostic setting.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Type Description
location

string

Location of the resource

properties.eventHubAuthorizationRuleId

string

The resource Id for the event hub authorization rule.

properties.eventHubName

string

The name of the event hub. If none is specified, the default event hub will be selected.

properties.logs

ManagementGroupLogSettings[]

The list of logs settings.

properties.serviceBusRuleId

string

The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.

properties.storageAccountId

string

The resource ID of the storage account to which you would like to send Diagnostic Logs.

properties.workspaceId

string

The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

Responses

Name Type Description
200 OK

ManagementGroupDiagnosticSettingsResource

Successful request to create a management group diagnostic setting

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Creates or Updates the management group diagnostic setting

Sample request

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
      }
    ]
  }
}

Sample response

{
  "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
      }
    ]
  }
}

Definitions

Name Description
ErrorResponse

Describes the format of Error response.

ManagementGroupDiagnosticSettingsResource

The management group diagnostic setting resource.

ManagementGroupLogSettings

Part of Management Group diagnostic setting. Specifies the settings for a particular log.

ErrorResponse

Describes the format of Error response.

Name Type Description
code

string

Error code

message

string

Error message indicating why the operation failed.

ManagementGroupDiagnosticSettingsResource

The management group diagnostic setting resource.

Name Type Description
id

string

Azure resource Id

location

string

Location of the resource

name

string

Azure resource name

properties.eventHubAuthorizationRuleId

string

The resource Id for the event hub authorization rule.

properties.eventHubName

string

The name of the event hub. If none is specified, the default event hub will be selected.

properties.logs

ManagementGroupLogSettings[]

The list of logs settings.

properties.serviceBusRuleId

string

The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.

properties.storageAccountId

string

The resource ID of the storage account to which you would like to send Diagnostic Logs.

properties.workspaceId

string

The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

type

string

Azure resource type

ManagementGroupLogSettings

Part of Management Group diagnostic setting. Specifies the settings for a particular log.

Name Type Description
category

string

Name of a Management Group Diagnostic Log category for a resource type this setting is applied to.

enabled

boolean

a value indicating whether this log is enabled.