Connecting Powershell to Office 365 for Microsoft Teams Phone System

Any Phone System stuff we want to do on our Microsoft Teams tenancy needs to be actioned via PowerShell. In fact, probably all of Teams administration can be done via Powershell. This posts gives us a quick view to get it all sorted – this example is being performed on a Windows 10 machine.

First off — Phone System is a bit special in that it needs Skype Online Connector Windows Powershell Module. Download and install it:

After installing it, open up a PowerShell window with administrative privileges and load the module — you may find you have some issues with loading it:

Import-Module SkypeOnlineConnector

“SkypeOnlineConnectorStartup.psml cannot be loaded because running scripts is disabled on this system.”

If you’ve encountered this, changing the ExecutionPolicy allows us to import the module.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Import-Module SkypeOnlineConnector

After you’ve loaded the SkypeOnlineConnector Module, we need to load the MicrosoftTeams module.

Import-Module MicrosoftTeams

Answer ‘Y’ to the prompts to install the module, then we need to open a session to Office365 – to do that we first need some login credentials.


Enter in your account information for your O365 Admin portal.

$session = New-CsOnlineSession -Credential $login -Verbose
Import-PSSession $session

Done! you’re connected to your Office 365 tenancy, and you can now make changes. If you are looking to make a make Phone System changes, in particular add an SBC to your tenancy – I’ll go over that in my next post, for now have a look at some of the PSTN commands we’ll be using.

Get-Command *PSTN*

1 Reply to “Connecting Powershell to Office 365 for Microsoft Teams Phone System”

Leave a Reply

Your email address will not be published. Required fields are marked *