Atreidae / BounShell

Its BounSky, but for Office365 PowerShell
MIT License
3 stars 3 forks source link

Bug connecting to CSOnlineSession #7

Closed Atreidae closed 3 years ago

Atreidae commented 5 years ago

Seems something has changed in the handling of CSOnlineSesson. Passing it a -cred flag now throws errors regarding passwords despite a password being present as a secure string


PS C:\Users\jarber> $pscred

UserName                                                  Password
--------                                                  --------
foo@fabrikam.com.au System.Security.SecureString

PS C:\Users\jarber> New-CsOnlineSession -Credential $pscred
Get-CsAccessToken : AADSTS900144: The request body must contain the following parameter: 'password'.
Trace ID: 099f3fbb-d8b5-4892-9035-8bf3f6963d00
Correlation ID: eb7e218f-5a89-414f-80cd-48a838ffee6d
Timestamp: 2019-04-25 03:35:51Z
At C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:123 char:22
+ ... cessToken = Get-CsAccessToken -UserName $UserName -TargetUri $targetU ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-CsAccessToken], AdalServiceException
    + FullyQualifiedErrorId : Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException,Microsoft.Rtc.Management.OnlineConnector.GetAccessToken
Atreidae commented 5 years ago

This might be related Modern auth.. further investigating needed.

Atreidae commented 3 years ago

This is caused by the previous module deleting the Password value. setting the variable to 'read only' fixes this

($global:StoredPsCred).Password.MakeReadOnly() #Stop modules deleteing the variable.

The fix for this was implemented in 0.7

DEberhardt commented 3 years ago

FYI, New-CsOnlineSession is dead with MicrosoftTeams v2.0.0 (function dropped out of the module) The replacement is Connect-MicrosoftTeams - creating a PSsession now "in stealth" when you run the first Skype Command :)

Atreidae commented 3 years ago

Yep! I need to rewrite a fair chunk to support the new module and it's new auth methods.

I'm half way through the WPF conversion bit something else is consuming my time right now. You will get to see it soon