-
Notifications
You must be signed in to change notification settings - Fork 364
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] Microsoft.Graph and PnP.PowerShell conflict (Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider') #2285 #3395
Comments
Is it possible that you can upgrade the Microsoft.Graph.Core.dll dependency in your module to v3.x according to the comment microsoftgraph/msgraph-sdk-powershell#2285 (comment) by @peombwa? Thank you for any feedback and further help. |
Bumping this one as i'm experiencing issues because of this as well. |
@duschu - We have no control over the MSGraph module (or Az module). They may be updating / upgrading their dependencies later on, and we can only suggest running the PnP cmdlets in a different thread. If the PnP cmdlets work on their own, there's unfortunately nothing we can do. |
What is the real solution or a good workaround for this? @veronicageek? Running into this error in Azure automation. |
Errr, apparently this method exists: https://pnp.github.io/powershell/cmdlets/Invoke-PnPGraphMethod.html :D |
I worked around this issue by forcing PowerShell to load specific versions of the modules. I hit the issue with an Azure Function and put this in the requirements.psd1:
You will be able to do a similar thing for the Azure Automation account, by making sure the module versions installed in the account are the ones that do not conflict. |
@veronicageek Can you reopen this? This issue is not resolved. |
@veronicageek This bug is clearly not solved, and the cause is not a MSGraph module. As mentioned by duschu the outdated Microsoft.Graph.Core.dll from PnP.PowerShell is the cause. Please reopen the issue. A workaround is to delete the outdated DLL from the PnP.PowerShell location (until the next PnP module update). Then the Graph request is working. Graph loads the correct version. |
Hey, @danmyhre . I would probably open another issue for this... |
I have this issue as well. Manually deleting Microsoft.Graph.Core from PnP module install directory fixed my Graph issues. Not a great workaround but works. |
Can we reopen this issue? Because it is still not working and pnp loading the wrong msgraph core dll |
How I can do this in a runbook? |
I have a workaround for the Azure Automation Runbook. |
I'm having the same issues with scripts that require to use Graph and PnP. Deleting Microsoft.Graph.Core.dll from the PnP module works for me. However, I'm concerned that the PnP module might encounter unforeseen problems. It would be very nice to resolve this long standing issue. Graph has been updating their module quite regularly. IMHO, keeping such a old version of their DLL in the PnP module will just become increasingly problematic. |
So this issue got marked as closed without ever actually being resolved? I'm still having this issue in September of '24 with the latest PnP modules in an Azure Automation Runbook. |
This is still an issue causing a lot of nightmare for us with Azure Function CI/CD pipeline and the maintenance of the requirement.ps1 file. It still an issue with
@veronicageek , is it possible to reopen and investigation this issue? |
Ok, I better understand the problem now that I'm able to simulate the situation on my own machine. First, I have the problem with I'm using a lot of powershell script in Azure function web app so they all share the same assembly context so conflit occur if script 1 use PnP-Online and than script 2 use the Connect-MgGraph. Nothing I can do, it's by design and limitation, hard to resolve : https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts?view=powershell-7.4 So the trick, is like it was written in a previous post, you have to Connect-MgGraph before doing a PnP-Online even if the script does not required access to graph. This is a workaround but the real solution is to resolve the dependency requirement. |
@veronicageek Hi, can you please re-open my issue report because the topic is still not solved on the side of the PnP module as you can see from the recent comments. Thank you |
Notice
I have also reported this issue in the Microsoft.Graph repository (microsoftgraph/msgraph-sdk-powershell#2285), but I would be really happy if you could also investigate the error from this side. Thank you.
Reporting an Issue or Missing Feature
When using the Microsoft.Graph and PnP.PowerShell module in the same script, the
Get-MgGroup -All
command fails with the following exception:Get-MgGroup_List: Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The error occurs if the script is executed locally as well as an Azure Automation runbook.
We locally use PowerShell v7.3.6 and in Azure Automation we also use the latest PS7.2 runbooks.
The latest Microsoft.Graph.* module version 2.4.0 is used as well as a recent PnP.PowerShell 2.2.59-nightly.
According to the blog post https://mortenknudsen.net/?p=2631, the old Microsoft.Graph.Core version 1.25.1.0 seems to originate from the module dependencies of PnP.PowerShell.
Expected behavior
Get-MgGroup should return the group objects of the tenants.
Actual behavior
Steps to reproduce behavior
Minimal code example to reproduce the issue:
What is the version of the Cmdlet module you are running?
The following module versions are installed exactly like that both locally under Windows and in the Azure automation account:
The nighly version of PnP.PowerShell has been installed by intention since there were known issues regarding module conflicts with Az.* and others in the last weeks, which should have been fixed in latest nightly versions.
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: