When we need to configure calling settings for Microsoft Teams through PowerShell, we traditionally needed to use the Skype Online Connector PowerShell Module. This was a pain for a few reasons, particularly when configuring automation. If we wanted to connect to both Teams and Skype, we would need to authenticate twice like the below example:
Import-Module MicrosoftTeams, SkypeOnlineConnector $credential = Get-Credential $sfbSession = New-CsOnlineSession -Credential $credential Connect-MicrosoftTeams Import-PSSession $sfbSession
The above method did not support modern authentication which was a major problem from a security perspective. A recent update integrated the SkypeOnlineConnector Cmdlets into the Microsoft Teams module and allowed us to just install the Teams module and then connect to the Skype service using something similar to the below:
Import-Module MicrosoftTeams Connect-MicrosoftTeams $sfbSession = New-CsOnlineSession Import-PSSession $sfbSession
This was better but had some issues, particularly with session expiration as the user would be asked to reauthenticate but the session was expecting an OAuth token, not user credentials. There was also a workaround for this with the “Enable-CsOnlineSessionForReconnection” cmdlet but there were also issues with how this worked in practice.
Microsoft Teams PowerShell V2.0.0
As of March 2021, we can now update the Microsoft Teams PowerShell Module to V2.0.0. V2.0.0 supports the Skype Online cmdlets natively, no need to connect separately to the Skype service and no need to worry about reconnection! With the new module update, the above cmdlets can all be replaces with:
Import-Module MicrosoftTeams Connect-MicrosoftTeams
This will give us the expected Modern Authentication prompt and once authenticated, we can configure both Teams and the Skype service in one connection. Another benefit of using the Teams module is the ability to connect using other methods such as Graph access token, Service Principal and Certificate (more on these methods here).
To update to the new version of the module, simply run the below cmdlet as admin on your machine:
Update-Module MicrosoftTeams -RequiredVersion 2.0.0
This has already been a major timesaver for me and I now need to go back and update all of my scripts to use this new method. You can check out the updated documentation here.