Unable to Connect to ExchangeOnline

%3CLINGO-SUB%20id%3D%22lingo-sub-1880559%22%20slang%3D%22en-US%22%3EUnable%20to%20Connect%20to%20ExchangeOnline%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1880559%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20we%20have%20MFA%20enabled%20on%20our%20Office%20365%20accounts.%20From%20my%20Windows%2010%20computer%2C%20I%20can%20connect%20to%20the%20ExchangeOnlineManagement%20module%20without%20issue.%20However%2C%20on%20my%20DC%20I%20installed%20Powershell%207.0.3%2C%20then%20successfully%20installed%20the%20ExchangeOnlineManagement%20module.%20I%20can%20successfully%20import%20the%20module%2C%20however%20when%20I%20attempt%20to%20connect%20to%20it%20I%20get%20the%20below%20error.%20Any%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20C%3A%5CWindows%5CSystem32%26gt%3B%20Connect-ExchangeOnline%20-UserPrincipalName%20MyUsername%26nbsp%3B-ShowProgress%20%24true%3C%2FP%3E%3CP%3E----------------------------------------------------------------------------%3CBR%20%2F%3EThe%20module%20allows%20access%20to%20all%20existing%20remote%20PowerShell%20(V1)%20cmdlets%20in%20addit%3CBR%20%2F%3Eion%20to%20the%209%20new%2C%20faster%2C%20and%20more%20reliable%20cmdlets.%3C%2FP%3E%3CP%3E%7C--------------------------------------------------------------------------%7C%3CBR%20%2F%3E%7C%20Old%20Cmdlets%20%7C%20New%2FReliable%2FFaster%20Cmdlets%20%7C%3CBR%20%2F%3E%7C--------------------------------------------------------------------------%7C%3CBR%20%2F%3E%7C%20Get-CASMailbox%20%7C%20Get-EXOCASMailbox%20%7C%3CBR%20%2F%3E%7C%20Get-Mailbox%20%7C%20Get-EXOMailbox%20%7C%3CBR%20%2F%3E%7C%20Get-MailboxFolderPermission%20%7C%20Get-EXOMailboxFolderPermission%20%7C%3CBR%20%2F%3E%7C%20Get-MailboxFolderStatistics%20%7C%20Get-EXOMailboxFolderStatistics%20%7C%3CBR%20%2F%3E%7C%20Get-MailboxPermission%20%7C%20Get-EXOMailboxPermission%20%7C%3CBR%20%2F%3E%7C%20Get-MailboxStatistics%20%7C%20Get-EXOMailboxStatistics%20%7C%3CBR%20%2F%3E%7C%20Get-MobileDeviceStatistics%20%7C%20Get-EXOMobileDeviceStatistics%20%7C%3CBR%20%2F%3E%7C%20Get-Recipient%20%7C%20Get-EXORecipient%20%7C%3CBR%20%2F%3E%7C%20Get-RecipientPermission%20%7C%20Get-EXORecipientPermission%20%7C%3CBR%20%2F%3E%7C--------------------------------------------------------------------------%7C%3C%2FP%3E%3CP%3ETo%20get%20additional%20information%2C%20run%3A%20Get-Help%20Connect-ExchangeOnline%20or%20check%20htt%3CBR%20%2F%3Eps%3A%2F%2Faka.ms%2Fexops-docs%3C%2FP%3E%3CP%3ESend%20your%20product%20improvement%20suggestions%20and%20feedback%20to%20exocmdletpreview%40servi%3CBR%20%2F%3Ece.microsoft.com.%20For%20issues%20related%20to%20the%20module%2C%20contact%20Microsoft%20support.%20D%3CBR%20%2F%3Eon't%20use%20the%20feedback%20alias%20for%20problems%20or%20support%20issues.%3CBR%20%2F%3E----------------------------------------------------------------------------%3C%2FP%3E%3CP%3ENew-ExoPSSession%3A%20C%3A%5CUsers%5Cjwcitadmin%5CDocuments%5CPowerShell%5CModules%5CExchangeOnlin%3CBR%20%2F%3EeManagement%5C2.0.3%5CExchangeOnlineManagement.psm1%3A426%3CBR%20%2F%3ELine%20%7C%3CBR%20%2F%3E426%20%7C%20.%20PSSession%20%3D%20New-ExoPSSession%20-ExchangeEnvironmentName%20%24ExchangeEnviro%3CBR%20%2F%3E.%3CBR%20%2F%3E%7C%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%7C%20Could%20not%20load%20type%20'System.Security.Cryptography.SHA256Cng'%20from%3CBR%20%2F%3E%7C%20assembly%20'System.Core%2C%20Version%3D4.0.0.0%2C%20Culture%3Dneutral%2C%3CBR%20%2F%3E%7C%20PublicKeyToken%3Db77a5c561934e089'..%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1880559%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECommunity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1881118%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20Connect%20to%20ExchangeOnline%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1881118%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F864612%22%20target%3D%22_blank%22%3E%40M3Jota%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20not%20totally%20sure%2C%20but%20based%20on%20some%20reading%20I%20did%20there%20is%20a%20compatibility%20issues%20between%20Powershell%207%20and%20ExchangeOnline%2C%20even%20though%20its%20almost%201%20year%20post%2C%20but%20not%20sure%20if%20MS%20fix%20it%20or%20not.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F11070%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F11070%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20same%20case%2C%20and%20I%20am%20using%20Powershell%205.1%20to%20manage%20Exchange%20Online%2C%20as%20it%20seems%20that%20Powershell%20Core%20is%20not%20compatible%20with%20the%20module.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eeven%20in%20Windows%20Event%20Log%20I%20have%20the%20following%20Warning%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EError%20Message%20%3D%20Could%20not%20load%20type%20'System.Security.Cryptography.SHA256Cng'%20from%20assembly%20'System.Core%2C%20Version%3D4.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089'..%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EFully%20Qualified%20Error%20ID%20%3D%20System.Exception%2CMicrosoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EContext%3A%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ESeverity%20%3D%20Warning%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EHost%20Name%20%3D%20ConsoleHost%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EHost%20Version%20%3D%207.1.0%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EHost%20ID%20%3D%20d1434fc6-2c2d-4b64-8ca4-38ca5f6668c9%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EHost%20Application%20%3D%20C%3A%5CProgram%20Files%5CPowerShell%5C7-preview%5Cpwsh.dll%20-WorkingDirectory%20~%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EEngine%20Version%20%3D%207.1.0%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ERunspace%20ID%20%3D%20d84be782-d5d3-413a-b7c1-a2ab71ab9e4f%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EPipeline%20ID%20%3D%2075%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ECommand%20Name%20%3D%20New-ExoPSSession%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ECommand%20Type%20%3D%20Cmdlet%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EScript%20Name%20%3D%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CExchangeOnlineManagement%5C2.0.3%5CExchangeOnlineManagement.psm1%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ECommand%20Path%20%3D%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ESequence%20Number%20%3D%208%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EUser%20%3D%20266517A%5CUser390%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EConnected%20User%20%3D%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EShell%20ID%20%3D%20Microsoft.PowerShell%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EUser%20Data%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E---------------------------%3C%2FP%3E%3CP%3EIf%20you%20find%20this%20answer%20helpful%2C%20Please%20click%20on%20%3CSTRONG%3EBest%20Response%3C%2FSTRONG%3E%20and%20give%20%3CSTRONG%3Elike%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1881564%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20Connect%20to%20ExchangeOnline%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1881564%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F790105%22%20target%3D%22_blank%22%3E%40farismalaeb%3C%2FA%3E%26nbsp%3Bis%20correct%2C%20the%20ExO%20V2%20module%20doesnt%20support%20PowerShell%207%2FCore%20yet.%20A%20preview%20version%20is%20available%20and%20GA%20should%20follow%20in%20the%20coming%20weeks%2Fmonths.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

