-
Notifications
You must be signed in to change notification settings - Fork 163
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
Microsoft.Graph.Authentication no compatible with ExchangeOnlineManagement #2803
Comments
Got the same issue on the version 3.5.0 of Exchange Online Management. The workaround remains the same. |
Got the same issue on Azure Automation with Microsoft.Graph.* v2.19.0 + ExchangeOnlineManagement v3.5.0 Workaround works with Microsoft.Graph.* v2.19.0 + ExchangeOnlineManagement v3.4.0 Thanks for this! |
Hi @iserrano76 please update to the latest Microsoft.Graph PowerShell SDK version (2.21.0) which has the latest |
Hi @timayabi2020, |
@iserrano76 apologies I just realized that I was in a PowerShell 7 session and not 5.1 and I was able to reproduce the issue. After investigations, it seems that |
Hi @timayabi2020, no problem. |
I have the same issue. I need to use both modules in the same session. I can work around this issue by rolling back to version 3.4.0, but I understand this is only a temporary solution. Will ExchangeOnlineManagement 3.5.2 or a later version resolve this issue? |
Hi @ks-git-22 If you import modules in the the opposite order it should work with 3.5 Import-Module Microsoft.Graph.Authentication
Import-Module ExchangeOnlineManagement Another way could be using #Requires modules: #Requires -Modules Microsoft.Graph.Authentication
#Requires -Modules ExchangeOnlineManagement I don't know if this could works for you at least a better workaround with the new versions of the modules. In my case, I don't need always ExchangeOnlineManagement, this solution, works for me but overloaded the script with modules that are not always need it. Best regards. |
I plan to study @iserrano76 's link and get smarterer, but I'm asking in case somebody already knows the answer (Easy Button). I've previously crawled through modules to troubleshoot, but I'm not versed in assemblies. The error is an attempt to load a file that doesn't exist. AzureCore.dll resides in What determines the location where an attempt is made to load the file? I assume it's in a configuration file or written into the modules or other assemblies themselves. AzureCore.dll also does not exist in the netFramework folder in ExchangeOnlineManagement version 3.4.0 so the key is @iserrano76 's statement "version 3.5.0 onwards is not isolating its dependencies into an Assembly Loading Context", but I'm too woefully ignorant to know what that means or how to validate it. Again, I plan to deep dive into this for my own understanding, but I'd take the tl;dr version in the short term. |
Hi @iserrano76 and @timayabi2020 As you say, I import the modules in that order, Import-Module was succeed. Then I run commands Connect-ExchangeOnline and Connect-MgGraph. Command:
Error Message:
This error ocuurs by Connect-ExchangeOnline, so I contacted Microsoft 365 support. Is this answer correct? If this error is caused by Graph, do you know why? Best regards. |
@ks-git-22 - After spending 5 hours today on this, I finally have something that works. It's suboptimal, but working.
This is with ExchangeOnlineManagement version 3.4.0 and Microsoft.Graph 2.22.0, running on PowerShell 5.1. Newer versions (3.5.0 and 3.5.1) give the 'Unable to decode header' that you got. Importing the modules in the other order gives the assembly load errors. |
@CraigTolley But newer versions (3.5.0 and 3.5.1) and Microsoft.Graph.Authentication 2.22.0 could not run. Is there no other way to solve this issue than to revert ExchangeOnlineManagement to 3.4.0? |
Describe the bug
I am working in a script on PowerShell 5.1 with ExchangeOnlineManagement and Microsoft.Graph.Authentication and if I try to connect to Graph after connect to Exchange Online I received an error message:
![image](https://private-user-images.githubusercontent.com/103440830/341149342-d96cd2ff-371e-40e5-9c9c-1521a93ed801.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NjkxNzQsIm5iZiI6MTcyNDk2ODg3NCwicGF0aCI6Ii8xMDM0NDA4MzAvMzQxMTQ5MzQyLWQ5NmNkMmZmLTM3MWUtNDBlNS05YzljLTE1MjFhOTNlZDgwMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMjAxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMTczODA4NGMzN2M1YmZhN2ViN2FjZGI1OTMwYmMyYzNlNjNhMmJjY2NmNDhjNWEyNDZhMTRlYzA2NGIyOTkzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.SlkgW6YjD16sYAz9i5bnF1nN2eerlCttwOMnM20C_bY)
In the troubleshooting I found that the issue appear as well just importing the modules in the same order:
![image](https://private-user-images.githubusercontent.com/103440830/341145745-eee47a5e-9ace-48de-b205-0595c54cc691.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NjkxNzQsIm5iZiI6MTcyNDk2ODg3NCwicGF0aCI6Ii8xMDM0NDA4MzAvMzQxMTQ1NzQ1LWVlZTQ3YTVlLTlhY2UtNDhkZS1iMjA1LTA1OTVjNTRjYzY5MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMjAxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00ZWEzMmViOWQ1YTUwZGVkODQxODBjY2MzNTM5NzQ3MzA4OTZhZWFjNjFkODZmMzgyMmUwOTFhYmMyMzJlYjdjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.I7JIPCTmdNcwnqzMvcYFm7DvFtntJ2pxgy8O2dyf718)
In case that I run in verbose mode
![image](https://private-user-images.githubusercontent.com/103440830/341151657-2508553c-2785-4aa0-9cc1-d01fdc893a0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NjkxNzQsIm5iZiI6MTcyNDk2ODg3NCwicGF0aCI6Ii8xMDM0NDA4MzAvMzQxMTUxNjU3LTI1MDg1NTNjLTI3ODUtNGFhMC05Y2MxLWQwMWZkYzg5M2EwYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMjAxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNTAzMTcxYjUzNjA1ZDAyOTJhYjRjZjYwYjdjM2JjMDYwNDlhOGVhYjgzZTYzNDY5MjE0OWVkZWVhNTU3MTQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.8Xig922XUGA3yT9MJt18lCr-xLnpIbW6ykCfCkG1Vug)
Import-Module ExchangeOnlineManagement -Verbose
Import-Module Microsoft.Graph.Authentication -Verbose
If I look for the error:
![image](https://private-user-images.githubusercontent.com/103440830/341152700-e439d990-cd80-4fc2-84d5-cf46f4049d45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NjkxNzQsIm5iZiI6MTcyNDk2ODg3NCwicGF0aCI6Ii8xMDM0NDA4MzAvMzQxMTUyNzAwLWU0MzlkOTkwLWNkODAtNGZjMi04NGQ1LWNmNDZmNDA0OWQ0NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMjAxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wOWQxMWJhNmNhNWNjZmY0OWZkOThlYzBmN2Y5MmNhZDY4YzFiMDAzZTI0N2ZlOWEzYzI2ZjY0MTdkZmQ4NzQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.1PYrp8Vo2IgY6vPXsslWPYQuagc8cmeYpVK2vmwPwTI)
It looks it is trying to look for Azure.Core on ExchangeOnlineManagement module.
if I change the order all works fine:
![image](https://private-user-images.githubusercontent.com/103440830/341149956-8643e9d4-8850-4d6e-b88a-f3ee99a31551.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NjkxNzQsIm5iZiI6MTcyNDk2ODg3NCwicGF0aCI6Ii8xMDM0NDA4MzAvMzQxMTQ5OTU2LTg2NDNlOWQ0LTg4NTAtNGQ2ZS1iODhhLWYzZWU5OWEzMTU1MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMjAxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yMzRiOWE0NWMwODFhNGYxYTI0NTQ0YjdkNDgzYjBmNmRhMjMwYTA3ZDM5ZDU4MWY5YTI0Mjk5YTliMjUwMGNjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.njak4OmmcdZO8-fvuIWUCToHj--NQOJZJReulLWZTHU)
Expected behavior
Be able to work with both modules, without errors and could use any order in the request.
How to reproduce
Connect-ExchangeOnline -ShowBanner:$false
Connect-MgGraph -NoWelcome
Import-Module ExchangeOnlineManagement
Import-Module Microsoft.Graph.Authentication
Import-Module ExchangeOnlineManagement -Verbose
Import-Module Microsoft.Graph.Authentication -Verbose
SDK Version
2.19.0
Latest version known to work for scenario above?
No response
Known Workarounds
It works with PowerShell 7 or with ExchangeOnlineManagement 3.4.0
Debug output
Click to expand log
```VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\xxxxx\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.19.0\Microsoft.Graph.Authentication.format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Authentication.
VERBOSE: Loading module from path 'C:\Users\xxxxx\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.19.0\Microsoft.Graph.Authentication.dll'.
VERBOSE: Importing cmdlet 'Get-ModuleCmdlet'.
VERBOSE: Importing cmdlet 'Get-ScriptCmdlet'.
VERBOSE: Importing cmdlet 'Connect-MgGraph'.
VERBOSE: Importing cmdlet 'Disconnect-MgGraph'.
VERBOSE: Importing cmdlet 'Add-MgEnvironment'.
VERBOSE: Importing cmdlet 'Get-MgEnvironment'.
VERBOSE: Importing cmdlet 'Remove-MgEnvironment'.
VERBOSE: Importing cmdlet 'Set-MgEnvironment'.
VERBOSE: Importing cmdlet 'Get-MgContext'.
VERBOSE: Importing cmdlet 'Get-MgGraphOption'.
VERBOSE: Importing cmdlet 'Invoke-MgGraphRequest'.
VERBOSE: Importing cmdlet 'Set-MgGraphOption'.
VERBOSE: Importing cmdlet 'Get-MgRequestContext'.
VERBOSE: Importing cmdlet 'Set-MgRequestContext'.
VERBOSE: Importing alias 'Connect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Disconnect-Graph'.
VERBOSE: Importing alias 'Invoke-GraphRequest'.
VERBOSE: Importing alias 'Invoke-MgRestMethod'.
VERBOSE: Importing alias 'Invoke-GraphRequest'.
VERBOSE: Importing alias 'Invoke-MgRestMethod'.
VERBOSE: Importing alias 'Invoke-GraphRequest'.
VERBOSE: Importing alias 'Invoke-MgRestMethod'.
VERBOSE: Importing alias 'Invoke-GraphRequest'.
VERBOSE: Importing alias 'Invoke-MgRestMethod'.
VERBOSE: Loading module from path 'C:\Users\xxxxx\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.19.0\Microsoft.Graph.Authentication.Core.dll'.
Import-Module : Could not load file or assembly 'file:///C:\Users\xxxxx\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.5.0\netFramework\Azure.Core.dll' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
The text was updated successfully, but these errors were encountered: