是否有任何 Terraform 代码或 ARM 模板代码可用于在数据工厂中启用诊断设置

Is there any Terraform code or ARM Template code available for enabling diagnostic settings in data factory

我可以在门户中手动启用诊断设置,如果我想通过代码自动为数据工厂创建诊断设置,是否有任何 terraform 代码或 ARM 模板代码可用于执行此操作

提前致谢

我试过这个 ARM template 并成功启用了诊断设置。

{
"$schema": "https://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
  {
    "apiVersion": "2017-05-10",
    "name": "Deploy_DataFactoryDiagSettings",
    "type": "Microsoft.Resources/deployments",
    "resourceGroup": "YourResourceGroupName",
    "properties": {
      "mode": "Incremental",
      "template": {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {},
        "variables": {},
        "resources": [
          {
            "type": "microsoft.datafactory/factories/providers/diagnosticsettings",
            "name": "{YourADFresourceName}/Microsoft.Insights/ADFDiagSetting",
            "apiVersion": "2017-05-01-preview",
            "properties": {
              "name": "ADFDiagSetting",
              "storageAccountId": null,
              "eventHubAuthorizationRuleId": null,
              "eventHubName": null,
              "workspaceId": "/subscriptions/{YourSubscriptionID}/resourceGroups/{YourResourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceID}",
              "logs": [
                {
                  "category": "PipelineRuns",
                  "enabled": true,
                  "retentionPolicy": {
                      "enabled": false,
                      "days": 0
                  }
                },
                {
                  "category": "TriggerRuns",
                  "enabled": true,
                  "retentionPolicy": {
                      "enabled": false,
                      "days": 0
                  }
                },
                {
                  "category": "ActivityRuns",
                  "enabled": true,
                  "retentionPolicy": {
                      "enabled": false,
                      "days": 0
                  }
                }
              ],
              "metrics": [
                {
                  "category": "AllMetrics",
                  "timeGrain": "PT1M",
                  "enabled": true,
                  "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                  }
                }
              ]
            }
          }
        ],
        "outputs": {}
      },
      "parameters": {}
    }
  }
],
"outputs": {}

}