So we have MFA enabled on our Office 365 accounts. From my Windows 10 computer, I can connect to the ExchangeOnlineManagement module without issue. However, on my DC I installed Powershell 7.0.3, then successfully installed the ExchangeOnlineManagement module. I can successfully import the module, however when I attempt to connect to it I get the below error. Any ideas?

 

PS C:\Windows\System32> Connect-ExchangeOnline -UserPrincipalName MyUsername -ShowProgress $true

----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addit
ion to the 9 new, faster, and more reliable cmdlets.

|--------------------------------------------------------------------------|
| Old Cmdlets | New/Reliable/Faster Cmdlets |
|--------------------------------------------------------------------------|
| Get-CASMailbox | Get-EXOCASMailbox |
| Get-Mailbox | Get-EXOMailbox |
| Get-MailboxFolderPermission | Get-EXOMailboxFolderPermission |
| Get-MailboxFolderStatistics | Get-EXOMailboxFolderStatistics |
| Get-MailboxPermission | Get-EXOMailboxPermission |
| Get-MailboxStatistics | Get-EXOMailboxStatistics |
| Get-MobileDeviceStatistics | Get-EXOMobileDeviceStatistics |
| Get-Recipient | Get-EXORecipient |
| Get-RecipientPermission | Get-EXORecipientPermission |
|--------------------------------------------------------------------------|

