This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Set-Cs Phone Number Assignment
This cmdlet will assign a phone number to a user or a resource account (online application instance).
Description
This cmdlet assigns a phone number to a user or resource account. When you assign a phone number the EnterpriseVoiceEnabled flag is automatically set to True.
To remove a phone number from a user or resource account, use the Remove-CsPhoneNumberAssignment cmdlet.
If the cmdlet executes successfully, no result object will be returned. If the cmdlet fails for any reason, a result object will be returned that contains a Code string parameter and a Message string parameter with additional details of the failure.
Note : In Teams PowerShell Module 4.2.1-preview and later we are changing how the cmdlet reports errors. Instead of using a result object, we will be generating an exception in case of an error and we will be appending the exception to the $Error automatic variable. The cmdlet will also now support the -ErrorAction parameter to control the execution after an error has occurred.
This example assigns the Microsoft Calling Plan phone number +1 (206) 555-1234 to the user [email protected]
This example finds the emergency location defined for the corporate location Vancouver and assigns the Microsoft Calling Plan phone number +1 (206) 555-1224 and location to the user [email protected]
This example sets the EnterpriseVoiceEnabled flag on the user [email protected]
This example removes the emergency location from the phone number for user [email protected]
This example assigns the Direct Routing phone number +1 (425) 555-1225 to the resource account [email protected]
This example assigns the Direct Routing phone number +1 (425) 555-1000;ext=1234 to the user [email protected]
This example shows how to use Try/Catch and ErrorAction to perform error checking on the assignment cmdlet failing.
-EnterpriseVoiceEnabled
Flag indicating if the user or resource account should be EnterpriseVoiceEnabled.
This parameter is mutual exclusive with PhoneNumber.
The Identity of the specific user or resource account. Can be specified using the value in the ObjectId, the SipProxyAddress, or the UserPrincipalName attribute of the user or resource account.
-LocationId
The LocationId of the location to assign to the specific user. You can get it using Get-CsOnlineLisLocation.
Removal of location from a phone number is supported for Direct Routing numbers and Operator Connect numbers that are not managed by the Service Desk. If you want to remove the location, use the string value null for LocationId.
-PhoneNumber
The phone number to assign to the user or resource account. Supports E.164 format like +12065551234 and non-E.164 format like 12065551234. The phone number can not have "tel:" prefixed.
We support Direct Routing numbers with extensions using the formats +1206555000;ext=1234 or 1206555000;ext=1234 assigned to a user account, but such phone numbers are not supported to be assigned to a resource account.
Setting a phone number will automatically set EnterpriseVoiceEnabled to True.
-PhoneNumberType
The type of phone number to assign to the user or resource account. The supported values are DirectRouting, CallingPlan, and OperatorConnect. When you acquire a phone number you will typically know which type it is.
System.Object
The cmdlet is available in Teams PowerShell module 3.0.0 or later.
The cmdlet is only available in commercial and GCC cloud instances.
If a user or resource account has a phone number set in Active Directory on-premises and synched into Microsoft 365, you can't use Set-CsPhoneNumberAssignment to set the phone number. You will have to clear the phone number from the on-premises Active Directory and let that change sync into Microsoft 365 first.
The previous command for assigning phone numbers to users Set-CsUser had the parameter HostedVoiceMail. Setting HostedVoiceMail for Microsoft Teams users is no longer necessary and that is why the parameter is not available on Set-CsPhoneNumberAssignment.
Related Links
- Remove-CsPhoneNumberAssignment
- Get-CsPhoneNumberAssignment
Submit and view feedback for
Additional resources

Adding a phone number to a teams resource account in PowerShell
- By: Denny Cherry
- Published On: September 21, 2020
Recently I was setting up a new phone number queue in Microsoft Teams. As part of this, I was trying to set up a new phone number for the queue. The problem was that every time I tried the Microsoft Teams admin page said that I didn’t have any available phone numbers even though I knew for a fact that I had a phone number current available and set up as a service phone number.

