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
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.

Change AllowBasic registry entry value and set it to 1
Change AllowBasic registry entry value and set it to 1

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.

Execute Connect-ExchangeOnline again and this time it should work fine
Execute Connect-ExchangeOnline again and this time it should work fine

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

Test using Get-Mailbox to confirm its able to fetch results
Test using Get-Mailbox to confirm its able to fetch results

Read Next

Leave a Comment