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

[BUG] Conflict between Microsoft.Graph and PnP.PowerShell Modules in VsCode PowerShell Extension #4476

Closed
1 of 6 tasks
IoannisGianko opened this issue Oct 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@IoannisGianko
Copy link

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?

I had opened a ticket #5069 with the PowerShell VsCode extension and they advised to raise it with PnP.PowerShell saying that there are multiple known issues with their ALC implementation.
Related: #3510

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

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Visuals

mggraphnotworkingwithpnp18

@gautamdsheth
Copy link
Collaborator

Closing as it is duplicate/similar to this issue. We don't have a solution for this right now.
Would suggest not using Graph module in the same session as PnP PowerShell to avoid this.

#3637

@gautamdsheth gautamdsheth closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2024
@IoannisGianko
Copy link
Author

Hi @gautamdsheth, I'm not using PnP PowerShell at all, and it is still doing this.
As mentioned above, all you have to do to replicate this is to have PnP PowerShell installed

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

2 participants