自动配置azure功能应用程序设置

自动配置azure功能应用程序设置

本文介绍了自动配置azure功能应用程序设置。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何自动配置azure功能应用设置。本地settings.json文件用于本地配置,我需要帮助在发布期间自动配置功能应用程序设置。

How could we configure azure function app settings automatically. The local settings.json file is used for local configuration, i need help in configuring the function app settings automatically during release.

谢谢。

推荐答案

{
    "apiVersion": "2016-03-01",
    "type": "Microsoft.Web/sites",
    "name": "[variables('functionAppName')]",
    "location": "[resourceGroup().location]",
    "kind": "functionapp",
    "dependsOn": [
        "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
    ],
    "properties": {
        "siteConfig": {
            "appSettings": [
                {
                    "name": "AzureWebJobsStorage",
                    "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
                },
                {
                    "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
                    "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
                },
                {
                    "name": "WEBSITE_CONTENTSHARE",
                    "value": "[toLower(variables('functionAppName'))]"
                },
                {
                    "name": "FUNCTIONS_WORKER_RUNTIME",
                    "value": "node"
                },
                {
                    "name": "WEBSITE_NODE_DEFAULT_VERSION",
                    "value": "10.14.1"
                },
                {
                    "name": "FUNCTIONS_EXTENSION_VERSION",
                    "value": "~2"
                }
            ]
        }
    }
}

2。使用

az functionapp config appsettings set [--ids]
                                      [--name]
                                      [--resource-group]
                                      [--settings]
                                      [--slot-settings]
                                      [--subscription]

3。使用

//Publish settings in local.settings.json to Azure, prompting to overwrite if the setting already exists.

func azure functionapp publish <FunctionAppName> --publish-local-settings -i


or


//Only publish settings and skip the content. Default is prompt.
func azure functionapp publish <FunctionAppName> --publish-settings-only -o





这篇关于自动配置azure功能应用程序设置。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 10:30