Azure Functions ARM模板部署删除功能 [英] Azure Functions ARM Template deploy deletes Functions

查看:47
本文介绍了Azure Functions ARM模板部署删除功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于部署Azure Function应用程序的ARM模板(包括在下面).我将其部署为:

I've got an ARM template (included below) to deploy an Azure Function App. I deploy it with:

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

这有效,然后我可以使用VS Code插件或Azure Functions核心工具成功部署我的功能.

This works and I can then deploy my functions successfully using the VS Code plugin or Azure Functions Core Tools.

但是,如果我随后重新部署ARM模板(例如,更新应用程序设置),则会丢失我的功能,需要再次重新部署它们.这是预期的行为吗?我在部署例如通过ARM模板的Web应用程序.在为功能应用程序部署ARM模板以保留我已部署的功能时,我可以做些特定的事情吗?

However, if I then re-deploy the ARM template (for example to update an application setting) then I lose my functions and need to re-deploy them again. Is this expected behaviour? It's not what I observe when deploying e.g. a Web App via an ARM template. Is there something specific I can do when deploying an ARM template for a Function App to preserve my deployed functions?

my-function-app.json:

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": {}
}

推荐答案

您是否将功能作为软件包进行部署?如果是这样,请确保您在模板中设置了此设置,因为在重新部署时将删除该设置:

Are you deploying your function as a package? If so, make sure you set this setting in your template, since it will be removed when you redeploy otherwise:

{ 名称":"WEBSITE_RUN_FROM_PACKAGE", 值":"1" }

{ "name": "WEBSITE_RUN_FROM_PACKAGE", "value": "1" }

这篇关于Azure Functions ARM模板部署删除功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