PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 491 forks source link

If Connecting to MSGraph then connecting to ExchangeOnline, error OperationStopped: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.44.0.0. #4982

Open chrisclosacr opened 6 months ago

chrisclosacr commented 6 months ago

Prerequisites

Summary

I get the following error when trying to Connect-ExchangeOnline after doing a Connect-MgGraph. This Only happens in the Powershell Extension, I'm able to use this with pwsh.exe directly or MS Terminal without the error:

OperationStopped: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.44.0.0, Culture=neutral, PublicKeyToken='.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : Visual Studio Code Host
Version          : 2024.2.1
InstanceId       : be24d740-2125-4bf7-aa9b-5633feaa8977
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

1.88.1
e170252f762678dec6ca2cc69aba1570769a5d39
x64

Extension Version

adamwojcikit.pnp-powershell-extension@2.12.21
ms-vscode.powershell@2024.2.1
tobysmith568.run-in-powershell@1.2.0

Steps to Reproduce

Connect-MgGraph -Scopes 'User.Read.All' Connect-ExchangeOnline

Visuals

20240426-PSError-ConnectExchangeOnline-stepsrecording.zip

Logs

No response

SydneyhSmith commented 6 months ago

@chrisclosacr do you have any other modules loaded? gmo

chrisclosacr commented 6 months ago

Just a fresh launch in the PS Extension: Get-Module

ModuleType Version PreRelease Name ExportedCommands


Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…} Manifest 7.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature…} Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…} Script 0.2.0 PowerShellEditorServices.Commands {Clear-Host, ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent, Find-Ast…} Script 2.4.0 beta0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

Chris Clos IT Infrastructure Architect, Cloud Services 100 Ottawa Ave Sw Grand Rapids, MI, 49503 Email: @.*** Phone: 6165411323 This email, including any attachments or subsequent replies thereto or forwards thereof, (a) may include confidential, proprietary or other protected information; (b) is sent based upon a reasonable expectation of privacy; and (c) is not intended for unauthorized persons. If you are not the intended recipient of this email, you must not use, disclose or disseminate it or any information contained herein, including attachments. If you are not the intended recipient of this email, please immediately notify its sender and permanently delete it, including any attachments or replies thereto or any forwards, copies or portions thereof. Any unauthorized review, use, disclosure or distribution of this email is prohibited and may be a violation of law or regulation. It is the responsibility of the recipient of this email to take steps to protect against viruses and to ensure that this email (and any attachments hereto) does not adversely affect any computer system into which it is received or in which it is opened.


From: Sydney Smith @.> Sent: Tuesday, May 7, 2024 2:14 PM To: PowerShell/vscode-powershell @.> Cc: Chris Clos @.>; Mention @.> Subject: Re: [PowerShell/vscode-powershell] If Connecting to MSGraph then connecting to ExchangeOnline, error OperationStopped: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.44.0.0. (Issue #4982)

@chrisclosacrhttps://github.com/chrisclosacr do you have any other modules loaded? gmo

— Reply to this email directly, view it on GitHubhttps://github.com/PowerShell/vscode-powershell/issues/4982#issuecomment-2099031369, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2BLM5GYYO2S4ITSCFWGHHTZBEKZ7AVCNFSM6AAAAABG2WGC2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGAZTCMZWHE. You are receiving this because you were mentioned.Message ID: @.***>

SydneyhSmith commented 6 months ago

Thanks @chrisclosacr might be due to the way PSSA loads modules in the editor

jonwbstr commented 4 months ago

I Just hit this error too

pawn-runner commented 3 months ago

I also just got the same problem. The error only occurs in the Visual Studio Code PowerShell extension and not in any other PowerShell terminals.

PSVersion: 7.4.3 MSGraph Version: 2.20.0