PowerShell unable to connect to Skype for Business Online

2 Min Read

PowerShell is unable to connect to Skype for Business Online in a hybrid environment. To Connect to Skype for Business PowerShell commonly use:

Import-Module SkypeOnlineConnector
$Cred = Get-Credential
$Session = New-CSOnlineSession -credential $Cred

Or (with all tools installed):

#cred = Get-Credential
$session = New-CsOnlineSession -Credential $cred
Import-PSSession $session

But, Administrators who have a Skype for Business hybrid deployment may receive the following error message when they try to connect to Skype for Business Online Remote PowerShell:

Get-CsPowerShellEndpoint : The remote server returned an error: (503) Server Unavailable.
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:94 char:26

+ …      $targetUri = Get-CsPowerShellEndpoint -TargetDomain $adminDomain
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-CsPowerShellEndpoint], WebException
+ FullyQualifiedErrorId : System.Net.WebException,Microsoft.Rtc.Management.OnlineConnector.GetPowerShellEndpointCmDlet

This is expected behavior for a Hybrid environment and the issue occurs when the DNS records for LyncDiscover are pointed to the on-premises Skype for Business environment.

To resolve this issue, run the cmdlet again, but instead, add the -OverrideAdminDomain parameter. Use the default domain that was included with your Office 365 subscription; for example, use name.onmicrosoft.com:

Import-Module SkypeOnlineConnector
$Cred = Get-Credential
$Session = New-CSOnlineSession -credential $Cred -OverrideAdminDomain name.onmicrosoft.com

These easy steps have now provided remote PowerShell access to the connected Skype for Business Online. To test connectivity simply try running  Get-CsUser.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version