The solution to this was to use the PowerShell cmdlet Set-CsOnlineVoiceApplicationInstance to update the Resource Account with the correct phone number. The problem was that everything online said to connect to SkypeOnline with PowerShell, but nothing every said what needed to get that done. (Yes, this cmdlet is from Skype for Business not Teams, even though this is being done through Teams.)
I was eventually able to piece together what needed to be done.
Skype For Business cmdlet modules aren’t available through install-module. They need to be downloaded and installed from the Microsoft Website .
After the installer is run, open a new PowerShell window in Admin mode.
From there use PowerShell to authenticate and connect to SkypeOnline.
If you don’t have MFA configured use the following PowerShell code.
If you have MFA configured then use the following PowerShell code.
Once you’ve complete that use the following code to assign the phone number to the Resource Account.
Now keep in mind that I’m using a US Phone number here, hence the +1. If you are in another country your country code will be different. Whatever the phone number that you have available as a service phone number is the phone number that you enter here.
Once this cmdlet was done the phone number listed was allocated to the resource account, and the phone number was setup and ready to go.
One Response
Yep – I worked so hard to figure this out as well. I just figured out what you posted and then found your article. Glad you have posted this as I know we aren’t the only ones struggling with this.
The Microsoft documentation talks in circles!

Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
This site uses Akismet to reduce spam. Learn how your comment data is processed .
Trust DCAC with your data
Your data systems may be treading water today, but are they prepared for the next phase of your business growth?

- Privacy Overview
- Strictly Necessary Cookies
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
- IT Resources
- Windows Server
- System Center
- Microsoft Edge
- Exchange Server
- SharePoint Products
- Skype for Business
- See all products »
- Channel 9 Video
- Evaluation Center
- Learning Resources
- Microsoft Tech Companion App
- Microsoft Technical Communities
- Microsoft Virtual Academy
- Script Center
- Server and Tools Blogs
- TechNet Blogs
- TechNet Flash Newsletter
- TechNet Gallery
- TechNet Library
- TechNet Magazine
- TechNet Wiki
- Windows Sysinternals
- Virtual Labs
- Cloud and Datacenter
- Virtualization
- Service Packs
- Security Bulletins
- Windows Update
- Windows Server 2016
- System Center 2016
- Windows 10 Enterprise
- SQL Server 2016
- See all trials »
Related Sites
- Microsoft Download Center
- Microsoft Evaluation Center
- Expert-led, virtual classes
- Training Catalog
- Class Locator
- Free Windows Server 2012 courses
- Free Windows 8 courses
- SQL Server training
- Microsoft Official Courses On-Demand
Certifications
- Certification overview
- Special offers
- MCSE Cloud Platform and Infrastructure
- MCSE: Mobility
- MCSE: Data Management and Analytics
- MCSE Productivity
Other resources
- Microsoft Events
- Exam Replay
- Born To Learn blog
- Find technical communities in your area
- Azure training
- Official Practice Tests
Support options
- For business
- For developers
- For IT professionals
- For technical support
- Support offerings
More support
- Microsoft Premier Online
- TechNet Forums
- MSDN Forums
- Security Bulletins & Advisories
Not an IT pro?
- Microsoft Customer Support
- Microsoft Community Forums
- Forums home
- Browse forums users
- Remove From My Forums
Answered by:
Add resource account to call queue in teams using powershell.
I can create a Resource Account and a Call Queue using Powershell, but I don't see how to add that account to the Call Queue using Powershell.
Is this possible?
In order to make this work, it is first necessary to assign a UsageLocation to the Msol User of the application instance.
- Proposed as answer by sharon_zhao Microsoft contingent staff Wednesday, December 25, 2019 10:01 AM
- Marked as answer by Simon Univonix Shaw Monday, December 30, 2019 6:58 AM
Here I will provide a brief summary of this post. This will make answer searching easier in the forum .
<Request/Expectation>:
I can create a Resource Account and a Call Queue using PowerShell, but I don't see how to add that account to the Call Queue using PowerShell.
<S uggestions >:
In order to make this work, it is first necessary to assign a UsageLocation to the Msol User of the application instance.
<Reference Links>:
https://ucstatus.com/2019/05/14/how-to-assign-a-direct-routing-number-to-an-auto-attendant-or-call-queue-in-microsoft-teams-phone-system/
https://docs.microsoft.com/en-us/microsoftteams/manage-resource-accounts#create-a-resource-account-in-powershell
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
Best Regards, Sharon Zhao Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected] .
- Marked as answer by Simon Univonix Shaw Monday, December 30, 2019 7:12 AM
All replies
In my research, it seems that you can use the following command to create a resource account online for use with a Call Queue:
New-CsOnlineApplicationInstance -UserPrincipalName [email protected] -ApplicationId “11cd3e2e-fccb-42ad-ad00-878b93575e07” -DisplayName "Resource account 1"
The parameter “ApplicationId” is the application ID that you need to use while creating the application instances are:
Auto Attendant: ce933385-9390-45d1-9512-c8d228074e07
Call Queue: 11cd3e2e-fccb-42ad-ad00-878b93575e07
For more details, please refer to:
Best Regards, Sharon Zhao
- Edited by sharon_zhao Microsoft contingent staff Tuesday, December 3, 2019 4:51 AM
Thanks Sharon,
I did manage to create a Resource Account, assign a license and PSTN number to it using PowerShell.
I also managed to create a Call Queue using PowerShell.
What I would like to do now is to associate the the Resource Account with the Call Queue also using PowerShell.
I didn’t find the related command to realize this for now.
I will continue to search the related command. If there is any update, I will share with you.
- Edited by sharon_zhao Microsoft contingent staff Friday, December 6, 2019 10:14 AM
Is there any update on this case?
Please feel free to drop us a note if there is any update.
Have a nice day!
Thanks for your sharing.
Meanwhile, if there is no issue, please remember to mark helpful reply as answer to close the thread. Your action would be helpful to other users who encounter the same issue and read this thread.
Thanks for your understanding.

