Notice
Describe the bug
When loading the latest versions of PnP.PowerShell and Graph and running any Graph query, we get the following error
Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core
To Reproduce
Steps to reproduce the behavior:
- Import-module pnp.PowerShell
- Connect-mggraph
- Note error
Connect-MgGraph: InteractiveBrowserCredential authentication failed: Could not load type 'Microsoft.Identity.Client.BaseAbstractApplicationBuilder'1' from assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyToken
Load graph first
- Connect-MgGraph
- Connect
Expected behavior
Expect both modules to be able to work together
Debug Output
Get-MgUser -UserId [email protected] -Debug
DEBUG: [CmdletBeginProcessing]: - Get-MgUser begin processing with parameterSet 'Get'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, Directory.ReadWrite.All, Group.Read.All, Group.ReadWrite.All, MailboxSettings.Read, openid, Organization.Read.All, profile, Team.Create, Team.ReadBasic.All, TeamMember.ReadWrite.All, TeamsActivity.Read, User.Read, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, email].
DEBUG: [CmdletException]: Received exception with message 'TypeLoadException - Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. : at Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient()
at Microsoft.Graph.PowerShell.Module.BeforeCreatePipeline(InvocationInfo invocationInfo, HttpPipeline& pipeline)
at Microsoft.Graph.PowerShell.Module.CreatePipeline(InvocationInfo invocationInfo, String parameterSetName)
at Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_Get.ProcessRecordAsync()'
Get-MgUser_Get: Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
DEBUG: [CmdletEndProcessing]: - Get-MgUser end processing.
Module Version
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 2.15.0 Microsoft.Graph.Authentication Core,Desk {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest…}
Manifest 2.4.0 PnP.PowerShell {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAvailableSiteClassification…}
Environment Data
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional context
Also reporting the same bug in MSGraph just in case.
Workaround
Using the latest modules
Connect-MgGraph
Perform graph command
Connect-PnPOnline
Commands from both modules seem to work after this
Doesn't seem to impact PnP.PowerShell 1.12.0 on PS 5.1. We have an older automation server that doesn't work well with PS7 and Active Directory modules
Notice
Describe the bug
When loading the latest versions of PnP.PowerShell and Graph and running any Graph query, we get the following error
Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core
To Reproduce
Steps to reproduce the behavior:
Connect-MgGraph: InteractiveBrowserCredential authentication failed: Could not load type 'Microsoft.Identity.Client.BaseAbstractApplicationBuilder'1' from assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyTokenLoad graph first
Expected behavior
Expect both modules to be able to work together
Debug Output
Module Version
Environment Data
Additional context
Also reporting the same bug in MSGraph just in case.
Workaround
Using the latest modules
Connect-MgGraph
Perform graph command
Connect-PnPOnline
Commands from both modules seem to work after this
Doesn't seem to impact PnP.PowerShell 1.12.0 on PS 5.1. We have an older automation server that doesn't work well with PS7 and Active Directory modules