If you try to get connected to Skype for Business Online using power shell, you will get the following message
Details: Error processing command: Processing data from remote server admin3e.online.lync.com failed with the following error message: Skype for Business Online PowerShell connections are blocked. Please replace the Skype for Business Online PowerShell connector module with the Teams PowerShell Module.
The name of the server might varies
The reason for this is that Skype for Business Online PowerShell is blocked (mostly they will not unblock them)
Use the following commands instead ( these commands utilize the Microsoft Teams PowerShell module)
First, install the Teams Module (which needs to be done only once on the machine):
Install-Module MicrosoftTeams -AllowClobber
This will download and install the module
If you do not install the module you will get the following error message”
Import-Module : The specified module ‘MicrosoftTeams’ was not loaded because no valid module file was found in any module directory.
Now, prepare the session using the following commands:
Import-Module MicrosoftTeams
$cred=Get-Credential
Connect-MicrosoftTeams -Credential $cred
The advantage of using $cred=Get-Credential is that you can use Connect-MicrosoftTeams -Credential $cred if your session expires and there is no need to supply the users id and password because the credentials are stored in the $cred variable and will remain available during the PowerShell window
But in the case of having Multi-Factor Authentication (MFA) enabled on your organization (Even if the account you are using is not enabled for MFA, you need to simply use it. Otherwise, you will get an error
Connect-MicrosoftTeams
The disadvantage of this method is that every time the session expires, you need to supply the user and password. But unfortunately, this method is not available if you have configured MFA in your organization.
So, in the case of using MFA, the following is how to prepare a new session