在通过 C# 自动化应用程序创建 RAW 模板后,我正在尝试使用 ARM 模板为 Azure 数据工厂启用诊断。我正在尝试将此处的步骤用于非计算资源模板:
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-enable-diagnostic-logs-using-template
上述说明的步骤 2 指出:
在要为其启用的资源的资源数组中 诊断日志,添加 [资源] 类型的资源 namespace]/providers/diagnosticSettings.
这是我的问题所在:
我希望我可以为该资源的资源数组之外的数据工厂(或任何资源(启用诊断,因为数据工厂不是作为 ARM 模板的一部分创建的。这可能吗?
如果是这样,上面引用中的 [资源命名空间] 是什么?我尝试使用"Microsoft.DataFactory/providers/diagnosticSettings",但作为无效资源失败。
这是我到目前为止拥有的 JSON(请记住,这是在数据工厂的资源数组之外,因为它已在前面的步骤中创建(。
{
"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
中(:诊断服务
日志分析实例名称:OMSWorkspace
日志分析资源组: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": {}
}