Forum Discussion
jasonbrl
Jul 08, 2022Copper Contributor
AccessToken issue with Connect-MicrosoftTeams
Hi,
We're encountering this error when we do Connect-MicrosoftTeams using access tokens.
Here's our scenario:
Given:
- Guest user from another Azure tenant that's given admin permissions
- App registration with secret and UPN optional claim.
Steps:
- Login to a tenant with the guest user. Were logging in using Azure React MSAL library.
- We're able to get a token with the UPN claim for this guest user. At this point we're storing the id_token which we submit to our backend where we get Graph and Teams tokens.
- Retrieve Graph and Teams tokens for Connect-MicrosoftTeams to use. Here are the parameters we used to get Graph token:
- Once we get the Graph and Teams token, then we use `Connect-MicrosoftTeams -AccessTokens (..)`. However this would return the error above.
We're not entirely sure but our guess was due to missing UPN claims from the Graph/Teams tokens. If we do the same steps above with a user from within our tenant, then it would complete properly. It only happens when we use a guest user with admin privileges.
Any ideas or suggestions would be greatly appreciated!
Cheers,
Jason
8 Replies
Sort By
- Sayali-MSFT
Microsoft
jasonbrl - Could you please try out with the following command-
Connect-MicrosoftTeams -AccessTokens @($graphtoken, $teamstoken) -AccountId User@company.com
- Sayali-MSFT
Microsoft
jasonbrl - Did you get chance to check above suggestion?- jasonbrlCopper Contributor
Hi Sayali-MSFT , thanks for the suggestion. However when I tried the command, I was getting this error
- Sayali-MSFT
Microsoft
jasonbrl- We are looking into this I will get back to you soon.