gpt4 book ai didi

azure - ARM 模板应用程序服务配置 - 竞争条件/行为不一致

转载 作者:行者123 更新时间:2023-12-03 05:46:58 26 4
gpt4 key购买 nike

使用下面的ARM模板,我们enabled diagnostic settings for our app service以及在 resources 元素下定义 appSettings 配置。问题是,从模板部署我们的应用程序服务后,间歇性地不会分配 appSettings,但会分配诊断设置。

如果有更好的方法来定义应用服务的 logsappSettings 的配置,以提供更一致的站点输出,有人可以指导我们吗?我们每天为 PR 构建构建和拆卸数十个应用程序服务,因此这一点非常明显。

创建应用服务时,appSetting WEBSITE_LOAD_USER_PROFILE 将被随机删除。我们是否缺少 dependsOn 还是需要升级 apiVersion

带有应用程序设置 + 日志配置的 ServerFarm

{
"$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
}
}
}
]
}
]
}

最佳答案

您应该将应用设置与 functionApp 资源 一起配置,而不是在单独的资源中定义设置。我已经使用了它并定义了各种应用程序设置,并且运行良好。请尝试像下面的示例一样。

{
"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'))]"
]
}
}

关于azure - ARM 模板应用程序服务配置 - 竞争条件/行为不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53013383/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com