How to fix Error New-ExoPSSession: Create Powershell Session is failed using OAuth

When connecting to Exchange Online Powershell Module v2 using an administrator account, you may get an error message New-ExoPSSession: Create Powershell Session is failed using OAuth.

Error Details:

New-ExoPSSession : Create Powershell Session is failed using OAuth
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.5\netFramework\ExchangeOnlineManagement.psm1:475 char:30
… PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro …
~~~~~~~~~~~~~ CategoryInfo : NotSpecified: (:) [New-ExoPSSession], Exception
FullyQualifiedErrorId : System.Exception,Microsoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession

Connect-ExchangeOnline

Connect-ExchangeOnline -UserPrincipalName <Administrator User Account>
Create Powershell Session is failed using OAuth

Fix for create Powershell session is failed using OAuth

To Fix this issue you just need to update a registry setting AllowBasic and then try again. Let’s see which registry key needs to be updated and then test it again.

Open Registry Editor on your Windows 10 or Windows 11 PC using administrator priviledges and find the Registry key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client and set its value to 1.

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client

Let’s try again to see if it works fine this time. As you can see, there are no errors reported and the command is executed successfully.

Create Powershell Session is failed using OAuth

Next, Try Get-Mailbox command to confirm that you are getting the results.

Get-Mailbox command