gpt4 book ai didi

通过 ARM 模板部署时,Azure 函数暂存槽交换错误

转载 作者:行者123 更新时间:2023-12-02 07:07:59 26 4
gpt4 key购买 nike

我使用 ARM 模板创建了一个 Azure 函数应用程序(消费计划)。在我部署代码并执行交换操作(VSTS 任务)后,生产槽和登台槽都有新代码。但我预计暂存槽在交换操作后会有旧代码,这是 Azure 函数中的已知错误吗?或者我需要做任何额外的事情

"resources": [
{
"name": "CampaignSyncJob",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-09-01",
"dependsOn": [],
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('artifactsLocation'), '/', variables('linkedTemplateFolderName'), '/', variables('webAppTemplateFileName'), parameters('artifactsLocationSasToken'))]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"appServicePlanName": {
"value": "[reference('ReleaseParams').outputs.webApp.value.appServicePlanName]"
},
"appServiceName": {
"value": "[reference('ReleaseParams').outputs.webApp.value.appServiceName]"
},
"artifactsLocation": {
"value": "[parameters('artifactsLocation')]"
},
"artifactsLocationSasToken": {
"value": "[parameters('artifactsLocationSasToken')]"
},
"packageFolder": {
"value": "CampaignSyncJob"
},
"packageFileName": {
"value": "package.zip"
},
"appSettings": {
"value": {
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTSHARE": "[toLower(variables('appServiceName'))]",
"FUNCTIONS_EXTENSION_VERSION": "~2",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
"MSDEPLOY_RENAME_LOCKED_FILES": "1",
"AppInsights_InstrumentationKey": "[variables('appInsightsInstrumentationKey')]",
"StickySetting": "StuckToProduction1"
}
},
"slotAppSettings": {
"value": {
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTSHARE": "[toLower(variables('appServiceName'))]",
"FUNCTIONS_EXTENSION_VERSION": "~2",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
"MSDEPLOY_RENAME_LOCKED_FILES": "1",
"AppInsights_InstrumentationKey": "[variables('appInsightsInstrumentationKey')]",
"StickySetting": "StuckToStaging1"
}
},
"slotName": {
"value": "[reference('ReleaseParams').outputs.webApp.value.appServiceSlotName]"
},
"appServiceLocation": {
"value": "[reference('ReleaseParams').outputs.common.value.location]"
},
"slotSpecificAppSettingKeys": {
"value": [
"StickySetting"
]
}
}
}
},

部署函数应用的链接模板

{
"condition": "[parameters('deployOnStagingSlot')]",
"apiVersion": "2015-08-01",
"name": "[concat(parameters('appServiceName'), '/', parameters('slotName'))]",
"type": "Microsoft.Web/sites/slots",
"location": "[parameters('appServiceLocation')]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
},
"dependsOn": [
],
"resources": [
{
"condition": "[parameters('deployOnStagingSlot')]",
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('appServiceName'), '/slots/', parameters('slotName'))]",
"[concat('Microsoft.Web/sites/', parameters('appServiceName'), '/slots/', parameters('slotName'), '/Extensions/MSdeploy')]"
],
"properties": "[parameters('slotAppSettings')]"
},
{
"condition": "[parameters('deployOnStagingSlot')]",
"name": "MSDeploy",
"type": "extensions",
"location": "[parameters('appServiceLocation')]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('appServiceName'), '/slots/', parameters('slotName'))]"
],
"properties": {
"packageUri": "[concat(parameters('artifactsLocation'), '/', parameters('packageFolder'), '/', parameters('packageFileName'), parameters('artifactsLocationSasToken'))]",
"setParameters": {
"IIS Web Application Name": "[parameters('slotName')]"
}
}
}
]
}

最佳答案

嗯,我知道要在函数应用程序内交换插槽,需要将应用程序设置 WEBSITE_CONTENTSHARE 更改为插槽特定设置。

有关此解决方案以及有关多个插槽的其他 ARM 问题,请查看 Gary Lumsden 的博客

关于通过 ARM 模板部署时,Azure 函数暂存槽交换错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51959958/

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