简体   繁体   English

Azure Portal ARM 模板导出中不包含诊断设置

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

相关问题 Azure 网关 ARM 模板配置诊断设置(Log Analytics 工作区) - Azure Gateway ARM template to configure diagnostic setting (Log Analytics workspace) 如何使用 ARM 模板为 Azure 资源创建活动日志诊断设置 - How to create Activity logs diagnostic setting for Azure resources using ARM template Azure 导出 ARM 模板:Microsoft.KeyVault/vaults/accessPolicies 尚无法导出且未包含在模板中 - Azure Export ARM Template: Microsoft.KeyVault/vaults/accessPolicies cannot be exported yet and is not included in the template 如何使用ARM模板将诊断设置添加到现有的Azure Kubernetes? - How to add Diagnostic Setting to existing Azure Kubernetes using ARM Templates? Azure ARM 模板导出数据库到.bacpac文件 - Azure ARM Template to export database to .bacpac file 是否可以为azure函数导出ARM模板? - Is it possible to export an ARM template for an azure function? 如何导出 Azure 工作簿的 ARM 模板? - How to export ARM template of an Azure Workbook? 使用ARM模板成功创建了Azure日志警报规则,但未出现在门户中 - Azure log alert rule created successfully with ARM template but not appearing in portal 如何在 ARM 模板中引用在 Azure 门户中创建的现有存储帐户 - How to reference an existing storage account created in Azure portal in an ARM template 在 arm 模板中设置 Azure 的服务层 - Setting Azure's Service tier in arm template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM