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 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 Powershell session is failed using OAuth

To fix this issue, you need to update the registry setting, use AllowBasic, and 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 privileges 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, no errors were reported, and the command was 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

Leave a Comment