microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
712 stars 172 forks source link

Any version beyond 2.19.0 of the Microsoft Graph Powershell module is causing errors in various Graph commands #2980

Closed AdamBlaumann closed 1 week ago

AdamBlaumann commented 1 month ago

Describe the bug

In the past months we've had several cases of our Microsoft Graph PS commands not working, for some of them we even opened Microsoft support cases. We found that returning to version 2.19.0 of Microsoft.Graph always resolves the issue, but we can't stay on this version forever.

The Connect-Graph or Connect-MgGraph command is always executed successfully, but then certain Graph commands (from different submodules) run into a generic error message, which is always the same: "An error occurred while sending the request."

There is no further information provided, even if we run them in verbose mode.

I've began wondering if perhaps there was a change in how the module connects with the M365 tenant, and maybe we need to have our firewall rules adjusted. Were there any changes after version 2.19.0 in how the module connects? Is the connection using a different port? Different target IP range?

Expected behavior

The graph commands run without throwing an error

How to reproduce

  1. Install version 2.20.0 or later of the Graph module on one of our Windows servers
  2. Run Connect-Graph with a user account or service principal
  3. Run a graph command that the user account or service principal has permission to run (example: Get-MgApplication or Get-MgUser)

SDK Version

2.20.0, 2.21.0, 2.22.0

Latest version known to work for scenario above?

2.19.0

Known Workarounds

Avoid upgrading from version 2.19.0

Debug output

Click to expand log ``` ```

Configuration

Name Value


PSVersion 5.1.17763.6292 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.6292 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

OS: Microsoft Windows Server 2019 Standard (Build 17763) x64

Other information

No response

timayabi2020 commented 3 weeks ago

Hi @AdamBlaumann thank you for raising this issue. Could you please let us know which version of ExchangeOnline you are using and also share debug output of any cmdlet after connecting to graph.

AdamBlaumann commented 3 weeks ago

Vertraulichkeitsstufe: Intern

Hello Tim,

All the debug outputs are empty after connecting to Graph. We have attempted using MS Graph with ExchangeOnline module versions 3.4.0, 3.5.0 and 3.5.1. ExO module 3.4.0 works fine with MS Graph 2.19.0, but upgrading either of those to a newer version is when we start having issues. Example of an error message when we tried to load both modules into the same PS session (Powershell version 5.1): Import-Module : Could not load file or assembly 'file:///C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.5.1\netFramework\Azure.Core.dll' or one of its dependencies. The system cannot find the file specified.

But the original issue we reported here happens independently from the Exchange Online module version. I mentioned the ExO module as an observation, because when we use both at the same time, it references a file that I think is part of the Microsoft.Graph.Authentication submodule (despite the file path in the error message indicating it as part of the ExO module).

From: Tim @.> Sent: Dienstag, 22. Oktober 2024 18:26 To: microsoftgraph/msgraph-sdk-powershell @.> Cc: BLAUMANN Adam (R-IT) @.>; Mention @.> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] Any version beyond 2.19.0 of the Microsoft Graph Powershell module is causing errors in various Graph commands (Issue #2980)

Hinweis: Externer Absender

Hi @AdamBlaumannhttps://github.com/AdamBlaumann thank you for raising this issue. Could you please let us know which version of ExchangeOnline you are using and also share debug output of any cmdlet after connecting to graph.

- Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2980#issuecomment-2429732698, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFNC4A3KVNWNKEZKVFLIMGTZ4Z4CTAVCNFSM6AAAAABPFG7I36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRZG4ZTENRZHA. You are receiving this because you were mentioned.Message ID: @.**@.>>


Raiffeisen Informatik GmbH & Co KG | Firmensitz Wien | Firmenbuchnr. FN 521687m | Handelsgericht Wien | UID ATU74856701 Komplement?r: Raiffeisen Informatik Gesch?ftsf?hrungs GmbH | Firmensitz Wien | Firmenbuchnr. 519302f | Handelsgericht Wien Lilienbrunngasse 7-9 | A-1020 Wien | T +43 1 99 3 99 - 0 | E @.*** | H www.r-it.at

Der Austausch von Nachrichten mit oben angef?hrtem Absender via E-Mail dient ausschlie?lich Informationszwecken. Rechtsgesch?ftliche Erkl?rungen d?rfen ?ber dieses Medium nicht ausgetauscht werden. Correspondence with above mentioned sender via e-mail is for informational purposes only. This medium may not be used for the exchange of legally-binding communications.


timayabi2020 commented 2 weeks ago

@AdamBlaumann you need to upgrade to EXO version 3.6.0. See related issue here https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2803

AdamBlaumann commented 2 weeks ago

@timayabi2020 That is not our issue. I probably shouldn't have mentioned the Exchange Online Management module at all. I've removed the part of the problem description that had any mention of it. The issue is encountered when using the Graph module by itself. We don't need to import or use the Exchange Online Management module to encounter the issue.

timayabi2020 commented 2 weeks ago

@AdamBlaumann please share the output of this command [System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location | Out-GridView so that we confirm if there are any assembly version conflicts loaded in the session.

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.