Error connecting to Skype for Business Online PowerShell: Unable to connect to the remote server

I recently ran into an issue with my lab trying to connect to Skype for Business Online PowerShell (SkypeOnlineConnector) which took me a little while to figure out. After launching PowerShell and importing the SkypeOnlineConnector module, I got the “Unable to connect to the remote server” error when running the New-CsOnlineSession command to authenticate using Modern Authentication:

$Session = New-CsOnlineSession -UserName <Admin
Username>

Rather than launching the Modern Auth credential prompt as I was expecting the command instead threw that error immediately.

Now, what I had forgotten is that I had previously configured my lab with an on-premises Skype for Business Server deployment I have since deprovisioned, but I had not updated the public DNS records to point to Skype for Business Online. Because of this, and because I was using an admin account username with a custom domain, the module could not work out where to connect in order to authenticate. It’s worth noting though that this issue would affect you in exactly the same way if you are in a hybrid environment with your DNS records pointed to your Skype for Business Server on-premises deployment.

What I eventually remembered is that in this scenario, where for your SIP/username domain is not pointed at Office 365, you need to specify the OverrideAdminDomain parameter to direct the session to connect to your Office 365 Tenant.

$Session = New-CsOnlineSession -UserName <Admin
Username> -OverrideAdminDomain <Tenant Name>.onmicrosoft.com

When I ran this command I was prompted for my Office 365 Admin password as expected.

I was then able to complete my authentication, import my session and launch Skype for Business Online PowerShell as expected.

If you have any questions or comments please either use the comments section below, Tweet me @MikeParker365 or via email blog@mikeparker365.co.uk.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s