Microsoft Azure Bot Framework - Can bots with User Managed Identities be tested with "Test in Web Chat"?

93 views Asked by At

I'm trying out the Azure bot Framework with the javascript SDK. I've tried setting up a bot using a User-Assigned Managed Identity.

I've been unable to get past an error "Http Status Not Found".

There's a GitHub issue, https://github.com/microsoft/BotFramework-Emulator/issues/2377, which says that User-Assigned Managed Identities cannot be tested using the bot Emulator software.

Can bots with User-Assigned Managed Identities be tested with the Azure Portal's "Test in Web Chat"? Or does the limitation in the github issue apply to testing in the web chat too?

1

There are 1 answers

0
Pravallika KV On BEST ANSWER

Can bots with User Managed Identities be tested with "Test in Web Chat"?

Yes, it is possible to Test the bots created with User Managed Identity with "Test in Web Chat".

I have followed MSDOC and created a JavaScript Azure Bot.

Local Response:

enter image description here

  • Create an Azure Bot with User-Assigned Managed Identity and an Azure App Service.

Link the Bot with App Service:

  • Go to App Service and select the App Service plan=>Apps=>select your App Service=>Go to Identity=>User Assigned Identity=>Add=>Select your Bot Identity:

enter image description here

  • Click on the added Bot Identity=>Properties, you'll be able to see Tenant ID, client ID and Bot Type. Copy them to use in code.

enter image description here

  • Modified the code as shown below:

.env:

  • Update below values in .env file(no need of MicrosoftPassword):
MicrosoftAppType=UserAssignedMSI
MicrosoftAppId=<Client_ID>
MicrosoftAppTenantId=<Tenant_ID>

Change Start command in Scripts section in Package.json as shown below:

Package.Json:

 "scripts": {
        "start": "npm start",
        "watch": "nodemon ./index.js",
        "lint": "eslint .",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
  • Add the App Service endpoint in Azure Bot=>Configuration=>Message Endpoint:

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

enter image description here

Able to Test Web Chat in Azure Bot:

enter image description here