Compatability Issue with MgGraph Module

Compatability Issue with MgGraph Module

avatar

Hi Devolution Team,

there is an issue when connecting to MgGraph, not sure that is something you have to fix or the Graph Module Team...

If the Microsoft.Graph.Authentication module is loaded (via require or import-module) before Devolutions.Powershell the connection to MgGraph fails with the following error:

Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'

If you switch the order of module loading (Devolutions.Powershell before Microsoft.Graph.. then it works for some reason)
Tested with:
Powershell 7.5.3
Devolutions.Powershell 2025.3.0
Microsoft.Graph 2.31.0
a MSSQL Datasource
RDM Version 2025.3.16.0 (i don't think this has any effect)

How to reproduce:

Import-Module Microsoft.Graph.Authentication
Import-Module Devolutions.PowerShell
$Datasourcename = "XYXY" #Replace with your DS
$datasource = Get-RDMDataSource -Name $Datasourcename
Set-RDMCurrentDataSource -DataSource $datasource
Connect-MgGraph -NoWelcome


I also have attached a little script which outputs the loaded DLL's.
I think it has something to do with one of the Azure...dll's, but that could be a "red herring".

BR,
Stefan / CryoRig

test_devo_mggraph_issue.ps1

All Comments (5)

avatar

Hello cryorig,

Thank you for reaching out to the Devolutions support team.

This is a known behaviour from the MgGraph module.
They also mentioned connecting to the graph before importing another module, such as AZ.

Best regards,

Patrick Ouimet

avatar

Hi Patrick,

oh ok good to know!
do you have a link where this is mentioned? a quick search didn't really give me anything "official" just multiple users with thze same or similar issue

BR,
Cryorig

avatar

Hello Cryorig,

This is on this page under the description.

https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.authentication/connect-mggraph

Here is what is mentioned:

You must invoke Connect-MgGraph before any commands that access Microsoft Graph. This cmdlet gets the access token using the Microsoft Authentication Library

Best regards,

Patrick Ouimet

avatar

Hi Patrick, sorry for the delay in response.

i don't think that this is the same problem / issue...

Your quote is about how one needs to use connect-mggraph before any other mggraph command, which makes sense.
I also read through the page you linked and there is no mention about a specific order how non Graph modules like AZ have to be loaded...

If you read my original post, my issue is when i load the Graph Module BEFORE Devolutions.Powershell, then the graph connection does not work! (see the error from my first post)
it works when i turn the module load order around, which is the opposite of what you stated and also what makes me think that we are not on the same page regarding my issue.

BR,
CryoRig

avatar

Hello cryorig,

Thank you for this feedback.

In this case, I suggest connecting right after importing your module like this:

Import-Module Devolutions.PowerShell
$Datasourcename = "SQL" #Replace with your DS
$datasource = Get-RDMDataSource -Name $Datasourcename
Set-RDMCurrentDataSource -DataSource $datasource

Import-Module Microsoft.Graph.Authentication
Connect-MgGraph -NoWelcome


Best regards,

Patrick Ouimet