Creating a PowerShell session to Microsoft Exchange

1.1k views Asked by At

I'm trying to connect to Microsoft Exchange through PowerShell but I keep getting a "access denied" error. I'm using a global administrator with a business license to connect so that shouldn't be the problem.

The command I run:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Error message:

New-PSSession : [outlook.office365.com] Connecting to remote server
outlook.office365.com failed with the following error message : Access
denied. For more information, see the about_Remote_Troubleshooting
Help topic. At line:1 char:12 $Session = New-PSSession
-ConfigurationName Microsoft.Exchange -Conne ...
+ CategoryInfo: OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession],
PSRemotingTransportException FullyQualifiedErrorId :
AccessDenied,PSSessionOpenFailed
0

There are 0 answers