Microsoft Azure 机器人框架 - 可以使用“在 Web 聊天中测试”来测试具有用户管理身份的机器人吗?

问题描述 投票:0回答:1

我正在尝试使用 javascript SDK 的 Azure 机器人框架。我尝试使用用户分配的托管身份设置机器人。

我一直无法解决“未找到 Http Status”错误。

有一个 GitHub 问题,https://github.com/microsoft/BotFramework-Emulator/issues/2377,其中指出无法使用机器人模拟器软件测试用户分配的托管身份。

可以使用 Azure 门户的“Web 聊天中的测试”来测试具有用户分配的托管标识的机器人吗?或者 github 问题中的限制也适用于网络聊天中的测试吗?

azure azure-web-app-service botframework
1个回答
0
投票

可以通过“在网络聊天中测试”来测试具有用户管理身份的机器人吗?

是的,可以通过“在网络聊天中测试”来测试使用用户管理身份创建的机器人。

我已遵循 MSDOC 并创建了一个 JavaScript Azure 机器人。

本地响应:

enter image description here

  • 使用用户分配的托管标识和 Azure 应用服务创建 Azure 机器人。

将机器人与应用服务链接:

  • 转到应用程序服务并选择
    App Service plan=>Apps=>select your App Service=>Go to Identity=>User Assigned Identity=>Add=>Select your Bot Identity
    :

enter image description here

  • 点击添加的
    Bot Identity=>Properties
    ,您将能够看到租户ID客户端ID机器人类型。复制它们以在代码中使用。

enter image description here

  • 修改代码如下所示:

.env:

  • 更新 .env 文件中的以下值(无需 Microsoft 密码):
MicrosoftAppType=UserAssignedMSI
MicrosoftAppId=<Client_ID>
MicrosoftAppTenantId=<Tenant_ID>

Start
的脚本部分更改
Package.json
命令,如下所示:

Package.Json:

 "scripts": {
        "start": "npm start",
        "watch": "nodemon ./index.js",
        "lint": "eslint .",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
  • Azure Bot=>Configuration=>Message Endpoint
    中添加应用服务端点:

https://<app_name>.azurewebsites.net/api/messages

enter image description here

能够在Azure Bot中测试Web聊天:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.