How to connect to Skype for Business Online via Powershell
To connect to Skype for Business Online:
Run the following commands in PowerShell:
Import-Module SkypeOnlineConnector
$sfboSession = New-CsOnlineSession -UserName “[email protected]” -OverrideAdminDomain “yourtennant.onmicrosoft.com”
Import-PSSession $sfboSession
Applies To : Windows 10, Windows Server
I’ve been caught out by this twice and it’s taken me a while to find the rather simple answer.
Most instructions give you a pretty simple way to connect to Skype for Business Online (or they’ll just call it Skype for Business). You install the module via executable, downloaded from Microsoft, and then try to run the following PowerShell commands (or some similar variation):
Import-Module SkypeOnlineConnector
$sfboSession = New-CsOnlineSession -UserName "[email protected]"
Import-PSSession $sfboSession
If you don’t have Skype for Business On-Premises, it should just work. If you DO have it and set up hybrid, you’ll probably get this error:
Unable to discover PowerShell endpoint URI.
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:155 char:9
+ throw $resources.DiscoveringEndpointFail
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to disco...l endpoint URI.:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to discover PowerShell endpoint URI.
Or, you might get this error if you managed to get the interactive logon to pop up first and then entered your credentials there:
Get-CsOnlinePowerShellAccessToken : One or more errors occurred.
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:214 char:28
+ $accessToken = Get-CsOnlinePowerShellAccessToken @params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-CsOnlinePowerShellAccessToken], AggregateException
+ FullyQualifiedErrorId : System.AggregateException,Microsoft.Rtc.Management.OnlineConnector.GetPowerShellAccessTo
ken
There’s a huge amount of potential fixes offered, but for me it was one simple switch, which I found thanks to enterinit.com – use the -OverrideAdminDomain switch.
Import-Module SkypeOnlineConnector
$sfboSession = New-CsOnlineSession -UserName "[email protected]" -OverrideAdminDomain “yourtennant.onmicrosoft.com”
Import-PSSession $sfboSession
Really easy fix, but the errors really don’t make it sound like this could be your problem. Now the next time I try to connect, I’ll re-read my own blog post to remind me of this switch :)
Note: I had to connect to this to make a Microsoft Teams change!
Thank you! Your tips really do save a lot of time. I didn’t realize there was a Microsoft module for this task.
You can find out a lot of interesting things and can share your opinions with other bloggers by using different social bookmarking icons.
Describes an issue in which Lync administrators can’t connect to Skype for Business Online Remote PowerShell in a Lync hybrid environment.
muntto is a blog-sharing website that seems to have been created with the purpose of letting bloggers obtain page views.