pliancy / occam

O365 Configuration Compliance Audit Manager
https://github.com/pliancy/occam
MIT License
32 stars 6 forks source link

Exception Error failing to aquire token #4

Open scythe000 opened 3 years ago

scythe000 commented 3 years ago

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.b1(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.d20.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.d6.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.d4.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.d11.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.d8.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.d13.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.d2.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


Ber`

zenion commented 3 years ago

Thanks @scythe000 ! We're looking into it!

CalebAlbers commented 3 years ago

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

scythe000 commented 3 years ago

Looks like I’m on Win10 Pro 20H2 build 19042.804.

Powershell: Major Minor Build Revision


5 1 19041 610

From: Caleb Albers notifications@github.com Sent: Thursday, February 18, 2021 3:20 PM To: pliancy/occam occam@noreply.github.com Cc: Kenneth May kenmay@kenmay.net; Mention mention@noreply.github.com Subject: Re: [pliancy/occam] Exception Error failing to aquire token (#4)

Hey @scythe000https://github.com/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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/pliancy/occam/issues/4#issuecomment-781699598, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAOQ7CTISZFTCDIAQLLNNS3S7WODJANCNFSM4X3CZKJQ.

CalebAlbers commented 3 years ago

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 commented 3 years ago

I just tested it, it seemed to connect ok even with MFA via Powershell for me.

From: Caleb Albers notifications@github.com Sent: Tuesday, February 23, 2021 10:16 PM To: pliancy/occam occam@noreply.github.com Cc: Kenneth May kenmay@kenmay.net; Mention mention@noreply.github.com Subject: Re: [pliancy/occam] Exception Error failing to aquire token (#4)

Hey @scythe000https://github.com/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?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/pliancy/occam/issues/4#issuecomment-784817527, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAOQ7CTGYV2WCX7N4LAHPFLTASKTVANCNFSM4X3CZKJQ.

ThaMc commented 2 years ago

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 .