[英]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.