Unable to connect to Skype for Business Online remote powershell in a hybrid environment

Unable to connect to Skype for Business Online remote powershell 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 behaviour 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.

You might also like

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More