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

Conflict between Microsoft.Graph and PnP.PowerShell Modules in PowerShell Extension #5069

Closed
6 tasks done
IoannisGianko opened this issue Oct 24, 2024 · 3 comments
Closed
6 tasks done
Labels
Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed!

Comments

@IoannisGianko
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

I'm encountering an issue when using the Microsoft.Graph PowerShell module in combination with the PnP.PowerShell module while connecting via a certificate. The issue only occurs within the PowerShell Extension terminal in VSCode.

Expected Behavior:
The command should execute successfully without any errors.

Actual Behavior:
After connecting, any attempt to run a MgGraph command results in the following error:
Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Notes:

  • The issue does not occur if the PnP.PowerShell module is uninstalled or downgraded to version 2.2.0.
  • The issue is only present when using the PowerShell Extension terminal in VSCode. Opening a standard PowerShell terminal within VSCode does not produce the error.
  • I have tested this across multiple machines, and the issue persists.
  • Installing PnP.PowerShell v2.2.0 resolves the issue.
  • Opening a standard PowerShell Core Terminal, outside of VsCode, does not produce the error.

Is there a known incompatibility between these two modules in the PowerShell Extension, or any workarounds besides downgrading the PnP.PowerShell module?

PowerShell Version

PS C:\Windows\System32> $psversionTable; $Host

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

Name             : ConsoleHost
Version          : 7.4.5
InstanceId       : e369b882-204a-431a-831e-136dd13cafce
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-GB
CurrentUICulture : en-GB
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

PS C:\Windows\System32> code --version
1.94.2
384ff7382de624fb94dbaf6da11977bba1ecd427
x64

Extension Version

PS C:\Windows\System32> code --list-extensions --show-versions | Select-String powershell

ms-vscode.←[7mpowershell←[[email protected]

Steps to Reproduce

  1. Install the Microsoft.Graph PowerShell module.
  2. Install the PnP.PowerShell module (any version newer than v2.2.0).
  3. Open the PowerShell Extension terminal in VSCode.
  4. Run the following command to connect to Microsoft Graph:
    Connect-MgGraph -ClientId $clientID -TenantId $tenantID -CertificateThumbprint $thumbPrint
  5. After connecting, attempt to run any MgGraph command.
    Get-MgOrganization

Visuals

mggraphnotworkingwithpnp18

Logs

No response

@IoannisGianko IoannisGianko added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Oct 24, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@andyleejordan
Copy link
Member

Please open an issue with PnP.PowerShell. There are multiple known issues with their ALC implementation: #3510

@IoannisGianko
Copy link
Author

Thank you @andyleejordan, I've just raised it #4476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed!
Projects
None yet
Development

No branches or pull requests

2 participants