Reputation: 73
Trying to change a script from basic authentication to Exchange Online V2 Module to utilise Modern Auth.
Install-Module PowershellGet -Force
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install and test
Install-Module -Name ExchangeOnlineManagement
Get-Module ExchangeOnlineManagement -ListAvailable
$UserCredential = Get-Credential
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true
The Error im getting is
New-ExoPSSession : Create Powershell Session is failed using OAuth
I've tried removing and reinstalling the module, Which didn't work I've tried this script on a different machine, Which worked I've tried setting the proxy parameters to null, Which didn't work I've tried using the code on the microsoft doc to only utilise modern auth and not Two factor, Didnt work
I've mainly used this a source, but have looked around in different places to find the answer but no luck.
https://learn.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps
Upvotes: 1
Views: 15678
Reputation: 76
I had the same thing happen to me. I had to enable winrm.
I used: winrm quickconfig
Then I had to enable basic auth for WinRM [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client] "AllowBasic"=dword:00000001
After that I was able to connect without that error.
Upvotes: 6