[英]Diagnostic setting not included in Azure Portal ARM template export
I create a Diagnostic Settings for a KeyVault resource in Azure portal.我在 Azure 门户中为 KeyVault 资源创建诊断设置。 DS properties are Metrics = AllMetrics and Destination is a predefined Log Analytics Workspace.
DS 属性是 Metrics = AllMetrics,Destination 是预定义的 Log Analytics 工作区。 When I do an export (Automation - Export Template) from Portal, nothing from the diagnostic setting is included in the generated ARM json.
当我从 Portal 进行导出(自动化 - 导出模板)时,生成的 ARM json 中不包含诊断设置中的任何内容。 I've noticed the same behavior when resource is an App Service.
当资源是应用服务时,我注意到了相同的行为。
Is this by design?这是设计使然吗? A bug?
一个错误? Any other way to get the ARM json for the diagnostic setting I've defined?
对于我定义的诊断设置,还有其他方法可以获取 ARM json 吗?
I tried the same in my environment and seems we cannot export the diagnostics settings for any service like key vault, app service, storage account etc
when we try to export the template for automation.我在我的环境中尝试了同样的方法,当我们尝试导出模板以进行自动化时,似乎无法导出任何服务(如
key vault, app service, storage account etc
的诊断设置。 But there are some sample Diagnostics settings Templates for few resources provided in Microsoft Documentation .但是有一些示例诊断设置模板,用于Microsoft 文档中提供的少量资源。
So, as per your settings it will something like below which I have tested by deploying:因此,根据您的设置,它将类似于我通过部署测试过的内容:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"settingName": {
"type": "String",
"defaultValue": "testdsansuman"
},
"vaultName": {
"type": "String",
"defaultValue": "ansumantestkv1234"
},
"workspaceName": {
"type": "String",
"defaultValue": "ansumantestlog"
} //,
//"storageAccountId": {
// "type": "String"
//},
//"eventHubAuthorizationRuleId": {
// "type": "String"
//},
//"eventHubName": {
// "type": "String"
//}
},
"resources": [
{
"type": "Microsoft.KeyVault/vaults/providers/diagnosticSettings",
"apiVersion": "2017-05-01-preview",
"name": "[concat(parameters('vaultName'), '/Microsoft.Insights/', parameters('settingName'))]",
"dependsOn": [],
"properties": {
"workspaceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('WorkspaceName'))]",
//"storageAccountId": "[parameters('storageAccountId')]",
//"eventHubAuthorizationRuleId": "[parameters('eventHubAuthorizationRuleId')]",
//"eventHubName": "[parameters('eventHubName')]",
//"logs": [
//{
//"category": "AuditEvent",
//"enabled": true
//}
//],
"metrics": [
{
"category": "AllMetrics",
"enabled": true
}
]
}
}
]
}
Output: Output:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.