Aug 30 2021 02:35 PM - edited Aug 30 2021 11:52 PM
I'm trying to create online meetings using Microsoft Graph API, but it is not working as expected. The cmdlet Connect-MicrosoftTeams with an MFA enabled account seems to work fine. It outputs:
Account | Environment | Tenant | TenantId
<MY-ACCOUNT> | AzureCloud | <TENANT> | <TENANTID>
However, when I run the command to create an application access policy:
New-CsApplicationAccessPolicy -Identity Test-policy -AppIds "<MY-APP-ID>" -Description "Test policy"
I get the following error:
Get-CsOnlineSession: C:\Users\fadc8\OneDrive\Documentos\PowerShell\Modules\MicrosoftTeams\2.5.0\netcoreapp3.1\SfBORemotePowershellModule.psm1:273
Line |
273 | $remoteSession = (Get-CsOnlineSessionCommand)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Run Connect-MicrosoftTeams before running cmdlets.
Invoke-Command: C:\Users\fadc8\OneDrive\Documentos\PowerShell\Modules\MicrosoftTeams\2.5.0\netcoreapp3.1\SfBORemotePowershellModule.psm1:113
Line |
113 | -Session $session `
| ~~~~~~~~
| Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument
| that is not null or empty, and then try the command again.
I found the source script:
https://www.powershellgallery.com/packages/MicrosoftTeams/2.5.0/Content/net472%5CSfBORemotePowershel...
It is looking for an implicit remote session...
I don't know if it is relevant, but the MSA I'm using has Global Administator privillege.
Could you help me to understand what is wrong?
Workstation configuration:
Windows 10
PowerShell 7.1.4
PowerShellGet 2.2.5
MicrosoftTeams 2.5.0
Aug 30 2021 04:30 PM
Aug 31 2021 12:25 AM
Aug 31 2021 07:17 AM - edited Aug 31 2021 07:28 AM
@fadc80 -
I tried doing this and faced no issue,
Try again by doing Disconnect-MicrosoftTeams and closing PowerShell.
Below is what I tried
> Import-Module MicrosoftTeams
> $credential = Get-Credential
PowerShell credential request
Enter your credentials.
User: user@example.com
Password for user user@example.com: **********
> Connect-MicrosoftTeams -Credential $credential
> New-CsApplicationAccessPolicy -Identity Test-policy -AppIds "ca2e3d70-0000-0000-ae13-124f30000006" -Description "Test policy"
Identity : Tag:Test-policy
AppIds : {ca2e3d70-0000-0000-ae13-124f30000006}
Description : Test policy
Could you please try doing this way once?
It worked on:
Windows 10
PowerShell 7.1.4
MicrosoftTeams 2.5.0
Thanks,
Hunaid Hanfee
--------------------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
Aug 31 2021 06:49 PM - edited Aug 31 2021 07:05 PM
SolutionHi Hunaid, thank you. Following your suggestion I got this error:
Connect-MicrosoftTeams: One or more errors occurred. (ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details. )
Connect-MicrosoftTeams: ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details.
Connect-MicrosoftTeams: One or more errors occurred. (ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details. )
I was using my MSA, then I tried with an Office 365 dev tenant account and even my initial approach worked like a charm.
The documentation is not clear about that. It states only permission type Delegated (personal microsoft account) is not supported, but I was using permission type Application along with my MSA.
Aug 31 2021 06:49 PM - edited Aug 31 2021 07:05 PM
SolutionHi Hunaid, thank you. Following your suggestion I got this error:
Connect-MicrosoftTeams: One or more errors occurred. (ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details. )
Connect-MicrosoftTeams: ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details.
Connect-MicrosoftTeams: One or more errors occurred. (ROPC does not support MSA accounts. See https://aka.ms/msal-net-ropc for details. )
I was using my MSA, then I tried with an Office 365 dev tenant account and even my initial approach worked like a charm.
The documentation is not clear about that. It states only permission type Delegated (personal microsoft account) is not supported, but I was using permission type Application along with my MSA.