An Azure service that provides an integrated environment for bot development.
Error sending error message: Operation returned an invalid status code 'Unauthorized'
I am encountering a persistent Unauthorized error when my Python-based Azure Functions bot tries to send a message back to the user. I have already performed extensive troubleshooting and have verified that the issue is not with the bot's credentials or the presence of the Bot Framework service principal.
Here is a summary of my setup and the steps I've taken:
1. Bot Configuration & Code:
- I am using an Azure Function App with an HTTP trigger.
The bot is built using botbuilder-core version 4.14.0.
The error occurs specifically on the await turn_context.send_activity() line.
2. Credentials & Service Principal Verification:
My MicrosoftAppId and MicrosoftAppPassword are configured as Application Settings in my Azure Function's Configuration.
I have confirmed these values are an exact match for my bot's App Registration.
I have used curl to manually obtain a token with these credentials. The request was successful, returning a valid access token.
I have verified that the Bot Framework Dev Portal service principal exists in my tenant. The az ad sp list command shows its presence by servicePrincipalName, even though the displayName filter initially returned no results.
3. The Problem: Despite all of this, my bot consistently throws an ErrorResponseException: Operation returned an invalid status code 'Unauthorized'. The stack trace shows the error originating from the botframework/connector library when it attempts to call the conversations.send_to_conversation API. This suggests that while my bot can authenticate and get a token, it does not have the required permissions to use that token to send a message.
I have checked the API permissions for my bot's app registration but am unsure which specific permissions are needed for the Bot Framework Dev Portal API to resolve this issue. The available options appear to be specific internal roles.
Could you please provide guidance on the exact permission required to allow a bot to send messages via the Bot Framework API?I am encountering a persistent Unauthorized error when my Python-based Azure Functions bot tries to send a message back to the user. I have already performed extensive troubleshooting and have verified that the issue is not with the bot's credentials or the presence of the Bot Framework service principal.
Could you please provide guidance on the exact permission required to allow a bot to send messages via the Bot Framework API?
Azure AI Bot Service
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more