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

Mic*_*345 5 azure azure-functions

我们有一个实现为Azure功能的漫游器终结点,它在Azure中运行良好。

我们已遵循此过程来使我们能够在本地运行/调试Azure函数:https : //docs.microsoft.com/zh-cn/azure/azure-functions/functions-run-local

特别是以下PowerShell命令:

func azure functionapp fetch-app-settings <FunctionAppName>
Run Code Online (Sandbox Code Playgroud)

看起来运行良好,并将必要的设置放入local.settings.json,在构建项目时将其输出到bin。但是,当我们启动函数(右键单击项目-调试-启动新实例)时,会出现以下错误:

Failed to decrypt settings. Encrypted settings only be edited through 'func settings add'.
Run Code Online (Sandbox Code Playgroud)

在两台计算机上,我们收到上述解密错误,在两台计算机上,它运行正常。

有什么建议么?

PS:我们不尝试在机器之间共享相同的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": {}
}
Run Code Online (Sandbox Code Playgroud)

小智 8

更改IsEncrypted的内容,如下所示:

"IsEncrypted": false, 
Run Code Online (Sandbox Code Playgroud)

local.settings.json

  • 这不会解决问题,而只是在值仍处于加密状态时禁用加密。 (2认同)

Pla*_*Tag 6

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

做完后:

func azure functionapp fetch-app-settings

我只得到了加密的功能设置local.settings.file。调试并func stettings list查看func settings list --help发现我可以这样做:

功能设置解密

并成功了!

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