来自ARM模板设置App Service日志配置的结果不一致

时间:2017-05-04 18:50:46

标签: azure azure-web-sites azure-resource-manager

我遇到的问题是这个SO用户遇到了ARM Template containing config settings for web app 该线程没有解决方案,所以我再次提出基本相同的问题。我有一个ARM模板,如下所示:

{
  "name": "logs",
  "type": "config",
  "apiVersion": "2015-08-01",
  "dependsOn": [
    "[resourceId('Microsoft.Web/sites', parameters('AppServiceName'))]"
  ],
  "properties": {
    "applicationLogs": {
      "azureBlobStorage": {
        "level": "Verbose",
        "sasUrl": "[concat('https://',parameters('StorageAccountName'),'.blob.core.windows.net/logs',parameters('SasToken'))]",
        "retentionInDays": null
      }
    },
    "httpLogs": {
      "azureBlobStorage": {
        "sasUrl": "[concat('https://',parameters('StorageAccountName'),'.blob.core.windows.net/logs',parameters('SasToken'))]",
        "retentionInDays": 360,
        "enabled": true
      }
    },
    "failedRequestsTracing": {
      "enabled": true
    },
    "detailedErrorMessages": {
      "enabled": true
    }
  }
}

我将运行一次,在资源管理器中,结果是

{
  "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Web/sites/.../config/logs",
  "name": "logs",
  "type": "Microsoft.Web/sites/config",
  "location": "East US",
  "properties": {
    "applicationLogs": {
      "fileSystem": {
        "level": "Off"
      },
      "azureTableStorage": {
        "level": "Off",
        "sasUrl": null
      },
      "azureBlobStorage": {
        "level": "Verbose",
        "sasUrl": "VALID_SAS_URL",
        "retentionInDays": null
      }
    },
    "httpLogs": {
      "fileSystem": {
        "retentionInMb": 35,
        "retentionInDays": null,
        "enabled": false
      },
      "azureBlobStorage": {
        "sasUrl": "VALID_SAS_URL",
        "retentionInDays": null,
        "enabled": true
      }
    },
    "failedRequestsTracing": {
      "enabled": true
    },
    "detailedErrorMessages": {
      "enabled": true
    }
  }
}

资源浏览器和门户网站中的所有内容都很好看。 然后我再次运行相同的模板,结果是:

{
"id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Web/sites/.../config/logs",
"name": "logs",
"type": "Microsoft.Web/sites/config",
"location": "East US",
"properties": {
  "applicationLogs": {
    "fileSystem": {
      "level": "Off"
    },
    "azureTableStorage": {
      "level": "Off",
      "sasUrl": null
    },
    "azureBlobStorage": {
      "level": "Verbose",
      "sasUrl": null,
      "retentionInDays": null
    }
  },
  "httpLogs": {
    "fileSystem": {
      "retentionInMb": 35,
      "retentionInDays": null,
      "enabled": true
    },
    "azureBlobStorage": {
      "sasUrl": null,
      "retentionInDays": null,
      "enabled": false
    }
  },
  "failedRequestsTracing": {
    "enabled": true
  },
  "detailedErrorMessages": {
    "enabled": true
  }
}

我可以多次运行相同的模板,无论是否使用ARM模板中定义的设置启用诊断日志记录,都是完全随机的。

1 个答案:

答案 0 :(得分:0)

您是否还在模板中设置了应用设置?我认为当它们一起使用时可能存在问题。在模板中尝试以下操作:

  • 首先设置应用设置
  • 然后使config/log依赖于应用程序设置。