Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Error failing to aquire token #4

Open
scythe000 opened this issue Feb 18, 2021 · 6 comments
Open

Exception Error failing to aquire token #4

scythe000 opened this issue Feb 18, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@scythe000
Copy link

I just installed, and ran invoke-occam. it asked for my CSP email, then prompted me to pick a client. once picked, I got this error:

`Error Acquiring Token: System.Threading.ThreadStateException: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. at System.Windows.Forms.WebBrowserBase..ctor(String clsidString) at System.Windows.Forms.WebBrowser..ctor() at Microsoft.Identity.Client.Platforms.net45.WindowsFormsWebAuthenticationDialogBase..ctor(Object ownerWindow) at Microsoft.Identity.Client.Platforms.net45.WindowsFormsWebAuthenticationDialog..ctor(Object ownerWindow) at Microsoft.Identity.Client.Platforms.net45.InteractiveWebUI.OnAuthenticate() at Microsoft.Identity.Client.Platforms.net45.WebUI.<>c__DisplayClass20_0.b__1(Object tcs) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Platforms.net45.WebUI.d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Exchange.Management.AdminApiProvider.Authentication.MSALTokenProvider.d__22.MoveNext()
WARNING: Failed to connect to Tenant REDACTED, skipping audit
Name BlockBasicAuthDefaultPolicy BlockBasicAuthAllPolicies ImapDisabled PopDisabled UnifiedAuditLogg
ing
Select-Object : Property "Nam" cannot be found.
At C:\Program Files\WindowsPowerShell\Modules\occam\1.1.0\Internal\Write-PSObject.ps1:786 char:40

  • ... $values[$i] = $oLine | Select-Object -ExpandProperty $col;
  •                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (@{Name=REDACTED ...dAuditLogging=}:PSObject) [Select-Object], PSArgumen
      tException
    • FullyQualifiedErrorId : ExpandPropertyNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand

Ber`

@zenion
Copy link

zenion commented Feb 18, 2021

Thanks @scythe000 ! We're looking into it!

@CalebAlbers
Copy link
Contributor

Hey @scythe000! Thanks for reaching out.

Did this error come when you selected the client in the list, or when you clicked on the "OK" button?

Do you mind sending over what version of Windows you are using, along with what the current PowerShell version is (it can be found via running $PSVersionTable.PSVersion)?

I'll try to recreate it on my end and get a resolution to this

@CalebAlbers CalebAlbers self-assigned this Feb 18, 2021
@CalebAlbers CalebAlbers added the bug Something isn't working label Feb 18, 2021
@scythe000
Copy link
Author

scythe000 commented Feb 18, 2021 via email

@CalebAlbers
Copy link
Contributor

Hey @scythe000 I just wanted to check in and say that I haven't forgotten about you. I'm not able to recreate the issue on my end, so I'm working on doing some more digging.

Although the error logging is pretty obtuse, it appears that Microsoft's Connect-ExchangeOnline cmdlet is what is causing the error, as the WARNING: Failed to connect to Tenant REDACTED, skipping audit error message is one we added specifically when that function fails.

Can you confirm if you have been able to use the Connect-ExchangeOnline cmdlet that Microsoft provides on the tenant in question outside of OCCAM?

@scythe000
Copy link
Author

scythe000 commented Feb 25, 2021 via email

@ThaMc
Copy link

ThaMc commented Jan 14, 2022

Yes, I know I am late to the party. This is an issue with EXO module > 2.0.3, as I found out. If you add the assemblies System.Windows.Forms and/or(?) System.Drawing, draw an object and then call Connect-ExchangeOnline, this is exactly what happens. Stepping down to the module version 2.0.3 removes the issue. Using a simple PS-script I was able to reliably reproduce the issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants