Access Denied when connecting to Exchange Online using PowerShell
Microsoft are currently experiencing an issue within Office 365 which is causing problems for some users trying to connect to Exchange Online using PowerShell.
This has been going on for about two weeks now and Microsoft have finally confirmed to us that it is a known issue.
Update 19th Nov 2013 0900 UTC: It appears as though this issue has been resolved for many of our affected tenants. However, there are still a very small number affected. No word from Microsoft yet in our Support ticket.
Update 21st Nov 2013 0900 UTC: All our affected tenants have been resolved.
Update 26th Nov 2013 1300 UTC – Work-around: If you are still affected by this issue you can change your ConnectionURI to the following URL:
$cred = get-credential
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/?targerServer=grxpr80mb030.lamprd80.prod.outlook.com" -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session -AllowClobber
During the connection phase it will throw an error similar to the one below:
New-PSSession : [pod51047psh.outlook.com] Connecting to remote server pod51047psh.outlook.com failed with the
following error message :
7:05:38 PM] Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
At C:\Users\burns_000\Desktop\connect-ps.ps1:3 char:19
+ $global:session = New-PSSession -ConfigurationName Microsoft.Exchange -Connectio …
+ CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
+ FullyQualifiedErrorId : -2144108477,PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter ‘Session’. The argument is null. Provide a valid value for
the argument, and then try running the command again.
At C:\Users\burns_000\Desktop\connect-ps.ps1:4 char:18
+ Import-PSSession $session -AllowClobber
+ CategoryInfo : InvalidData: (:) [Import-PSSession], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ImportPSSessionCommand
The same user has no issue connecting to Azure Active Directory (MSOL). We’ve seen approximately 2% of our customers impacted by this issue and it doesn’t seem to be restricted to a geographic region or group of servers.
We have opened a support ticket with Microsoft about this issue and they have acknowledged that it is affecting many tenants world wide. We’ll update this blog post when we have more information.
Instead of running all this PowerShell, why not sign up to a free trial of our Office 365 reporting software and we can do the hard work for you!