The first configuration requirement of Microsoft Teams integration is the PSTN gateway activation, also referred to as Microsoft 365 DNS verification. This will require a global administrator account in your Microsoft 365 tenancy.

Some of these steps are completed from inside the VoIPcloud web portal, some from inside the Microsoft 365 Admin portal and others are done through PowerShell

Should you need any help with the integration with Microsoft Teams, our dedicated support department are on hand to assist via phone, email and online chat.  

Microsoft 365 DNS verification

The first process is to verify the domain name that is automatically populated, from within your Microsoft 365 portal. Start by login to your VoIPcloud customer portal and select the 'Order Services' tab and then the submenu 'Microsoft Teams'. Locate the pre-populated Microsoft 365 FQDN address, copy this to your clipboard. 

The FQDN will always be in the format of where x is a number, and yy is a country prefix. 


Next, log in to your Microsoft 365 admin portal as a global administrator. If you are unsure whether you have an administrator account, please contact your IT support company for assistance.


Once you are inside the Microsoft 365 Admin portal, select the 'Setup' tab from the left-hand toolbar, then the 'Domains' option. You are now inside the Microsoft 365 domain settings, click on the 'Add domain' button located at the top of the page.


You will now have a domain wizard appear that will allow you to enter your unique Microsoft 365 FQDN you previously copied from inside your VoIPcloud customer portal.


Copy the Microsoft 365 FQDN, from your VoIPcloud customer portal to the 'Enter a domain you own' field as shown above, this will be in the format Double check that the Microsoft 365 FQDN you have copied from the VoIPcloud customer portal against the domain you have entered in the 'Add a domain' field inside Microsoft 365 admin, once you have double checked the domain click the next button. 


There is a small chance that you might be asked which verification method you prefer. If prompted with the menu below please select 'Add a TXT record instead' and click the next button.  


Now you will be prompted to verify the domain name that you have just entered, Microsoft 365 will provide you a value for a TXT record. This is shown in the screenshot below under the TXT value, copy the full value of that record, which will always be in the format MS=msxxxxxxx, into the Microsoft 365 TXT record field inside your VoIPcloud customer portal. Do not attempt to press the verify button until you have added the TXT record to your VoIPcloud customer portal. 


Once you have added the TXT record to your VoIPcloud customer portal, you will need to start adding your Microsoft Teams users. Please note that at least one user and phone number must also be added, in order to submit the order and verify the DNS record, without this the TXT record you have just added will not save, and you will not be able to verify the domain from inside your Microsoft 365 portal.


Adding users is completed by clicking the 'Add' button on the right-hand side of your VoIPcloud customer portal. Once clicked, you will be presented with two fields, one for Microsoft 365 username and the other to assign a Phone number. In the Microsoft 365 username field, enter your Microsoft 365 Teams email address. The phone number field is a drop-down menu where you can select any numbers that have not been allocated to your inbound call flow. If you do not have any available phone numbers in the drop-down menu, you will need to click on option 2 'Phone numbers', of the order services tab, to order additional numbers. If you do not have any available numbers, you will be presented with the error shown below. 


The phone number that you assign to your Microsoft 365 username, will be used to establish the direct route to the Microsoft Teams user. Please note that the phone number picked here CANNOT be used in any inbound call flow. The number will be reserved for this Microsoft Teams user, and calls will route directly to the Microsoft Teams user in your Microsoft 365 tenancy. Ensure that publicly advertised and toll-free numbers are NOT assigned to Microsoft Teams users. Additional numbers will need to be reserved, as previously outlined from option 2 'Phone numbers' (DID subscription charges apply) for the Microsoft Teams user.


You have now successfully added your TXT record to the pre-populated domain added your Microsoft Teams users. The next step is to go back to the Microsoft 365 portal and click the verify button to complete the domain creation on the Microsoft 365 portal. If you see any errors please make sure that the TXT record has been added to your VoIPcloud customer portal, under the Microsoft 365 TXT record field. 


Once you have verified the domain, ensure no additional online services (exchange, Skype for Business, mobile device management) are selected, and click the next button. 



Microsoft 365 domain activation

