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
NMLVS
Oct 01, 2021Brass Contributor
Has anyone successfully got this working yet?
There was a new version released today for MicrosoftTeams, but I still unsuccessful.
I have provided the App the relevant permissions as outlined in the documentation.
Connect-MicrosoftTeams -AccessTokens @($tokenResponse, $teams_tokenResponse) -AccountId $UPN
Connect-MicrosoftTeams : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
There was a new version released today for MicrosoftTeams, but I still unsuccessful.
I have provided the App the relevant permissions as outlined in the documentation.
Connect-MicrosoftTeams -AccessTokens @($tokenResponse, $teams_tokenResponse) -AccountId $UPN
Connect-MicrosoftTeams : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
- NMLVSOct 01, 2021Brass ContributorI got this working by rolling back to an older preview version.
Install-Module -Name MicrosoftTeams -RequiredVersion "2.3.2-preview" -AllowPrerelease -force
Import-Module MicrosoftTeams -RequiredVersion 2.3.2
$ApplicationId = 'xx'
$ApplicationSecret = 'xx'
$TenantID = 'xx'
$UPN = "admin@xx"
$ReqTokenBody = @{
Grant_Type = "client_credentials"
client_Id = $ApplicationId
Client_Secret = $ApplicationSecret
Scope = "https://graph.microsoft.com/.default"
}
$graph_TokenResponse = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$TenantID/oauth2/v2.0/token" -Method POST -Body $ReqTokenBody
$teams_ReqTokenBody = @{
Grant_Type = "client_credentials"
client_Id = $ApplicationId
Client_Secret = $ApplicationSecret
Scope = "48ac35b8-9aa8-4d74-927d-1f4a14a0b239/.default"
}
$teams_TokenResponse = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$TenantID/oauth2/v2.0/token" -Method POST -Body $teams_ReqTokenBody
Connect-MicrosoftTeams -AccessTokens @($graph_tokenResponse.access_token,$teams_tokenResponse.access_token) -AccountId $UPN