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.
|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 …
FullyQualifiedErrorId : System.Exception,Microsoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession
Connect-ExchangeOnline -UserPrincipalName <Administrator User Account>
Fix for 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 privileges and find the Registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client and set its value to 1.
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.
Get-Mailbox command to confirm that you are getting the results.