Forum Discussion
Authenticating with an access token Connect-MicrosoftTeams
- Oct 15, 2021FYI - I raised a ticket, and it should be fixed by mid november.
Issue description:
Cannot properly run Connect-MicrosoftTeams -AccessTokens
Resolution Steps:
Escalated case with our engineering Team
Issue is known bug and currently being fixed
Expecting a fix to go out by NOV mid
Would you mind sharing your code how you aqire the tokens?
- nikolasxDec 08, 2021Copper Contributor
et01267 Does this mean you're using a user account to authenticate such as in the Resource Owner Password Credentials flow?
I'm trying to set up some automated scripts with the MicrosoftTeams module and they need to run without the context of a user. Normally I would use the Client Credentials flow and application permissions but this doesn't seem possible right now: it reports those two object reference errors. I suspect Connect-MicrosoftTeams depends on the "upn" attribute of the access token which doesn't exist for access tokens generated via Client Credentials flow since that flow doesn't include a user.
I tried to set up ROPC by granting the necessary permissions with admin consent and adding a new user to the Owners of the application and this at least allowed me to run Connect-MicrosoftTeams successfully but then every commandlet returns a 403. I suspect this is because the tenant I'm using requires MFA and according to the documentation that's incompatible with ROPC.
- et01267Dec 08, 2021Brass ContributorThese are delegated permissions. We also use application permissions but not with PowerShell.