Forum Discussion
PhoneMe007
Mar 24, 2021Brass Contributor
Authenticating with an access token Connect-MicrosoftTeams
Has anyone tried authenticating with an access token (using -AadAccessToken or -MsAccessToken)? The old version of New-CsOnlineSession had an -OAuthAccessToken param, which accepted a jwt with the PS ...
- 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
SjoerdV
Iron Contributor
Update: Still no improvement on the App Only (Unattended) front in the latest MicrosoftTeams 3.0.0. module. The only reported working method is by using Delegate permissions as stated in the Docs under 'AccessTokens' parameter directions.
If someone has an ETA on setting CS policies in an unattended (or dare I say DSC manner), please post here
nikolasx
Dec 14, 2021Copper Contributor
https://github.com/MicrosoftDocs/office-docs-powershell/issues/8623#issuecomment-993611923
This was just posted in a Github issue. Apparently Microsoft is aware of the issue and the ETA is March 2022.
This was just posted in a Github issue. Apparently Microsoft is aware of the issue and the ETA is March 2022.
- Iulian_SimonnFeb 09, 2022Copper ContributorHi everyone, I just tested the new PS Teams module 3.1.1. I still get the same error (Connect-MicrosoftTeams : Object reference not set to an instance of an object.),
I hope they will fix it on March...- nikolasxFeb 23, 2022Copper ContributorThe same issue still exists on preview version 3.2.
- doreladamFeb 10, 2022Copper Contributor
After creating an App Registration in Azure Active Directory with permissions like this:
I'm able to connect to Teams using:
$tenantName = "" $clientId = "" $clientSecret = "" $username = "" $password = "" $uri = "https://login.microsoftonline.com/$tenantName/oauth2/v2.0/token" $body = @{ Grant_Type = "password"; Scope = "https://graph.microsoft.com/.default" Client_Id = $clientId; Client_Secret = $clientSecret; Username = $username; Password = $password; } $graphTokenResponse = Invoke-RestMethod -Method POST -Uri $uri -Body $body $graphToken = $graphTokenResponse.access_token $body = @{ Grant_Type = "password" # client_credentials Scope = "48ac35b8-9aa8-4d74-927d-1f4a14a0b239/.default" Client_Id = $clientId Client_Secret = $clientSecret Username = $username Password = $password } $teamsTokenResponse = Invoke-RestMethod -Method POST -Uri $uri -Body $body $teamsToken = $teamsTokenResponse.access_token Connect-MicrosoftTeams -AccessTokens @($graphToken, $teamsToken) Get-CsCallQueue Disconnect-MicrosoftTeams
But the Get-CsCallQueue call fails with:
- nikolasxFeb 23, 2022Copper ContributorLooks like this is ROPC flow, not client credentials flow.
The most likely cause of the error is that the module is searching for the "UPN" value of the token i.e. the user name. Authorization flow works because it's done in the context of a user and therefore the token has a UPN. Client credentials does not work because there is no user context and no UPN.