connect to SFB online powershell

Brass Contributor

Hi Experts

I am using MFA for office365, could you please help me with the syntax to connect to SFB online powershell module.

i have installed onlinepowershell module module but i am getting below error

 

PS C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector> Import-Module SkypeOnlineConnector
PS C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector> $sfbSession = New-CsOnlineSession
Please enter the user principal name (ex. User@Domain.Com): myuser@mydomain.com
Unable to discover PowerShell endpoint URI
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:114 char:9
+ throw $resources.DiscoveringEndpointFail
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to disco...ll endpoint URI:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to discover PowerShell endpoint URI

3 Replies

Hi,

 

Connect with
Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

 

Or you are signing in with a MFA enabled account
Import-Module SkypeOnlineConnector
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession

 

You could also use this script to make it easier
https://gallery.technet.microsoft.com/Office-365-Connection-47e03052 

PS C:\Users\user1.mydomain> $sfbSession = New-CsOnlineSession
Please enter the user principal name (ex. User@Domain.Com): adminacct@mydomain.com
Unable to discover PowerShell endpoint URI
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:114 char:9
+ throw $resources.DiscoveringEndpointFail
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to disco...ll endpoint URI:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to discover PowerShell endpoint URI

Add -OverrideAdminDomain and change to your tenantname.

$sfbSession = New-CsOnlineSession -Credential $userCredential -OverrideAdminDomain "yourtenantname.onmicrosoft.com"