There are just some things you can’t do inside the Office 365 portal. Exchange Online has matured to the point where remote PowerShell works perfectly and loads all of the cmdlets over the wire. Skype for Business Online is still building to that point. You need the separate PowerShell module (https://www.microsoft.com/en-us/download/details.aspx?id=39366 ) to get started, and while installing it is the easy part using it takes a little bit of work. Here are a cheat sheet I’ve put together.
How to Connect
If you install the Skype for Business PowerShell module and try to load it in the Skype for Business Administrative Shell, you must use the -AllowClobber switch with running Import-PSSession (https://technet.microsoft.com/en-us/library/hh849970.aspx). Otherwise the Skype for Business on-premises cmdlets leach thru in place of the Online ones. Here’s the connection script that I usually save in a PowerShell file for quick launching:
Import-Module SkypeOnlineConnector
$cred = Get-Credential
$CSSession = New-CsOnlineSession -Credential $cred
Import-PSSession $CSSession -AllowClobber
Always have a cloud-only account (<tenant>.onmicrosoft.com) available for emergency situations.
In a Single Sign-On environment (https://support.office.com/en-us/article/Office-365-integration-with-on-premises-environments-263faf8d-aa21-428b-aed3-2021837a4b65?ui=en-US&rs=en-US&ad=US&fromAR=1) you’ll have a back door if on-premises is down. Once directory synchronization is setup, administrators grant their domain account (<user>@<yourdomain>.com) Global Administrator rights for daily tasks. Nothing wrong with this, but it can cause Problem #1
Problem #1 – LyncDiscover
When trying to setup Skype for Business Hybrid using your domain account, Skype for Business Online PowerShell doesn’t resolve the Cloud and instead the on-premises lyncdiscover.<yourdomain>.com. This cases a 503 error when trying to login.
PS C:\Users\user> $CSSession = New-CsOnlineSession -Credential $cred
Get-CsPowerShellEndpoint : The remote server returned an error: (503) Server Unavailable |
This is a scenario where you will want to use that cloud-only account to sign in for an administrative tasks.
Problem #2 – The New Tenant
With a new Skype for Business Online tenant, even if you have users in your Office 365 tenant and have assigned them a Skype for Business Online license, there’s still that last bit of configuration that doesn’t seems to happen behind the scenes until at least 1 user logs in. If you don’t, when you go to connect to Skype for Business Online PowerShell you’ll get a 404 error:
PS C:\Users\user> $CSSession = New-CsOnlineSession -Credential $cred
Get-CsPowerShellEndpoint : The remote server returned an error: (404) File Not Found |
Once everything is tied together, you’ll achieve a successful sign on to Skype for Business Online PowerShell!
PS C:\Users\user> $CSSession = New-CsOnlineSession -Credential $cred -Verbose VERBOSE: Determining domain to admin VERBOSE: AdminDomain = ‘tenant.onmicrosoft.com’ VERBOSE: Discovering PowerShell endpoint URI VERBOSE: TargetUri = ‘https://admin2a.online.lync.com/OcsPowershellLiveId’ VERBOSE: Requesting authentication token VERBOSE: Success VERBOSE: Initializing remote session VERBOSE: Success |