尝试启动Azure bot功能时出现错误“无法解密设置...”

时间:2018-02-18 21:28:20

标签: azure azure-functions

我们有一个机器人端点实现为Azure功能,它在Azure中运行良好。

我们已按照此过程使我们能够在本地运行/调试Azure功能: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local

特别是,以下PowerShell命令:

func azure functionapp fetch-app-settings <FunctionAppName>

它似乎运行正常,并将必要的设置放入local.settings.json,在构建项目时输出到bin。但是,当我们启动该函数(右键单击项目 - 调试 - 启动新实例)时,它会给出以下错误:

Failed to decrypt settings. Encrypted settings only be edited through 'func settings add'.

在两台机器上,我们遇到上述解密错误,在两台机器上运行正常。

有什么建议吗?

P.S。我们不是试图在机器之间共享相同的local.settings.json文件,我理解这也会产生这种错误。

更新

以下是问题计算机中local.settings.json文件的内容,其中删除了加密值:

{
  "IsEncrypted": true,
  "Values": {
    "AzureWebJobsStorage": "[encrypted content]",
    "AzureWebJobsDashboard": "[encrypted content]",
    "FUNCTIONS_EXTENSION_VERSION": "[encrypted content]",
    "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[encrypted content]",
    "WEBSITE_CONTENTSHARE": "[encrypted content]",
    "WEBSITE_NODE_DEFAULT_VERSION": "[encrypted content]",
    "BotEnv": "[encrypted content]",
    "BotId": "[encrypted content]",
    "MicrosoftAppId": "[encrypted content]",
    "MicrosoftAppPassword": "[encrypted content]",
    "BotStateEndpoint": "[encrypted content]",
    "BotOpenIdMetadata": "[encrypted content]",
    "UseTableStorageForConversationState": "[encrypted content]",
    "BotDevAppInsightsKey": "[encrypted content]",
    "BotDevAppInsightsName": "[encrypted content]",
    "BotDevAppInsightsAppId": "[encrypted content]",
    "AzureWebJobsBotFrameworkDirectLineSecret": "[encrypted content]",
    "AzureWebJobsBotFrameworkDirectLineEndpoint": "[encrypted content]",
    "WEBSITE_USE_PLACEHOLDER": "[encrypted content]",
    "APPINSIGHTS_INSTRUMENTATIONKEY": "[encrypted content]",
    "MSDEPLOY_RENAME_LOCKED_FILES": "[encrypted content]"
  },
  "ConnectionStrings": {}
}

3 个答案:

答案 0 :(得分:2)

更改已加密的方式如下:

"IsEncrypted": false, 

在      local.settings.json

答案 1 :(得分:0)

我遇到了完全相同的问题:

完成后:

func azure functionapp fetch-app-settings

我在local.settings.file中只有加密的功能设置。使用func stettings list进行调试并查看func settings list --help后发现我可以做到:

功能设置解密

工作了!

编辑: 几个月后才回来。在function.json中使用显式"IsEncrypted": false现在也适用于我,但是使用func settings decrypt

可能更好

答案 2 :(得分:0)

在运行不同的运行时版本v1和v2时出现相同的问题。检查您是否正在运行相同的功能运行时版本。

相关问题