IMAGES
VIDEO
COMMENTS
To assign a Direct Routing or hybrid number to a resource account, you need to use PowerShell: PowerShell Set-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber +19295550150 -PhoneNumberType DirectRouting Next steps
The type of phone number to assign to the user or resource account. The supported values are DirectRouting, CallingPlan, and OperatorConnect. When you acquire a phone number you will typically know which type it is. Inputs None Outputs System.Object Notes The cmdlet is available in Teams PowerShell module 3.0.0 or later.
If you have MFA configured then use the following PowerShell code. Import-Module SkypeOnlineConnector $sfbSession = New-CsOnlineSession Import-PSSession $sfbSession Once you’ve complete that use the following code to assign the phone number to the Resource Account.
Although, when trying to assign the number through the GUI, it is possible and with no issue. Here's an example of the command I'm trying to use Set-CsOnlineVoiceApplicationInstance -Identity $ID -TelephoneNumber -33xxxxxxxx Of course a virtual license is assigned to the account.
Assign TelephoneNumber to Resource Account (AutoAttendant) Create CallQueue Create AutoAttendant (Redirect Call to Call Queue) Assign Resource Account (Call Queue) to Call Queue Assign Resource Account (AutoAttendant) to AutoAttendant Labels: Administrator Community How-to Microsoft Teams 13.5K Views 1 Like 8 Replies Reply
Resource accounts can use either toll or toll-free service numbers. You can request new numbers or port existing numbers from another carrier. You should check this topic. If it is a new phone number you can see how to do in: https://docs.microsoft.com/en-us/microsoftteams... Else, you can see: https://docs.microsoft.com/en-us/microsoftteams...
Assign the Resource account a Virtual Phone User licence Assign the Resource Account a Call Queue and a telephone number I'm stuck at the last element. I can see the resource account in https://admin.teams.microsoft.com/company-wide-settings/resource-accounts I click 'Assign' and set the Phone Number Type to Online.
In my research, it seems that you can use the following command to create a resource account online for use with a Call Queue: New-CsOnlineApplicationInstance -UserPrincipalName [email protected] -ApplicationId “11cd3e2e-fccb-42ad-ad00-878b93575e07” -DisplayName "Resource account 1"