创建后如何在 Azure 数据工厂中启用诊断 [英] How to enable diagnostics in an Azure datafactory after creation

查看:24
本文介绍了创建后如何在 Azure 数据工厂中启用诊断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过 c# 自动化应用程序创建之后,我正在尝试使用 ARM 模板为 azure 数据工厂启用诊断.我正在尝试将此处的步骤用于非计算资源模板:

I am trying to enable diagnostics for an azure datafactory using an ARM Template after is has been created via a c# automation application. I am attempting to use the steps here for the Non-Compute Resource Template:

https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-enable-diagnostic-logs-using-template

上述说明的第 2 步说明:

Step 2 of the above instructions state:

在您要启用的资源的资源数组中诊断日志,添加类型为 [resource命名空间]/providers/diagnosticSettings.

In the resources array of the resource for which you want to enable Diagnostic Logs, add a resource of type [resource namespace]/providers/diagnosticSettings.

这里是我的问题所在:

我希望我可以为该资源的资源数组之外的数据工厂(或任何资源)启用诊断,因为数据工厂不是作为 ARM 模板的一部分创建的.这可能吗?

I was hoping that I could enable the diagnostics for a datafactory(or any resource really) outside of the resources array for for that resource since the data factory is not being created as part of the ARM template. Is that possible?

如果是,上面引用中的 [resource namespace] 是什么?我曾尝试使用Microsoft.DataFactory/providers/diagnosticSettings",但由于无效资源而失败.

If so what is the [resource namespace] in the above quote? I have tried using "Microsoft.DataFactory/providers/diagnosticSettings", but that fails as an invalid resource.

这是迄今为止我拥有的 JSON(请记住,这是在数据工厂的资源数组之外,因为它已经在前面的步骤中创建了).

Here is the JSON I have thus far(remember this is outside of the resource array for the data factory, because it is already created in an earlier step).

 {
    "type": "Microsoft.DataFactory/providers/diagnosticSettings",
    "name": "[concat('Microsoft.Insights/', parameters('factoryName'))]",
    "apiVersion": "2017-05-01-preview",
    "properties": {
      "name": "[parameters('factoryName')]",
      "workspaceId": "[parameters('workspaceId')]",
      "logs": [
        {
          "category": "/* log category name */",
          "enabled": true,
          "retentionPolicy": {
            "days": 0,
            "enabled": false
          }
        }
      ],
      "metrics": [
        {
          "category": "AllMetrics",
          "enabled": true,
          "retentionPolicy": {
            "enabled": false,
            "days": 0
          }
        }
      ]
    }
  }

推荐答案

试试这个(这对我有用)

让我们想想:

部署名称:AzureADF-DiagSettings-Deployment
部署资源组:ADFactoryRG
Azure 数据工厂实例名称:ADFactory
诊断设置名称(在 ADFactory 中):DiagService
日志分析实例名称:OMSWorkspace
日志分析资源组:OMSWorkspaceRG

Deployment name: AzureADF-DiagSettings-Deployment
Deployment resource group: ADFactoryRG
Azure Data Factory instance name: ADFactory
Diagnostic settings name (In ADFactory): DiagService
Log analytics instance name: OMSWorkspace
Log analytics resource group: OMSWorkspaceRG

{
  "$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": "AzureADF-DiagSettings-Deployment",
      "type": "Microsoft.Resources/deployments",
      "resourceGroup": "ADFactoryRG",
      "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": "ADFactory/Microsoft.Insights/DiagService",
              "apiVersion": "2017-05-01-preview",
              "properties": {
                "name": "DiagService",
                "storageAccountId": null,
                "eventHubAuthorizationRuleId": null,
                "eventHubName": null,
                "workspaceId": "OMSWorkspaceRG/Microsoft.OperationalInsights/workspaces/OMSWorkspace",
                "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": {}
}

这篇关于创建后如何在 Azure 数据工厂中启用诊断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