r/PowerShell • u/Arrager • Jul 25 '24
Microsoft Graph and PnP.Powershell conflicts
Hey guys, I recently updated Microsoft Graph from 2.19.0 to 2.20.0 and this broke all Graph commands (except Connect-MgGraph). But not PnP.Powershell commands.
Specifically this is the error I get anytime I try to run a Graph command:
Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25
I noticed that PnP.Powershell has a graph.core.dll file and it's version 1.25.1, while the Graph module has version 3.0.x (forgot the actual number). Is that the cause? If so, how do I fix it? Should I just force install Graph 2.19.0? I need both modules in the same session to work like they were.
Note: This is only in VS Code. Opening a PS7 window by itself works fine (only when run as admin). But I've been using Graph and PnP next to each other for over a year with no issue. This only happened when I updated the module.
6
u/BlackV Jul 25 '24 edited Jul 25 '24
This is why version pinning in your production scripts is important
For graph/pnp/az you'll get lots of conflicts as their teams all update their modules at separate times
Personally for this batch I've stayed at 2.19.0 due to the issues with assemblies
If you're an animal ;) you could copy the conflicting assembly from one module to another over writing the old one, but that's a last resort type action
1
u/ITGuyThrow07 Jul 26 '24
Do you also run the ExchangeOnlineManagement module? the EOM 3.5.0 module broke Graph for me with I think that exact same error. Downgrading EOM to 3.4.0 fixed it for me. There's github bug report out there somewhere for it.
1
u/titidev75 Sep 24 '25
Hi OP, I now, i'm a bit late lol but i've found a solution today
Source : https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2285