Azure功能如何将appsettings从本地移动到服务器,反之亦然

时间:2018-03-06 01:17:21

标签: azure azure-functions azure-functions-runtime azure-function-app-proxy

我对Azure有点新鲜。

问题是我正在开发Azure功能,有时我必须在本地(代码/测试等)工作,有时在Azure上工作。每次切换时我都要手动比较和更改应用设置。

有没有办法可以避免它?如果我在本地运行,我可能会在没有手动的情况下从服务器获取最新信息,当我转到服务器Azure时可能会注意到我的更改?

谢谢

1 个答案:

答案 0 :(得分:2)

是的,请使用Azure Functions Core Tools -

Usage: func azure functionapp <action> [-/--options]

fetch-app-settings  Retrieve App Settings from your Azure-hosted
                    Function App and store locally Aliases:
                    fetch-app-settings, fetch

Usage: func azure functionapp <action> [-/--options]

publish             Publish the current directory contents to an
                    Azure Function App. Locally deleted files
                    are not removed from destination.

    <FunctionAppName> Function App name

    --publish-local-settings [-i] Updates App Settings for the
                                  function app in Azure during deployment.

    --publish-settings-only [-o]  Only publish settings and skip the
                                  content. Default is prompt.

    --overwrite-settings [-y]     Only to be used in conjunction with -i or -o.
                                  Overwrites AppSettings in Azure with local
                                  value if different. Default is prompt.

如果您有点冒险的话,还可以对本地文件进行加密 -
运行func settings以获得使用。