0

I am a beginner in Microsoft BOT Development. I am trying to create a BOT Application that sends proactive messages to connected users. I got a GitHub repo source code.

I have already created an app in the Azure portal and used these credentials to the local development environment and use Bot Emulator for connecting the BOT application. Everything works fine in the local environment, I can connect the BOT Emulator with the local development environment. After the deployment (deployment documentation URL) I can't connect the BOT through Emulator it always shows a message, Cannot post activity unauthorized

I already copied the AppID and Password to the '.env' file. This AppID and Password works fine in the local development. Is there any additional configuration needed to connect the BOT after the deployment?

halfer
  • 19,824
  • 17
  • 99
  • 186
Ragesh P Raju
  • 3,879
  • 14
  • 101
  • 136

1 Answers1

0

In the local emulator, it would run without AppID and Password as well unless you are communicating with any external resources e.g. LUIS, QnA service etc.

Make sure that AppID & Password you are supplying are correct by running the below CURL command (replace with your AppId & Secret). If it is correct, you would see the token being generated successfully.

curl -k -X POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token -d "grant_type=client_credentials&client_id=APP_ID&client_secret=APP_PASSWORD&scope=https%3A%2F%2Fapi.botframework.com%2F.default"

https://learn.microsoft.com/en-us/azure/bot-service/bot-service-troubleshoot-authentication-problems?view=azure-bot-service-4.0&tabs=csharp#step-2

If the secret is incorrect, follow this to regenerate.

If the above works fine, and you see the token being generated, and if your Bot code is deployed on Azure, you can also add the Bot AppID and Password in App service configuration. Something like this -

    {
    "name": "MicrosoftAppId",
    "value": "xxxx-xxxx-xxxx-xxxx-xxxx",
    "slotSetting": false
  },
  {
    "name": "MicrosoftAppPassword",
    "value": "xxxx",
    "slotSetting": false
  },

If you are storing Bot secret in Key Vault, you can retrieve from there as well. https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=csharp%2Caadv2#azure-key-vault