gpt4 book ai didi

Azure Functions ARM 模板部署删除函数

转载 作者:行者123 更新时间:2023-12-03 15:08:17 26 4
gpt4 key购买 nike

我有一个 ARM 模板(包含在下面)来部署 Azure Function App。我将其部署为:

az group deployment create --resource-group my-group --template-file my-function-app.json

这有效,然后我可以使用 VS Code 插件或 Azure Functions Core Tools 成功部署我的函数。

但是,如果我随后重新部署 ARM 模板(例如更新应用程序设置),则会丢失我的功能并需要再次重新部署它们。这是预期的行为吗?这不是我在部署时观察到的情况,例如通过 ARM 模板的 Web 应用程序。在为函数应用部署 ARM 模板时,我可以做一些具体的事情来保留我部署的函数吗?

my-function-app.json:

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
...
},
"variables": {
...
},
"resources": [
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('collectorFunctionAppName')]",
"location": "[parameters('location')]",
"kind": "functionapp",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"siteConfig": {
"appSettings": [
{
...
}
]
}
}
}
],
"outputs": {}
}

最佳答案

您是否将函数部署为包?如果是这样,请确保在模板中设置此设置,因为否则在重新部署时它将被删除:

{ “名称”:“WEBSITE_RUN_FROM_PACKAGE”, “值”:“1”}

关于Azure Functions ARM 模板部署删除函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53612397/

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