Introduction to Microsoft Teams Direct Routing
Setting up phone calling for Microsoft Teams using Direct Routing is straightforward with our PowerShell wizard. It automates what would otherwise be a complex setup. You only need your Teams domain and Teams Phone licensing—we handle DNS, users, numbers, PSTN, and routing.
Before you start
Review these useful guides:
- Introduction to Microsoft Teams for admins
- Microsoft Teams Help & Learning
- Manage Teams with Microsoft Teams PowerShell
1. Set up licensing for users
Phone services for Teams require specific licensing for each user:
-
Enterprise licensing: Add an E1, E3, or E5 licence to enable phone services.
-
Teams Phone Standard: This add-on is required to enable phone services for any user with Microsoft Teams.
To set this up:
-
Sign into the Microsoft 365 admin centre as an administrator.
-
Select Billing > Licences.
2. Add Teams-enabled numbers
In your SIPcity account, add any new numbers you need. Go to Switchboard, select Add Number, and follow the prompts. See the Adding Numbers article for details.
-
Log in to your SIPcity account.
-
Go to Switchboard and select the number you want to use with Teams.
-
Under Number Details, select Teams in the Type dropdown.
-
Click Save.
3. Connect your SIPcity and Microsoft accounts
Use our PowerShell wizard to generate the scripts needed to finalise Direct Routing setup.
-
Go to Tools > Teams.
-
Select PowerShell for step-by-step instructions on how to use PowerShell with Windows and macOS.
3.1 Connect to Microsoft Graph
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
3.2 Create domain
Add a domain using the New-MgDomain cmdlet.
#: New-MgDomain -BodyParameter @{Id="ms50000100.teams.sipcity.com.au";IsDefault="False"}
3.3 Get TXT record
#: $MgVerificationCode = (Get-MgDomainVerificationDnsRecord -DomainId "ms50000100.teams.sipcity.com.au" | Where-Object {$_.RecordType -eq "Txt"}).AdditionalProperties.text
#: echo $MgVerificationCode
Domain validation TXT record: Microsoft generates this record to validate your domain. Copy and paste it into the Add TXT dialog in your DNS settings.
3.4 Confirm the domain
Confirm the domain with Microsoft:
#: Confirm-MgDomain -DomainId "ms50000100.teams.sipcity.com.au"
Once confirmed, we remove the TXT record from our Cloudflare DNS.
Note: You have a 5-minute window to complete this step. If you can’t finish in time, you can retry later.
4. Create users
-
Go to the Microsoft Admin Centre > Users > Add a user.
-
Temporary user: Microsoft requires a temporary user to associate with the trunk domain. Assign an Office 365 Business licence to this user.
-
Trunk domain: Select from the dropdown (e.g.
[email protected]). -
Click Next.
5. Create PSTN
-
Go to Tools > Teams > PowerShell.
5.1 Connect to Microsoft Admin
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
5.2 Create PSTN gateway
Use the New-CsOnlinePSTNGateway cmdlet to create a PSTN gateway with the required settings.
#: New-CsOnlinePSTNGateway -FQDN ms50000100.teams.sipcity.com.au -SIPSignalingPort 5061 -MaxConcurrentSessions 100 -Enabled $true
5.3 Verify the PSTN gateway
Check that the gateway was created successfully.
#: Get-CsOnlinePSTNGateway
6. Associate users
6.1 Connect to Microsoft Admin
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
6.2 Configure routing
Set up PSTN identity and voice route details.
#: Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="VOIP"}
#: New-CsOnlineVoiceRoute -Identity "VOIP" -NumberPattern ".*" -OnlinePstnGatewayList "ms50000400.teams.sipcity.com.au" -Priority 1 -OnlinePstnUsages "VOIP"
#: New-CsOnlineVoiceRoutingPolicy -Identity "VOIP" -OnlinePstnUsages "VOIP"
6.3 Assign phone numbers to users
If you have multiple users, assign a phone number to each Teams user. The example below assigns +61 (2) 5550 0000 to [email protected] with the Identity set to “VOIP”. Replace as needed for your users.
#: Set-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber +61255500000 -PhoneNumberType DirectRouting #: Grant-CsTeamsCallingPolicy -PolicyName AllowCalling -Identity [email protected] #: Grant-CsOnlineVoiceRoutingPolicy -Identity [email protected] -PolicyName "VOIP" #: Set-CsOnlineVoicemailUserSettings -Identity [email protected] -VoicemailEnabled $false
6.4 Disconnect from Microsoft Teams (optional)
Optionally, disconnect your PowerShell session.
#: Disconnect-MicrosoftTeams
Your SIPcity account is now fully set up and connected to your Microsoft 365 account.
Microsoft Teams, Microsoft Windows, and PowerShell are trademarks or registered trademarks of Microsoft Corporation in the US and other countries. macOS is a registered trademark of Apple Inc.




