-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Authenticating to Teams (400) Bad Request #186
Comments
I took another run at this starting from scratch and still hit the same error as above. |
Hi @alexixiv you may have some issues with your config. Import-Module PoshBot
$pbc = New-PoshBotConfiguration
$pbc.BotAdmins = @('<AAD-USER-PRINCIPAL-NAME>')
$backendConfig = @{
Name = 'TeamsBackend'
BotName = '<BOT-NAME>'
TeamId = '<TEAMS-ID>'
ServiceBusNamespace = '<SERVICE-BUS-NAMESPACE-NAME>'
QueueName = 'messages'
AccessKeyName = 'receive'
AccessKey = '<SAS-KEY>' | ConvertTo-SecureString -AsPlainText -Force
Credential = [pscredential]::new(
'<BOT-APP-ID>',
('<BOT-APP-PASSWORD>' | ConvertTo-SecureString -AsPlainText -Force)
)
}
$backend = New-PoshBotTeamsBackend -Configuration $backendConfig
$bot = New-PoshBotInstance -Configuration $pbc -Backend $backend
$bot | Start-PoshBot -Verbose Few things worth mentioning:
|
@brettmillerb , Thanks for the tips. I tried what you said. The two places that seemed like they needed corrections were the BotAdmins and the Bot App Password. The App ID seems correct, but I did go ahead and try the App ID found in the Azure portal as well, which still didnt work. I am getting the same error as before. Any other suggestions... I very much want this to work. |
@alexixiv The only other thing to check would be the Bot configuration in Azure Bot Service. Did you add the teams channel for your bot? Open your bot in azure bot service and click on channels from the pane and add teams there. Never seen a failure when starting the bot before like that. |
If it's anything like mine you setup the bot in azure framework to be single tenant. And this causes it to be screwy and give the 400 error. Make a new bot and set to be multi-tenant. That's what fixed it for me. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
+1 to this solution, finally solved this error for me. |
Expected Behavior
Bot launches without error.
Current Behavior
Error occurs "Error Authenticating to Teams... (400) Bad Request"
Possible Solution
I need to adjust my settings somewhere
Steps to Reproduce (for bugs)
I attempted to follow the steps in the documentation for setting up MS Teams PoshBot. I feel I followed all the steps correctly but I am not sure where to look to address this issue. If I had to make a guess at what is happening I would think my credentials in the backend configuration variables I put in are not correct. I have numbered the fields in the screen shot to indicate what step from the document I generated the corresponding value from:
Generated from section titled "Determine Your Teams ID"
Generated from the section titled "Service Bus", I used just the key which ends in =
For this one I was not sure which one to use so I tried both the keys from section "Create a Bot in Bot Framework" and the App ID from App Studio.
Generated from the section "Create a Bot in Bot Framework" but the steps were different as it redirected to azure portal, and I ended up created a key in the "Certificates and secrets" panel.
Context
This is my first time attempting to get this working for MS Teams. I am running Powershell ISE as admin and including "Set-ExecutionPolicy Unrestricted" just to get around any potential local permissions issues.
Your Environment
The text was updated successfully, but these errors were encountered: