Creating a resource account and assigning a Direct Routing DID

This guide runs through how to create a resource account and assign a Teams Direct Routing DID to the account for use as a Queue or IVR.

Due to Teams Direct Routing being a fairly new product theres a few items that still have to be configured via PowerShell. By default Microsoft doesn't allow you to assign a DID from a Direct Routing trunk to a Resource account for use with a Queue or IVR configuration.

You can get around this limitation by using the "Skype For Business" and "AzureAD" (MSOnline) PowerShell plugins.


You will need to install some modules into PowerShell before you begin. You may already have these modules, if you have them installed already it will notify you.

  1. Install the "Skype for Business PowerShell plugin" -

  2. Install the Microsoft Teams Module - Install-Module MicrosoftTeams

  3. Run this command to get the "AzureAD" plugin - Install-Module MSOnline

Microsoft have discontinued the use of the Skype for Business Powershell plugin, you will need to install the new Teams module instead

Connecting to the Cloud Services

To create the resource account we will need to connect to Skype for Business and AzureAD modules so we can run the commands we need. It will make you login twice as we will be connecting to two different services for Microsoft Teams.

Connect to Microsoft Teams with the below commands, when connecting you will be prompted for the Teams Admin credentials. Any user with Admin access should be able to login.

Import-Module MicrosoftTeams

Import the MSOnline module and connect to AzureAD with the below command

Import-Module MSOnline

To verify you are connected successfully you can run the below commands, they should return user information for you

Get-CSOnlineUser | select DisplayName ## Skype for Business Command
Get-MsolUser ## AzureAD Command

Creating the resource account/s & Assigning DIDs

Now that we are connected we can proceed with creating the resource accounts, some functions can take a few moments to sync with Microsoft's servers once they're run so if you encounter not found errors try again after a few minutes.

1 - Create the Resource Account

Run the below commads within the PowerShell window, change the application ID to suit one of the two below (depending on what you want to deploy). Adding these application ID's is the same as pressing "AutoAttendant" or "Call Queue" in the Admin Panel.

Auto-Attendant ID - ce933385-9390-45d1-9512-c8d228074e07 Call Queue ID - 11cd3e2e-fccb-42ad-ad00-878b93575e07

You will need to modify the below command with some information specific to your deployment, anything surrounded by "<" and ">" will need to be changed

New-CsOnlineApplicationInstance -UserPrincipalName <resource_emailaddress> -ApplicationId “<type_id>” -DisplayName "<resource_displayname>"

## Here is an example of a Call Queue account
New-CsOnlineApplicationInstance -UserPrincipalName -ApplicationId “11cd3e2e-fccb-42ad-ad00-878b93575e07” -DisplayName "Resource Account - Call Queue 1"

Once that is created we need to assign a location to the account.

Set-MsolUser -UserPrincipalName "<resource_emailaddress>" -UsageLocation AU

Set-MsolUser -UserPrincipalName "" -UsageLocation AU

You will then need to assign a licence to it, you can find what licences you have with the below command. You can also assign a "Phone System - Virtual User" licence if you have them.

## Use this to get your licence type/s

## Grab the value in the "AccountSkuID" column and run the below command
Set-MsolUserLicense -UserPrincipalName <resource_emailaddress> -AddLicenses "<accountSkuId>"

Set-MsolUserLicense -UserPrincipalName -AddLicenses "reseller-account:ENTERPRISEPREMIUM"

Assigning DIDs to Resource Accounts

Once you have created your Resource Account, assigned it a location and given it a licence you can then assign a DID to the account.

## Ensure the DID isn't in use anywhere else, if it is you will get an error
## as it cannot exist twice

Set-CsOnlineApplicationInstance -Identity "<resource_emailaddress>" -OnPremPhoneNumber +61<fnn>

Set-CsOnlineApplicationInstance -Identity "" -OnPremPhoneNumber +61289998000 

Once that command completes successfully you should be able to login to the Teams admin panel, navigate to Org-Wide Settings >> Resource Accounts and in the table that appears you should see the DID you just assigned.

You can now assign this Resource account to either a Auto-Attendant or a Call Queue (depending on the Application ID you selected)

Last updated