When the DNS record has been verified, the next stage is activating the domain. This is essential, as without activating the domain the integration will not function correctly. To activate the domain, you need to add a new user to that domain, WITH an Microsoft 365 license assigned, this is provided by your Microsoft 365 license provider, not VoIPcloud. Start by clicking on the 'Users' tab on the left-hand side of the Microsoft 365 Admin portal, then active users. Click on the Add a user button located at the top of the page. 


You will now be presented with a user creation wizard. The name isn't important for the user. For example, we will be making the user distinguishable, you can name the user Select the domain from the domain drop-down window. Ensure a product license is assigned to this user or the domain will NOT activate. This license can even be reassigned temporarily from another user if a spare license is not available.


You can verify when the domain has been activated by running a PowerShell command. See the below section 'Microsoft Teams PowerShell configuration' for further details, or should you require any assistance feel free to contact our support department by phone, email or online chat. 

Microsoft Teams PowerShell configuration

If you are not confident working with a command prompt, we would strongly recommend contacting our support team, via phone, email or online chat for assistance. To set up this domain for Direct Routing in Microsoft 365, several PowerShell commands are needed. Make sure PowerShell is launched as an administrator, otherwise these commands will not work.

Note: Powershell comes with all current versions of Windows. These instructions assume you are using a Windows 10 computer. 

To open PowerShell as an administrator, search for it in the search menu in the lower-left corner of the screen, by typing in 'PowerShell' without the quotes. You should see an item named Windows PowerShell. Right-click on this and click Run as administrator


When launched as an administrator, you may be asked if you want to allow the Windows Powershell app to make changes to your computer. Click yes and you will be taken to a blank blue Powershell screen. This is where you enter the required commands to set up Microsoft Teams Direct Routing




Note: You will need to ensure the Skype for Business PowerShell module is installed. Please go to, download and install the PowerShell module. When installed, you can import into PowerShell using the following command:

Import-Module SkypeOnlineConnector

If this command fails, you may need to import by using the full file path to the PowerShell module. Please note the path may vary on your system, but an example would be:

Import-Module "C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector\SkypeOnlineConnector.psd1"

That is assuming the module installed to the above file path. Please double-check where that has been installed to ensure you enter the correct full path.

When the module has been imported, restart PowerShell and connect to your Microsoft 365 tenant using the following commands:

$credential = Get-Credential

This will prompt you for your Microsoft 365 Global Administrator credentials. Once entered, the following commands will connect PowerShell to your Microsoft 365 tenancy:

$session = New-CsOnlineSession -Credential $credential -Verbose
Import-PSSession $session -Verbose -AllowClobber

You will see some output on-screen as Powershell executes these commands. When it is complete, yo
u can proceed with the rest of the configuration. Please note that you will need to check what SBC domain you have been allocated on the Order Services tab of your VoIPcloud customer portal. This will be the same domain you've added to Microsoft 365 previously.

It is a good idea to copy that domain from the web portal so you can paste it into the required fields in the below commands. Bolded sections of these commands need to be checked as parts of them will need to be replaced with the appropriate details as noted below.

New-CsOnlinePSTNGateway -Fqdn "" -SipSignalingPort 5061 -SendSipOptions $false -Enabled $true -ForwardCallHistory $true -ForwardPai $true

Where X is the number of the Microsoft 365 FQDN address allocated as per the VoIPcloud customer portal, and YY is the country prefix as seen in the Microsoft 365 FQDN address

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="VC YY PSTNUsage"}
New-CsOnlineVoiceRoutingPolicy "VC YY VoiceRoutingPolicy" -OnlinePstnUsages "VC YY PSTNUsage"
Remove-CsOnlineVoiceRoute -Identity "LocalRoute"

The final command is:

New-CsOnlineVoiceRoute -Identity "VC YY VoiceRoute" -NumberPattern ".*" -OnlinePstnGatewayList -Priority 0 -OnlinePstnUsages "VC YY PSTNUsage"

The domain setup has been completed. 
The next step is to configure the Microsoft Teams users. Before doing that, please ensure that each Microsoft Teams user has the Microsoft 365 Phone Systems add-on license, which requires E1 licensing or greater, in addition to the Phone System add-on.

