Closed blackadi closed 2 weeks ago
In what order do you authenticate in the runbook?
I think I had a similar issue previously but recently this has been working ok for me recently.
@titlerequired first connecting to MSGraph via this cmdlet Connect-MgGraph -AccessToken ($oAuthReq.access_token | ConvertTo-SecureString -AsPlainText -Force) -NoWelcome
then Import-Module ExchangeOnlineManagement
You still need to use Connect-ExchangeOnline
@blackadi
You can use PowerShell 7.2 in Azure Automation.
Same issue here (and yes I'm using Connect-ExchangeOnline). Latest version (I jumped to 2.20.0 from 2.16.0) appears to completely break coexistence between these two and should be fixed immediately. I've had to roll back due to this bug.
Workaround: First Connect-MgGraph
and then Connect-ExchangeOnline
works.
The other way round does not work.
The actual error occurs while loading Microsoft.Graph.Authentication:
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.
Hello guys. Please update to the latest Microsoft.Graph PowerShell SDK and let us know if you are still experiencing the same issue. A similar issue has been logged here #2803
Latest version (2.21.0) does not resolve the issue for me.
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.
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.
bump
@timayabi2020 This issue is still active and present in current versions. Would you like yet another issue opened, or can we have this one reopened as it is not, in fact, completed.
I want to advise that this issue is still occurring for me as well, but not always consistently. It's hard to pin down specific triggers, but I usually end up reinstalling graph and eom.
Describe the bug
When running Graph commands and ExchangeOnlineManagement commands in a single script it throws an error.
why these 2 modules don’t work together?
Expected behavior
Understand why MS Graph and ExchangeOnlineManagement modules don’t work together?
How to reproduce
running Graph commands and ExchangeOnlineManagement commands in a single script
SDK Version
2.20
Latest version known to work for scenario above?
No response
Known Workarounds
script run in PowerShell 7 but not in in PowerShell 5.
We need PowerShell 5 support since we are using Azure Automation Runbooks which currently support PowerShell 5 runbok only.
Debug output
Click to expand log
``` System.Management.Automation.CommandNotFoundException: The 'Connect-MgGraph' command was found in the module 'Microsoft.Graph.Authentication', but the module could not be loaded. For more information, run 'Import-Module Microsoft.Graph.Authentication'. ---> System.Management.Automation.CmdletInvocationException: Could not load file or assembly 'Azure.Core, Version=1.35.0.0, Culture=neutral, PublicKeyToken=***' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Azure.Core, Version=1.35.0.0, Culture=neutral, PublicKeyToken=***' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.5.0\netFramework\Azure.Core.dll' or one of its dependencies. The system cannot find the file specified. ```Configuration
No response
Other information
No response