使用下面的ARM模板,我们enabled diagnostic settings for our app service并在appSettings
元素下定义了resources
配置。问题是从模板部署我们的应用程序服务后间歇性地进行-appSettings
未分配,但诊断设置已分配。
如果有更好的方法为提供更一致的站点输出的应用服务定义logs
和appSettings
的配置,有人可以指导我们吗?我们每天都会为PR版本构建和拆除数十个应用程序服务,因此这非常明显。
appSetting WEBSITE_LOAD_USER_PROFILE
将在创建应用程序服务时被随机删除。我们是否缺少dependsOn
还是需要升级apiVersion
?
{
"$schema": "http://schema.management.azure.com/schemas/2018-05-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string"
},
"siteHostingPlanName": {
"type": "string"
},
"resourceLocation": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2016-09-01",
"name": "[parameters('siteHostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('resourceLocation')]",
"properties": {
"name": "[parameters('siteHostingPlanName')]"
},
"sku": {
"name": "P2V2",
"tier": "PremiumV2",
"capacity": 2
}
},
{
"apiVersion": "2014-11-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('resourceLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('siteHostingPlanName'))]"
],
"properties": {
"name": "[parameters('siteName')]",
"serverFarm": "[parameters('siteHostingPlanName')]",
"siteConfig": {
"AlwaysOn": true,
"webSocketsEnabled": true,
"http20Enabled": true,
"requestTracingEnabled": true,
"requestTracingExpirationTime": "9999-12-31T23:59:00Z",
"httpLoggingEnabled": true,
"logsDirectorySizeLimit": 100,
"detailedErrorLoggingEnabled": true
}
},
"resources": [
{
"apiVersion": "2014-11-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"WEBSITE_LOAD_USER_PROFILE": 1
}
},
{
"apiVersion": "2014-11-01",
"name": "logs",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"applicationLogs": {
"fileSystem": {
"level": "Verbose"
}
},
"httpLogs": {
"fileSystem": {
"retentionInMb": 100,
"enabled": true
}
},
"failedRequestsTracing": {
"enabled": true
},
"detailedErrorMessages": {
"enabled": true
}
}
}
]
}
]
}
答案 0 :(得分:1)
您应该与functionApp Resource
一起配置应用程序设置,而不是在单独的资源中定义设置。我已经使用了它并定义了各种应用程序设置,并且工作正常。尝试使用以下示例。
{
"apiVersion": "[variables('sitesApiVersion')]",
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"location": "[resourceGroup().location]",
"name": "[parameters('functionAppName')]",
"scale": null,
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('functionApp_appServicePlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "WEBSITE_LOAD_USER_PROFILE",
"value": "1"
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('functionApp_appServicePlanName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
]
}
}