Please also wait for a few minutes after domain configuration before attempting to configure users. The next section 'Microsoft Teams user configuration' goes through the per-user PowerShell commands required to set up each Microsoft Teams user with Direct Routing. 


Microsoft Teams user configuration

There are three PowerShell commands that you need to run for each Microsoft Teams user. These will set up each Microsoft Teams user with the individual phone numbers assigned to them from the VoIPcloud customer portal. The commands are:

Set-CsUser -Identity "Teams username" -EnterpriseVoiceEnabled $true -HostedVoiceMail $false -OnPremLineURI "tel:+PHONE NUMBER"
Set-CsUserPstnSettings -Identity "Teams username" -AllowInternationalCalls $false -HybridPSTNSite $null 
Grant-CsOnlineVoiceRoutingPolicy -Identity "Teams username" -PolicyName "VC YY VoiceRoutingPolicy"

The Microsoft Teams username above will need to be replaced with your Microsoft 365 email address, as set up on the VoIPcloud customer portal. The Set-CsUser command also requires a phone number. The words 'PHONE NUMBER' in that command need to be replaced with the phone number allocated to this user in your VoIPcloud customer portal, in the format of 'tel+xxxxxxxxxxx'. The digits will need to match exactly what is shown on the VoIPcloud customer portal.

The above commands will need to be repeated for each Microsoft Teams user account you have added on your VoIPcloud customer portal. If your Microsoft Teams client was open during this, please close and open it again (or sign out and back in).  On the Calls tab, you should see the number allocated to the Teams user

If the dial pad does not appear on the calls tab as per the below screenshot, please wait and check again later. It can take several hours, sometimes even up to 48 hours, for the dial pad to appear


When you've configured all of your Microsoft Teams users, run the command below to terminate the PowerShell session and free up any resources the session was using.

Remove-PSSession $session


Microsoft Teams PBX user configuration

The final step is to assign the newly configured Microsoft Teams accounts on the PBX page of your VoIPcloud customer portal. How exactly you do this will depend on your requirements. You'll need to set up the Microsoft Teams account on either a user object or on a SIP trunk.

If you are looking to integrate Microsoft Teams with the full range of VoIPcloud PBX features, you will be adding the Microsoft Teams account(s) to user object(s) as detailed below:


To begin configuring a user, click on the PBX tab from inside your VoIPcloud customer portal, drag the user object from the left-hand toolbar onto the call flow screen. With the user object on the screen click on the setting gear icon, which will open the setting for the user object and allow you to select devices. 


In the upper-right section of the user's component settings, click the green add button and select Microsoft Teams & Skype for Business Integration


Next, from inside the dropdown menu, select the Microsoft Teams user account you want to assign to this user object. Then click the add button, and then press the blue save button in the lower right corner of the user object. Finally, don't forget to apply the configuration after making changes to these user objects


If you are not interested in using the VoIPcloud features and wanted to use the VoIPcloud service only for call termination, you can instead add each Microsoft Teams account to a SIP trunk object, as detailed below. 


To begin configuring a SIP trunk, click on the PBX tab from inside your VoIPcloud customer portal, drag the SIP trunk object from the left-hand toolbar onto the call flow screen. With the SIP trunk object on the screen click on the setting gear icon, which will open the setting for the SIP trunk object and allow you to add your Microsoft Teams users. 


From inside the settings of the SIP trunk object, change the trunk mode to 'Microsoft PSTN gateway'


Ensure a call plan is selected for the trunk in order to make outbound calls. Then click the 'Add' button which will allow you to select your Microsoft Teams users. You will see a list of users appear. Tick the ones you wish to add to this trunk, and click the add and save buttons


Don't forget to apply the configuration after making changes to these user objects. 


Please note that each Microsoft Teams account must be assigned to a User object or SIP trunk in order to make outbound calls. If you have insufficient user or SIP trunk licenses, you will need to add more user licenses via the order services tab of your VoIPcloud portal. Should you require any assistance feel free to contact our support department by phone, email or online chat.