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