简体   繁体   English

通过脚本/ARM 模板将诊断日志设置添加到 Azure 数据工厂

[英]Add diagnostic log settings to Azure Data Factory via scripting/ARM templates

Following on a question posted a few days ago, Data factory Diagnostic settings , is there any way to accomplish adding to log analytics diagnostics via a script.继几天前发布的一个问题之后, 数据工厂诊断设置,有没有办法通过脚本完成添加到日志分析诊断。

I could not find anything in Azure CLI - Data Factory Extension or Terraform Azure Data Factory provider to support this.我在Azure CLI - 数据工厂扩展Terraform Azure 数据工厂提供程序中找不到任何支持此功能的内容。

Diagnostics is not a property of a resource, but instead it is configured using it's own provider.诊断不是资源的属性,而是使用它自己的提供程序配置的。

https://docs.microsoft.com/en-us/azure/azure-monitor/samples/resource-manager-diagnostic-settings https://docs.microsoft.com/en-us/azure/azure-monitor/samples/resource-manager-diagnostic-settings

I did find answer to this question.我确实找到了这个问题的答案。 Hopefully it will help anybody else looking for automation for Azure Data Factory.希望它能帮助其他任何寻求 Azure 数据工厂自动化的人。

The solution was not in documentation for Azure Data Factory, where I was looking, but in the scripting for - Azure Monitor.该解决方案不在我正在寻找的 Azure 数据工厂的文档中,而是在 - Azure Monitor 的脚本中。 The link is - Create diagnostic settings to send platform logs and metrics to different destinations - Azure Monitor |链接是 - 创建诊断设置以将平台日志和指标发送到不同的目的地 - Azure Monitor | Microsoft Docs 微软文档

To the credit of the Azure team, this link is available on Portal where diagnostics is added to the Azure Data Factory, but the information about the Azure CLI is close to the bottom of the page.感谢 Azure 团队,此链接可在 Portal 上获得,其中诊断已添加到 Azure 数据工厂,但有关 Z3A580F142203677F1F0BC30898F63F5Z 的底部页面的信息靠近 CLI。 (So, egg on my face, for missing it.) (所以,我脸上的鸡蛋,因为错过了它。)

Here is the script that I came up with:这是我想出的脚本:

az monitor diagnostic-settings create  \
--name LogAnalytics02-Diagnostics \
--resource /subscriptions/(your-subscription)/resourceGroups/(your-resource-group)/providers/Microsoft.DataFactory/factories/(data-factory-name) \
--logs '[{"category": "PipelineRuns","enabled": true}]' \
--metrics '[{"category": "AllMetrics","enabled": true}]' \
--workspace /subscriptions/(your-subscription)/resourcegroups/(your-resource-group)/providers/microsoft.operationalinsights/workspaces/(your-log-analytics-workspace-name)

The pre-requisite to running the script is provisioning to the Azure Data Factory and the Log Analytics Workspace.运行脚本的先决条件是预配到 Azure 数据工厂和 Log Analytics 工作区。 Substitute the values to match the Azure subscription and resources.替换值以匹配 Azure 订阅和资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 数据工厂诊断设置 - Data factory Diagnostic settings 如何使用ARM模板将诊断设置添加到现有的Azure Kubernetes? - How to add Diagnostic Setting to existing Azure Kubernetes using ARM Templates? 参数化 Azure 数据工厂中的连接(ARM 模板) - Parameterize connections in Azure data factory (ARM templates) 使用ARM模板部署Azure数据工厂 - Deploying Azure Data Factory using ARM Templates 通过 ARM 模板部署的 Azure 数据工厂 - Azure Data Factory deployed via ARM Template 除了使用 ARM 模板之外,还有其他方法可以部署 Azure 数据工厂吗? - Is there a way to deploy Azure Data factory other than using ARM templates? 使用Terraform的Azure Data Factory诊断设置的特定于资源的目标表 - Resource Specific destination table for Azure Data Factory diagnostic settings using Terraform Azure 网关 ARM 模板配置诊断设置(Log Analytics 工作区) - Azure Gateway ARM template to configure diagnostic setting (Log Analytics workspace) 通过PowerShell创建的Azure诊断设置在Azure门户中不可见 - Azure Diagnostic settings created via PowerShell not visible in Azure Portal Azure 数据工厂 - ARM 模板 - Azure Data Factory - ARM Template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM