-
Notifications
You must be signed in to change notification settings - Fork 282
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
UserAssignedIdentity(WorkloadIdentity) auth fails with 'scope https://api.botframework.com is not valid' #4582
Comments
Hi @patst, we couldn't reproduce the error using a UserAssignedMSI bot deployed in an Azure App Service. |
@ceciliaavila thanks for your message. I created a little example app to reproduce the error. See the repository at https://github.com/patst/botbuilder-js-4582 I added some kubernetes manifests in the Hope that helps I think the main difference is the ManagedIdentity Credentials (used in the AppService) call the IMDB endpoint at |
I @patst, thanks for the information. We managed to deploy the application in the cluster and enable workload identity, but we are struggling to create the ingress and the service to access the bot. Do you have the steps or the manifests for this? |
hey @ceciliaavila , thanks for working on it. I added a ingress and service definition to the example repository. I addition to that, you will need a valid TLS certificate for the ingress. You could use certmanager for that. |
Hi @patst, thanks for all your help, we were finally able to reproduce the error. We'll be reviewing the fix you proposed. |
…scope https://api.botframework.com is not valid' (#4607) * Add scope post-fix in managedIdentityAuthenticator. * Fix unit test
…scope https://api.botframework.com is not valid' (#4607) * Add scope post-fix in managedIdentityAuthenticator. * Fix unit test
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.I am using the botbuilder with the msteams connector. My configuration uses a UserAssignedMSI and the botframeworkauthentication is configured like this:
I use it in conjunction with Azure Workload Identity and my bot is running inside a Pod deployed in AKS.
I get an error when a response should be returned to the bot service: (while fetching the token)
The correct scope would be
https://api.botframework.com/.default
I spend some debugging and found a diff comparing the UserAssignedMSI vs the SingleTenant code branch.
Single Tenant version:
botbuilder-js/libraries/botbuilder-core/src/configurationServiceClientCredentialFactory.ts
Lines 97 to 130 in f3db3e9
If you drill further down it is clear that the
audience
is taken as input and then used asscope
in the oauth flows.This only works, if
/.default
is appended to the scope.For the single tenant version this is done in the
msalAppCredentials
class:botbuilder-js/libraries/botframework-connector/src/auth/msalAppCredentials.ts
Lines 108 to 112 in f3db3e9
In the UserAssignedMSI version the scope is taken without any further modification:
botbuilder-js/libraries/botframework-connector/src/auth/managedIdentityAppCredentials.ts
Line 37 in f3db3e9
In order to use the same logic like in the SingleTenant version here is the diff that solved my problem:
This issue body was partially generated by patch-package.
What do you think? If you agree I can prepare an pull request for the change
The text was updated successfully, but these errors were encountered: