Connecting to Skype for Business

Like Exchange Online, Skype for Business has its own module that uses remote PowerShell sessions. Similarly, you will be prompted if you don't provide a value for $Credentials. You might also need to specify the UserPrincipalName that corresponds to the credentials you provide—although it's not 100% clear exactly why this is necessary.

Connecting is fairly straightforward, as the example here shows:

Write-Host -ForegroundColor Cyan "Connect to Skype for Business Online"
$global:S4bSession = New-CsOnlineSession -Verbose <# :$VerbosePreference #>
-Credential $Credentials
Import-PSSession $global:S4bSession -Verbose <# :$VerbosePreference | Out-Null #>

With Skype for Business, things get a bit complicated if you're trying to connect to a site through delegated admin access. This involves providing values for the -OverrideAdminDomain parameter (but not -OverrideDiscoveryUri or -OverridePowerShellUri). We'll cover this in detail in just a bit.

Here's the resulting output: