1
votes

I'm trying to get the user's consent in the client side using MSAL.js to be able to configure their Microsoft Teams in PowerShell Core.

I get the token successfully, but when i use it inside PowerShell Core with the cmdlet Connect-MicrosoftTeams -Aadaccesstoken -AccountID, the PowerShell prints the Tenant ID as follows, as if i am connected to Microsoft Teams(It doesn't tell me whether i am connected or not).

The Problem is that, when i try to Execute any cmdlet in the MicrosoftTeams Modules, it shows the below error

// When i use the token generated on the Client Side in PowerShell Core

Account Environment Tenant TenantId


"Email is Here" AzureCloud "Tenant_ID_isHere" "Tenant_ID_isHere"

// The error That i get, when i execute any cmdlet Line |

9474 | $steppablePipeline = $scriptCmd.GetSteppablePipeline($myI …

 |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 | Exception calling "GetSteppablePipeline" with "1" argument(s): "Exception calling "GetRemoteNewCsOnlineSession" with "1" argument(s): "Run either Connect-MicrosoftTeams or new-csonlinesession before running

 | cmdlets.""

// Package.json

"@azure/msal-angular": "^1.1.1",
"@microsoft/microsoft-graph-client": "^2.1.0",
"@microsoft/microsoft-graph-types": "^1.24.0"

// My Configuration

export const OAuthSettings = {
appId:'My_App_ID',

  
     redirectUri: 'http://localhost:4200',
     scopes: [
       
"https://graph.microsoft.com/.default"

 ],

prompt : 'consent'
};

The consent Prompt that the user Gets

I don't know what seems to be the issue, and according to my speculations, i think it might be one of the below scenarios

  • The Access Token that gets generated using the MSAL.js can't be used with PowerShell Core cmdlets (-AadAccessToken)
  • I am using the wrong Permission API in my Azure Active Directory
  • PowerShell Core doesn't support this kind of Authentication

Please help me to figure out whether this is possible to do or not, and if so please tell me how to achieve it.

//Microsoft Teams Module Version 2.0.0

//PowerShell Core Version 7.1.2

1
I gave my Application on Azure an API permission which is Directory.AccessAsUser.All, and i was able to login in PowerShell Core using the Connect-MicrosoftTeams -AadAccessToken cmdlets I was able to run commands like Get-Team successfully, but i can't execute all cmdlets though. Is there any way that i can grant access to be able to execute cmdlet like Get-CsOnlinePSTNGateway ?Sa3d94
Hi @Sa3d94, Sorry for the delayed response. We are working on it practically and checking with our Internal Team so will update the timely progress in one or two business days.Jagadeesh-MSFT

1 Answers

0
votes

Powershell stable version 7.1.3 is available. Could you please upgrade then test and share the results.

For available Teams cmdlets you can search in the teams version File list. go to this link Go to package details. search the cmdlet.