Jump to content

Conect to Exchange Online module error - VSCode


Recommended Posts

Posted

hello, since moving to Powershell 7 and VSCode I can not connect to the ExchangeOnline module (or the 365 Security Compliance Center). Other modules (Azure, Teams, SharePoint) seem OK. Running the same commands in Powershell 5 work OK. I have the latest VSCode. Can anyone advise why the 'OperationStopped: Could not load type 'Microsoft.Identity...'error is coming up?

 

Thanks

 

 


PS C:\> Get-Module -ListAvailable -Name ExchangeOnlineManagement

   Directory: C:\Users\PBJStaff\OneDrive - School\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     3.5.1                 ExchangeOnlineManagement            Desk      {Add-VivaModuleFeaturePolicy, Get-ConnectionInformation, Get-DefaultTenantBriefingConfig, Get-DefaultTenantMyAnalyticsFeatureConfig…}

PS C:\> Connect-ExchangeOnline

[b]OperationStopped: Could not load type 'Microsoft.Identity.Client.BaseAbstractAcquireTokenParameterBuilder`1' from assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'.[/b]

Posted

I'm not sure if it's still the same issue but it used to be an issue with one of the VSCode powershell extensions - Disabling it then allowed it to run

 

Might be worth a check if you still have any set on by default

 

Steve

Posted

From some things I have read, go into the extensions list of VSCode and disable extensions until it works. Some have said it is the PowerShell ISE, others have said it is the PowerShell extension.

An extension is trying to use a version of Microsoft.Identity.Client that Exchange Online does not like.

Posted

Just for reference - https://github.com/pnp/powershell/discussions/1814 - looks like it's still broken

 

KoenZomers commented on Dec 17, 2021

We have discussed this, but turns out its very complex to resolve, if possible at all. In all honesty, with everything we have open and the limited resources we have contributing to the code at the moment, I would not count on this to be fixed soon if at all.

 

You can use a regular pwsh terminal in VS Code, just not the "Extension Terminal." Click the + button to spawn a new terminal in the pane.

 

Haven't got it installed anymore but I'm sure there was an option to switch to normal PS terminal rather than the extension in the bottom right

 

Steve

Posted
The connection works fine from the vscode built-in pwsh terminal (extension disabled), but unless I misunderstand this would not allow me to run blocks of PS script?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...