To get additional information, run: Get-Help Connect-ExchangeOnline or check htt
ps://aka.ms/exops-docs

Send your product improvement suggestions and feedback to exocmdletpreview@servi
ce.microsoft.com. For issues related to the module, contact Microsoft support. D
on't use the feedback alias for problems or support issues.
----------------------------------------------------------------------------

New-ExoPSSession: C:\Users\jwcitadmin\Documents\PowerShell\Modules\ExchangeOnlin
eManagement\2.0.3\ExchangeOnlineManagement.psm1:426
Line |
426 | . PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro
.
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Could not load type 'System.Security.Cryptography.SHA256Cng' from
| assembly 'System.Core, Version=4.0.0.0, Culture=neutral,
| PublicKeyToken=b77a5c561934e089'..

4 Replies

@M3Jota 

I am not totally sure, but based on some reading I did there is a compatibility issues between Powershell 7 and ExchangeOnline, even though its almost 1 year post, but not sure if MS fix it or not.

 

https://github.com/PowerShell/PowerShell/issues/11070

 

I have the same case, and I am using Powershell 5.1 to manage Exchange Online, as it seems that Powershell Core is not compatible with the module.

 

even in Windows Event Log I have the following Warning:

 

Error Message = Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'..
Fully Qualified Error ID = System.Exception,Microsoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession


Context:
Severity = Warning
Host Name = ConsoleHost
Host Version = 7.1.0
Host ID = d1434fc6-2c2d-4b64-8ca4-38ca5f6668c9
Host Application = C:\Program Files\PowerShell\7-preview\pwsh.dll -WorkingDirectory ~
Engine Version = 7.1.0
Runspace ID = d84be782-d5d3-413a-b7c1-a2ab71ab9e4f
Pipeline ID = 75
Command Name = New-ExoPSSession
Command Type = Cmdlet
Script Name = C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.3\ExchangeOnlineManagement.psm1
Command Path =
Sequence Number = 8
User = 266517A\User390
Connected User =
Shell ID = Microsoft.PowerShell


User Data:

 

 

---------------------------

If you find this answer helpful, Please click on Best Response and give like

 

@farismalaeb is correct, the ExO V2 module doesnt support PowerShell 7/Core yet. A preview version is available and GA should follow in the coming weeks/months.

Hi @Vasil Michev , i am facing the same issue to use powershell script 7 to connect to ExchangeOnline. 

Just wondering if you know what is current progress ? Thanks. 

Powershell 7 is not compatible with EXO. Must use powershell 5 or 6.