This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Get-Cs Phone Number Assignment

This cmdlet displays information about one or more phone numbers.

Description

This cmdlet displays information about one or more phone numbers. You can filter the phone numbers to return by using different parameters.

Returned results are sorted by TelephoneNumber in ascending order.

If you are using both -Skip X and -Top Y for filtering, the returned results will first be skipped by X, and then the top Y results will be returned.

By default, this cmdlet returns a maximum of 500 results.

This example displays information about the Microsoft Calling Plan subscriber phone number +1 (402) 555-1234. You can see that it is assigned to a user.

This example displays information about the Direct Routing phone number +1 (206) 555-1000;ext=524. You can see that it is assigned to a user.

This example returns all phone numbers that have both the capability VoiceApplicationAssignment and the capability ConferenceAssignment assigned, but phone numbers that have only one of these capabilities assigned won't be returned.

This example returns information about the phone number assigned to [email protected].

This example returns information about the phone number assigned to resource account [email protected].

This example returns information about all activated phone numbers with the capability VoiceApplicationAssignment that are not assigned.

This example returns information about all phone numbers that contain the digits 524, including the phone number with extension 524 used in example 2.

This example returns the number of Calling Plan subscriber phone numbers that are either assigned or not assigned to users.

This example returns the number of Calling Plan or Operator Connect service phone numbers that can be assigned to voice applications and conference bridges.

This example returns all phone numbers.

This example returns all phone numbers assigned as emergency numbers in the Teams shared calling routing policy instance SC1.

-ActivationState

Filters the returned results based on the number type. Supported values are Activated, AssignmentPending, AssignmentFailed, UpdatePending, and UpdateFailed.

-AssignedPstnTargetId

Filters the returned results based on the user or resource account ID the phone number is assigned to. Supported values are UserPrincipalName, SIP address, ObjectId, and the Teams shared calling routing policy instance name.

-AssignmentCategory

This parameter is reserved for internal Microsoft use.

-CapabilitiesContain

Filters the returned results based on the capabilities assigned to the phone number. You can specify one or more capabilities delimited by a comma. Supported capabilities are ConferenceAssignment, VoiceApplicationAssignment, UserAssignment, and TeamsPhoneMobile.

If you specify only one capability, you will get all phone numbers returned that have that capability assigned. If you specify a comma separated list for instance like ConferenceAssignment, VoiceApplicationAssignment you will get all phone numbers that have both capabilities assigned, but you won't get phone numbers that have only VoiceApplicationAssignment or ConferenceAssignment assigned as capability.

-CivicAddressId

Filters the returned results based on the CivicAddressId assigned to the phone number. You can get the CivicAddressId by using Get-CsOnlineLisCivicAddress .

-IsoCountryCode

Filters the returned results based on the ISO 3166-1 Alpha-2 country code assigned to the phone number.

-LocationId

Filters the returned results based on the LocationId assigned to the phone number. You can get the LocationId by using Get-CsOnlineLisLocation .

-NetworkSiteId

-numbertype.

Filters the returned results based on the number type. Supported values are DirectRouting, CallingPlan, and OperatorConnect.

-PstnAssignmentStatus

Filters the returned results based on the assignment status. Support values are Unassigned, UserAssigned, ConferenceAssigned, VoiceApplicationAssigned, ThirdPartyAppAssigned, and PolicyAssigned.

Skips the first X returned results and the default value is 0.

-TelephoneNumber

Filters the returned results to a specific phone number. It is optional to specify a prefixed "+". The phone number can't have "tel:" prefixed. We support Direct Routing numbers with extensions using the formats +1206555000;ext=1234 or 1206555000;ext=1234.

-TelephoneNumberContain

Filters the returned results based on substring match for the specified string on TelephoneNumber. To search for a number with an extension, you need to specify the digits of the extension. For supported formats see TelephoneNumber.

-TelephoneNumberGreaterThan

Filters the returned results based on greater than match for the specified string on TelephoneNumber. Can be used together with TelephoneNumberLessThan to specify a range of phone numbers to return results for. For supported formats see TelephoneNumber.

-TelephoneNumberLessThan

Filters the returned results based on less than match for the specified string on TelephoneNumber. Can be used together with TelephoneNumberGreaterThan to specify a range of phone numbers to return results for. For supported formats see TelephoneNumber.

-TelephoneNumberStartsWith

Filters the returned results based on starts with string match for the specified string on TelephoneNumber. For supported formats see TelephoneNumber.

Returns the first X returned results and the default value is 500.

ActivationState

The activation state of the telephone number.

AssignedPstnTargetId

The ID of the object the phone number is assigned to, either the ObjectId of a user or resource account or the policy instance ID of a Teams shared calling routing policy instance.

AssignmentCategory

The list of capabilities assigned to the phone number.

The city where the phone number is located.

CivicAddressId

The ID of the CivicAddress assigned to the phone number.

IsoCountryCode

The ISO country code assigned to the phone number.

IsoSubDivision

The subdivision within the country/region assigned to the phone number, for example, the state for US phone numbers.

The ID of the Location assigned to the phone number.

LocationUpdateSupported

Boolean stating if updating of the location assigned to the phone number is allowed.

NetworkSiteId

NumberSource

The source of the phone number. Online for phone numbers assigned in Microsoft 365 and OnPremises for phone numbers assigned in AD on-premises and synchronized into Microsoft 365.

The type of the phone number.

The ID of the operator.

PortInOrderStatus

The status of any port in order covering the phone number.

PstnAssignmentStatus

The assignment status of the phone number.

PstnPartnerId

The ID of the PSTN partner providing the phone number.

PstnPartnerName

The name of the PSTN partner.

TelephoneNumber

The phone number. The number is always displayed with prefixed "+", even if it was not assigned using prefixed "+".

The object returned is of type SkypeTelephoneNumberMgmtCmdletAcquiredTelephoneNumber.

The cmdlet is available in Teams PowerShell module 4.0.0 or later. The parameter AssignmentCategory was introduced in Teams PowerShell module 5.3.1-preview. The parameter NetworkSiteId was introduced in Teams PowerShell module 5.5.0. The output parameter NumberSource was introduced in Teams PowerShell module 5.7.0.

The cmdlet is only available in commercial and GCC cloud instances.

Related Links

  • Remove-CsPhoneNumberAssignment
  • Set-CsPhoneNumberAssignment

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

Get all available user numbers in Calling Plans

By Robert Dyjas on Feb 17, 2021 . Last edit: Jun 20, 2023  •  Edit this post

  • calling plan

You can check how many numbers you have in your Teams Calling Plans. PowerShell cmdlet to use is Get-CsPhoneNumberAssignment.

Description

In the example below, we'll list all the user numbers. We're only interested in the ones, which are available to assign. Therefore, we'll filter out the numbers already assigned.

The most frequent use-case for such listing will be to find out a number, which can be assigned to a new employee.

We'll use the Teams PowerShell module. Since version 2.0 the cmdlet for connecting is:

The cmdlet we used in the previous version of this article was Get-CsOnlineTelephoneNumber . However, that one is currently decommissioned. Its replacement is Get-CsPhoneNumberAssignment .

The set of parameters we need to use is:

Parameters we use:

  • CapabilitiesContain - in our example we're only interested in user numbers
  • NumberType - we don't consider direct routing or operator connect in our example. If you're looking for non-Microsoft numbers, you'd have to update the value accordingly
  • PstnAssignmentStatus - we need to assign the number afterwards. If the number was already assigned, we'd not be interested in it

Supporting more than 500 numbers

The example above will return only the first 500 numbers. If we have a larger tenancy, we'd need to consider the fact that we might have more numbers available.

The new cmdlet doesn't have a ResultSize parameter we could use. We need to run the cmdlet in a loop using Top and Skip parameters. An example of how we can do that is shown below:

Processing data

Now we have our numbers saved into a variable. We can process them, as we need.

Few examples:

get csphonenumberassignment

AdamFowlerIT.com

Microsoft teams powershell phone number assigning cmdlet change.

Microsoft has sent out an announcement on PowerShell changes for setting and removing phone numbers in Microsoft Teams:

Changes coming to phone number assignment using Teams PowerShell Module cmdlets MC316139 · Published 19 Jan 2022

In summary, these commands are being deprecated “The retirement is planned to begin in early April and be complete by mid-April.” :

Set-CsOnlineVoiceUser Set-CsOnlineApplicationInstance Set-CsOnlineVoiceApplicationInstance

and Set-CSUser can’t be used to allocate phone numbers either. I’d been allocating numbers with the Set-CsOnlineVoiceUser command. The replacement for this is:

Set-CsPhoneNumberAssignment and Remove-CsPhoneNumberAssignment

They run under the MicrosoftTeams module for PowerShell, but you also need to make sure you have the latest version. If you don’t have a version that supports this new command, you’ll get the error:

To update, run the command:

Then try the above cmdlet again. If you’re feeling really brave, you can update all your modules with:

Disconnect or restart PowerShell or you’ll get problems running the new cmdlet if you had it connected while updating.

The new cmdlet Set-CsPhoneNumberAssignment doesn’t work exactly the same way as the old cmdlets. Read the documentation for more details

The options for -PhoneNumberType (required) are DirectRouting, CallingPlan and OperatorConnect.

I’d suggest testing and migrating soon, before you miss the April deadline of the command being dropped.

Share this:

Other blog posts, 17 thoughts on “ microsoft teams powershell phone number assigning cmdlet change ”.

Same issue with Telstra in Australia for me Adam – 24/01/2022 – I thought I was going nuts with licences until I read the first part of your post.

Hi Ben, I’ve had Microsoft confirm it’s a bug, hopefully fixed soon :)

Yes it is fixed now. I have try it today and able to assign the phone number.

Yes it’s now fixed :)

Hi Ben & Adam, First of all thank you for this post, it was very helpful. I am also located in Australia and use Telstra / Teams Phone in my organisation. Have either of you experienced issues assigning a phone number to a new user in both the Teams Admin portal & PowerShell over the last couple of weeks? I cannot assign a number to one specific new user (other new users created since have no problem) and the date I first noticed this issue seems to coincide with this post/Cmdlet Change (late Jan 2022).

In Teams Admin portal I get the error “We can’t save changes for number +61 X XXXX XXXX right now. Try again later.” when assigning a number to this user.

And in PowerShell I get the following result using the updated Cmdlet above:

Code Message —- ——- BadRequest The user ” is not found

I have tried multiple unassigned user numbers we have, even ones from completely different ranges. I have confirmed licencing (including removing and re-adding the licence), I’ve confirmed the user’s TenantID and ObjectID is matching. I’ve compared the output of Get-CsOnlineVoiceUser against another working user and all the details match (including SIPDomain, DataCenter, TenantId, LicenceState, PSTNConnectivity = True, UsageLocation and EnterpriseVoiceEnabled = True). Confirmed a valid emergency location is set (the same as our other 180 users). Nothing seems to be out of the ordinary and it’s driving me nuts.

I have an open case with MS Support but nothing has been resolved and they aren’t giving me much info and is exacerbated by the time zone difference (going on a week now). So I am desperately trying to find info anywhere (which is what led me to this post).

I understand this is not a support forum, so apologies if this is inappropriate. Please delete, or let me know to delete it if so. Any ideas would be greatly appreciated. We use a Hybrid environment if that helps.

I’ve seen the “We can’t save changes for number +61 X XXXX XXXX right now. Try again later.” problem which was a problem in the portal itself, but PowerShell command did work. Does the get-csuser and get-teamuser commands work? Can also come along to the WinAdmins discord for a better way of troubleshooting this vs comments here (although if we get a fix should post it here!) https://discord.com/invite/winadmins

Sorry all, so is Set-CSUser working for you? The updated commands do work but old arent at all now and MS support are confused too.

When the new command wasn’t working, I failed back to the old commands successfully. They should be working up until April. What error are you getting when trying?

Its just not assigning the number. I have changed our setup scripts to be as below for a direct routed user. There are some slight adjustments needs for an online user, as you now have to set the emergency location at the same time. For a direct routing user you cant run the -EnterpriseVoice switch and the -PhoneNumber switch at the same time either. I am still shouting at Microsoft on a dialy basis until I hear back from the product team:

Get-PSSession | Remove-PSSession Connect-MicrosoftTeams Import-Module Microsoftteams $CSV = Import-CSV “c:\SkypeScripts\Template.csv”

Write-Host “Enabline users in Teams”

#Enable for VoiceEnterprise

ForEach ($u in $csv) {

Write-Host “Set-CsPhoneNumberAssignment -Identity $($u.SipAddress) -EnterpriseVoiceEnabled `$true ” -ForegroundColor Cyan

Set-CsPhoneNumberAssignment -Identity $u.SipAddress -EnterpriseVoiceEnabled $true

#Set Phone Number

Write-Host “Set-CsPhoneNumberAssignment -Identity $($u.SipAddress) -PhoneNumber $($u.LineURI) -PhoneNumberType DirectRouting” -ForegroundColor Cyan

Set-CsPhoneNumberAssignment -Identity $u.SipAddress -PhoneNumber $u.LineURI -PhoneNumberType DirectRouting

#Enable VoiceMail

Write-Host “Set-CsOnlineVoicemailUserSettings -Identity $($u.SipAddress) -VoicemailEnabled `$true” -ForegroundColor Cyan

Set-CsOnlineVoicemailUserSettings -Identity $u.SipAddress -VoicemailEnabled $true

Write-Host “Sleeping 10 secs then granting voice policy to users” Start-Sleep 10

Write-Host “Grant-CsOnlineVoiceRoutingPolicy -Identity $($u.SipAddress) -PolicyName $($u.VoicePolicy)” -ForegroundColor Cyan

Grant-CsOnlineVoiceRoutingPolicy -Identity $u.SipAddress -PolicyName $u.VoicePolicy

Write-Host “Sleeping 10 secs then granting dial plan to users” Start-Sleep 10

Write-Host “Grant-CsTenantDialPlan -Identity $($u.SipAddress) -PolicyName $($u.TenantDialPlan)” -ForegroundColor Cyan

Grant-CsTenantDialPlan -Identity $u.SipAddress -PolicyName $u.TenantDialPlan

Write-Host “Switching Users to Teams Only”

Write-Host ” Grant-CsTeamsUpgradePolicy -Identity $($u.SipAddress) -PolicyName UpgradeToTeams” -ForegroundColor Cyan

Grant-CsTeamsUpgradePolicy -Identity $u.SipAddress -PolicyName UpgradeToTeams

Hi Jon, Can you please share an example template file together with the updates PowerShell script pls? Thanks for sharing this very useful article

The “template file” is just a CSV with the headings below: UserPrincipalName,SipAddress,LineURI,EnterpriseVoiceEnabled,VoicePolicy,TenantDialPlan

I dont think the script has changed to the one above.

Morning from the UK.

Could you share your PS? We have online users too as well as direct routed and I had to change our PS to use the new cmdlet. I have a catchup with our Microsoft engineer too this morning.

Just checking though as I noticed another change in the portal. Have you assigned a calling plan before trying to allocate a number or is this a direct routing user?

Hi Jon, I’m doing these three commands for a new user:

Grant-CsTenantDialPlan -Identity %username% -PolicyName %physicalDeliveryOfficeName% Set-CsOnlineVoiceUser -Identity %username% -TelephoneNumber %Phone% Set-CsPhoneNumberAssignment -Identity %username% -Phonenumber %Phone% -Phonenumbertype CallingPlan

See above Adam F

So final response for Microsoft is that the product team upgraded some tenancies (by mistake) ahead of the April cut over of the SET-CSUSER command. They are sorry – that is all.

Haha oops, did they fix it?

They cant, so we have the all of the new features too (such as Cortana in the meeting room devices).

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed .

get csphonenumberassignment

Use Set/Remove-CsPhoneNumberAssignment in MicrosoftTeams

get csphonenumberassignment

  • The User must have a valid Teams License assigned
  • The User must have a Teams Phone (PhoneSystem/MCOEV) License assigned

get csphonenumberassignment

  • Professional Dev
  • Decision Makers
  • Auckland Modern Workplace User Group
  • An Overview of SIP
  • Call Flow Manager (RGS)
  • Flowgrate – Microsoft Teams UM & Response Group Migration
  • CRM SkypePOP
  • Admin Tools
  • Call Accounting/Reporting
  • Lync Phone Edition Log Viewer
  • Sonus SBC 5k/SWe Log Viewer
  • PowerShell One-Liners
  • Skype4B 2015 Server
  • Lync 2013 Server
  • Lync 2010 Server
  • Lync/Skype4B Client
  • Lync 2010 Client
  • Lync for Mac
  • Lync Store App
  • Lync Room System
  • Lync Phone Edition
  • Lync 2013 Client – Getting Started User Guide
  • Lync 2013 – Online Meetings
  • Skype for Business 2015 – Client Getting Started
  • Troubleshooting Skype for Business (Lync)
  • Lync 2013 Step by Step
  • Deployment Step by Step
  • In-Place Upgrade Step by Step
  • Migration Step by Step

Obsessed Efficiency

Call reporting for Microsoft Teams Auto Attendants and Call Queues –…

Quick fire features for 365 – april 2022, quick fire features for 365 – february 2022, quick fire features for 365 – october 2021, quick fire features for 365 – april 2021, create an azure app registration for create-teamscallaccountingreport script, installing microsoft teams staff check-ins app template, microsoft teams sip-all fqdn’s will no longer be supported, azure virtual desktop vs windows 365, phishing awareness training for office 365, my reading list for personal and professional development in 2020, tips for working from home, how i took on work-life balance, nz to get native microsoft teams calling, microsoft teams calling options for telephony replacement, how we are maintaining our remote team morale using microsoft teams…, 5 things you should do to help your business weather the…, break your business with remote work, azure virtual desktop review, skype for business response groups made easy, office 365 backup with synology nas, poly studio x30 review and configuration, review: yealink cp700 & cp900, script: get microsoft teams phone numbers and where they are assigned.

Andrew Morpeth

This PowerShell script which collects assigned and unassigned phone numbers from Microsoft Teams and shows you where they are used. The script supports Users, Meeting Rooms, Online Application Instances (Resource Accounts) and Dial-in Conference numbers.

The script can output the results to the console or to a CSV.

Example output:

get csphonenumberassignment

Note: A version of my script that has been enhanced by Ruud van Strijp is available here . Extra features at the time of writing:

  • Changed login method and file save location. Added HTML export by default
  • Added UPN. Added HTML table width for better readability
  • Added EV columns; Calling and Voice Routing Policies
  • Changed for module 3.0.0
  • Get Dial Plan, fix first name, merge Resource Account and User, make table wider
  • Microsoft Teams
  • Phone Numbers

Andrew Morpeth

Related Articles

Script: search, filter and restore from the sharepoint recycle bin, quick fire features for 365 – feb 2023, quick fire features for 365 – dec 2022.

Great work! This script helped me to finally identify a phone number I couldn’t for the life of me find in the system. Exactly what I was looking for 🙂

I did have to make a few tweaks though to get it to generate a complete list of phone numbers as I was hitting limits on the functions. Presumably you were working with a smaller dataset. Specifically: – Add ‘-All’ to the Get-MsolUser function – Turns out the Get-CsPhoneNumberAssignment only returns max 500 numbers, got around this by implementing the fix described here: https://robdy.io/all-available-numbers-calling-plan/

I also set the csv path to where the script is executed from (as opposed to a static path) and fixed the misspellings on lines 86 and 92 (assigne -> assigned).

Great to hear that it helped you :). Hadn’t spotted those limitations so I will try and get around to implementing those changes. Thanks for sharing!

This is great for listing all the assigned numbers within our system, as well as their AssignmentType.

However, I’m struggling to find a functional method to yield abandoned/unassigned numbers within our Teams tenant.

Two scenarios I can think of within our environment where this would be required. Eg: > Staff member has a DDI assigned within Microsoft Teams and uses it as their telephony solution. > Staff member leaves the company. > Account is disabled, causing the number to become orphaned. > Number is technically still within our Microsoft Teams Tenant, but not assigned to anyone and not yieldable via PowerShell scripts like this and other ones, as well as not being listed in the portal. > Requires us to write down the number somewhere so we know it exists and can be assigned to someone else in the future.

It would be great if there’s an appropriate cmdlet to yield what numbers are within our Tenant but not assigned to any object to stop us having to maintain a list of numbers which aren’t assigned.

Any ideas on this? Greatly appreciated.

I don’t have a solution unfortunately.

When I wrote this tool for SfB ( https://theucguys.com/call-flow-manager/ ) I used the unassigned number ranges in SfB to compare to assigned numbers, This returned a list of available numbers.

Teams has only recently supported unassigned numbers and I haven’t looked into how I could do the same ( https://learn.microsoft.com/en-us/microsoftteams/routing-calls-to-unassigned-numbers ).

I friend of mine wrote a tool that might help: Video: https://www.youtube.com/watch?v=m3_gN60TMJo Download: https://ucsorted-my.sharepoint.com/personal/paul_ucsorted_com/_layouts/15/onedrive.aspx?id=%2Fpersonal%2Fpaul%5Fucsorted%5Fcom%2FDocuments%2FPublic%20Share&ga=1

You’ll still need a CSV of all your numbers. But it does a check against assigned.

Hope that helps 🙂

LEAVE A REPLY Cancel reply

Save my name, email, and website in this browser for the next time I comment.

Latest Articles

Call reporting for microsoft teams auto attendants and call queues – v3 updates.

  • Technical 121
  • Software, Tools & Scripts 35
  • User Guides 13
  • Microsoft 365 Feature Round Up 9
  • Professional Development 3
  • Terms and Conditions
  • Privacy Policy

get csphonenumberassignment

Try Process AI free

How to find the microsoft teams phone number.

Get ready to stay connected and productive like never before with Microsoft Teams! This powerful collaboration tool brings teams together, allowing them to communicate and work seamlessly. To easily locate your Microsoft Teams phone number , follow these simple steps.

  • Open the Microsoft Teams application on your device and log in.
  • Then, select the “Calls” tab from the left-hand panel.
  • Click on the “Dial pad” icon at the bottom of the screen.
  • You’ll see a series of numbers displayed – your unique Microsoft Teams phone number will be at the top. Note that this number is different from your regular phone number.

Save this info for future reference. Having it readily available enables you to communicate and collaborate with colleagues and clients through voice calls within the Microsoft Teams platform . Don’t miss out on utilizing this vital feature – a dedicated phone number exclusive for your team interactions.

Discover your Microsoft Teams phone number today and unlock a new level of seamless connectivity for your team collaborations!

Understanding Microsoft Teams Phone Number

Microsoft Teams phone number is a great feature. It allows you to make and receive calls within the app . To find it, log in to your Teams account and go to the “Calls” tab . Then, click the “Dial pad” icon. Next, select “Settings” and choose “Calls” from the left-hand menu. Under the “Phones” section , you’ll find your number.

To make the most of this feature, make sure your phone number is on your profile . This can be done in profile settings. Also, customize your voicemail greeting with your name and alternate contact methods.

Finally, use other call features such as call forwarding, call transfer, and call recording . This will enhance communication efficiency and productivity when working remotely. With Microsoft Teams phone number, you can streamline communication and collaborate effectively .

Method 1: Accessing Microsoft Teams Admin Center

Access the Microsoft Teams Admin Center and find your phone number with this step-by-step guide!

  • Sign in with your admin account.
  • Navigate to the “Voice” section on the left-hand side of the homepage.
  • Select “Phone Numbers” under the “Voice” section.

This page shows all the phone numbers associated with your organization.

Plus, the Admin Center gives detailed info for each number. This includes location and assignment status. So you can keep track of your organization’s numbers easily.

Fun Fact: Microsoft Teams is a top collaboration platform used worldwide. Source: Forbes.

Method 2: Using PowerShell

  • Launch the PowerShell application on your computer.
  • Then, run the command “Connect-MicrosoftTeams” in the window to connect with Microsoft Teams.
  • To retrieve your Microsoft Teams phone number, enter the command “Get-CsPhoneNumberAssignment” in the PowerShell window.
  • You can use filters to narrow down the search, like “-User” or “-Location” .
  • You’ll then see your phone number displayed.
  • Once you have your phone number, type “Exit” or click the close button.
  • Automation and scripting capabilities make this an efficient method.
  • Microsoft created PowerShell, a task automation and configuration management framework.
  • It provides a command-line shell and scripting language for system administration.

Finding your Microsoft Teams phone number is simple. Go to the Teams admin center, select the “Voice” tab and click on “Phone numbers.” There, you can view and manage all the phone numbers assigned to your Teams account. Check this section often for updates or changes.

Furthermore, you can also assign phone numbers to users or departments, set up toll-free numbers, configure emergency addresses, and even port existing phone numbers to your Teams account. All of these options give you control over Teams’ calling features.

To get the most out of Teams, try integrating it with other Office 365 programs. Connect Teams with Outlook for emails, OneDrive for files, and SharePoint for team sites. This can streamline your workflow and improve productivity.

Pro Tip: Audit your assigned phone numbers in the Teams admin center regularly. This ensures active users have access to a number and keeps your communications organized.

get csphonenumberassignment

No credit card required

Your projects are processes, Take control of them today.

Get-CsPhoneNumberAssignment | Alya Cmdlet Reference

Get-CsPhoneNumberAssignment

Module: MicrosoftTeams

Official Documentation: https://learn.microsoft.com/en-us/powershell/module/teams/get-csphonenumberassignment

Back to the module overview  |  Back to the list of cmdlets

The PowerShell cmdlet Get-CsPhoneNumberAssignment is used in Microsoft Teams to retrieve information about phone number assignments in your organization. It can be used to view details such as the phone number, the type of assignment, the user or resource associated with the number, and the time of the assignment. Some of the parameters that can be used with this cmdlet include: - Identity: Specifies the phone number assignment or the identity of the user or resource for which you want to retrieve information. This parameter is optional, and if not specified, it retrieves information for all phone number assignments in the organization. - Filter: Allows you to apply filters to the results based on specific criteria such as number type, user or resource identity, or assignment time. This parameter is optional, but it helps narrow down the results to meet your needs. - ResultSize: Specifies the maximum number of results to be returned. This is useful when dealing with a large number of assignments and you want to limit the output. This parameter is optional. - SortOrder: Allows you to specify the order in which the results should be sorted, such as by number type or assignment time. This parameter is optional. By running the Get-CsPhoneNumberAssignment cmdlet, you can gather information about phone number assignments in your organization, which can be useful for troubleshooting, auditing, or managing your communication system.

Some code snippets about this cmdlet from our scripts:

{ Write-Warning "Changing phone number from '$($appInstance.PhoneNumber)' to '$attendantNumber'." $numberType = ( Get-CsPhoneNumberAssignment -TelephoneNumber $appInstance.PhoneNumber.Replace("tel:","")).NumberType Remove-CsPhoneNumberAssignment -Identity $attendantUpn -PhoneNumber $appInstance.PhoneNumber.Replace("tel:","") -PhoneNumberType $numberType Set-CsPhoneNumberAssignment -Identity $attendantUpn -PhoneNumber $attendantNumber -PhoneNumberType $numberType Start-Sleep -Seconds 10

This Cmdlet is used in following scripts:

  • \scripts\pstn\Create-AutoResponder.ps1

This page was generated automatically and may contain errors. It does not claim to be complete or correct. All information without guarantee.

Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

Find where a specified full or partial LineUri is assigned in Skype for Business

patrichard/Get-CsPhoneNumberAssignment

Folders and files, repository files navigation.

One of the problems that can be truly maddening when troubleshooting issues is a 485 ‘ambiguous’ error in Snooper. This is when Skype for Business doesn’t know what to do with an inbound call because the number being called is configured in more than one place. Skype for Business will complain if you try to configure a number more that once in SOME areas, such as several users, but not in all areas. So you’re left with hunting around for a while to figure out where else the number is defined. Meanwhile, users are complaining that calls aren’t working. So I came up with a quick function that will look through all of the areas that a number can be defined, and will list all matches.

Yes, I know that others have done similar things, notably Tom Arbuthnot’s Get-LyncNumberAssignment :Find #Lync Users/Objects by Phone Number/LineURI #PowerShell and Amanda Debler’s Is that Skype for Business (Lync) Number Free?, as well as other phone number management solutions such as those by Stale Hansen and Lasse Nordvik Wedø. I’ve had a previous version of my script in my profile for a long time and decided to clean it up and make it available.

Is that Skype for Business (Lync) Number Free?

This PowerShell function will look for a full or partial number to see where it is allocated. It looks at the following:

The function accepts input via the named LineUri parameter, or via pipeline. It returns a typical PowerShell object. Here is an example of specifying a full e.164 number.

Get-CsPhoneNumberAssignment -LineUri 12145551212

Specifying a partial number will likely show more matches.

Get-CsPhoneNumberAssignment -LineUri 1214

Note that since it must look at all of the related objects in order to build the object, it can take a minute or so to complete.

  • PowerShell 100.0%

Notifications

get csphonenumberassignment

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Email Address

Update to Get-CsOnlineUser and Get-CsUserPolicyAssignment cmdlet in the Teams PowerShell Module

The message announces an update to the Teams PowerShell Module. The LocationPolicy, OptionFlags, and VoicePolicy attributes will be retired from Get-CsOnlineUser and Get-CsUserPolicyAssignment cmdlets. This change will be implemented in March 2024. Administrators will need to use the Teams PowerShell Module cmdlets to get LocationPolicy and VoicePolicy information. Detailed instructions are provided in the message.

get csphonenumberassignment

We will be retiring LocationPolicy, OptionFlags and VoicePolicy attributes from Get-CsOnlineUser and Get-CsUserPolicyAssignment cmdlets in the Teams PowerShell Module, If you are using these cmdlets to get LocationPolicy , VoicePolicy , or OptionFlags review the information below for additional details.

When will this happen:

The retirement is planned to happen in March 2024.

How this will affect your organization:

When this change is implemented:

  • Administrators will no longer see LocationPolicy attribute in the output of the Get-CsOnlineUser cmdlet in Teams PowerShell Module version 6.1.0 (planned to be released on 15th March 2024) and any later versions. Whereas for older Teams PowerShell Module versions (<6.1.0) LocationPolicy will no longer be populated starting from 20th March 2024.
  • Administrators will no longer see LocationPolicy and VoicePolicy attributes in the output of the Get-CsUserPolicyAssignment cmdlet in Teams PowerShell Module version 6.1.0 (planned to be released on 15th March 2024) and any later versions. Whereas for older Teams PowerShell Module versions (<6.1.0) LocationPolicy and VoicePolicy will no longer be populated starting from 20th March 2024.
  • Administrators will see OptionFlags attribute as empty in the output of the Get-CsOnlineUser cmdlet in all existing Teams PowerShell Module versions (<=6.1.0) and any new versions (>6.1.0) that releases after March 20th, 2024.

What you need to do to prepare:

When this change is implemented,

  • Administrators will no longer be able to get the LocationPolicy and OptionFlags from Get-CsOnlineUser cmdlet. Instead, administrators will need to use the Teams PowerShell Module cmdlets: Get-CsPhoneNumberAssignment -IsoCountryCode to get the LocationPolicy information. It’s important to note that other details besides EnterpriseVoiceEnabled , previously found in OptionFlags , are no longer relevant for Teams. Administrators can still utilize the EnterpriseVoiceEnabled attribute in the output of the Get-CsOnlineUser cmdlet to get this information.
  • Administrators will no longer be able to get the LocationPolicy and VoicePolicy from Get-CsUserPolicyAssignment cmdlet. Instead, administrators will need to use the Teams PowerShell Module cmdlets: Get-CsPhoneNumberAssignment -IsoCountryCode to get the LocationPolicy information.

Detailed instructions on how to use these cmdlets are provided in Get-CsPhoneNumberAssignment ,  Get-CsOnlineUser ,  Get-CsUserPolicyAssignment

Message ID: MC720181

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)

No comments yet

Leave a Reply

Name (required)

Mail (will not be published) (required)

Notify me of follow-up comments by email.

Notify me of new posts by email.

  • Previous post

get csphonenumberassignment

I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

get csphonenumberassignment

Found my content useful?

get csphonenumberassignment

Jeff Brown Tech

Cloud and DevOps Engineering

Find Microsoft Teams Emergency Address using PowerShell

get csphonenumberassignment

The Microsoft Teams admin center is a fine way to manage your enterprise voice deployment. You can assign phone numbers, set emergency locations, or view unassigned numbers. However, there is not an easy way to verify everyone’s Teams emergency address. Enter PowerShell!

In this post, you will learn how to use PowerShell to find Teams voice users’ current emergency address and export this information using PowerShell.

Note: This article originally used the Get-CsOnlineVoiceUser , which is now deprecated. This post has been updated with a new script to retrieve the same information using multiple Microsoft Teams PowerShell commands.

Connect to Microsoft Teams PowerShell

First, you need to connect a remote session to your Microsoft Teams tenant using the Connect-MicrosoftTeams PowerShell command.

Learn more about how to install and connect to your tenant in Microsoft Teams PowerShell: Install and Connect Guide .

Finding Voice-Enabled Users and Phone Numbers

If you want to retrieve all the user accounts that are currently have Teams phone system capabilities, use the Get-CsOnlineUser command and with the Filter parameter to identity users with a phone system license who are currently enabled.

You can output specific user properties using Select-Object and the name of the property. For example, output the user account display name ( DisplayName ), user principal name ( UserPrincipalName ), and line URI ( LineUri ), which contains their assigned phone number.

get csphonenumberassignment

Getting Emergency Address Information

You can view the emergency address associated with a phone number using the Get-CsPhoneNumberAssignment command. Retrieve the emergency address location information for the phone number from the previous example with the TelephoneNumber parameter.

Note the output there is the LocationId property, which is a GUID associated to an emergency location.

teams phone number emergency address

Next, use the Get-CsOnlineLisLocation command and the LocationId from the results to view information about the phone number’s assigned emergency location. The location includes the address, city, state or province, country or region, and GPS coordinates.

detailed teams emergency address information

Breaking Down a Teams Emergency Address

Teams emergency addresses are divided into two parts: civic addresses and places. Every emergency address has a civic address. The civic address is the address of the emergency location. In the screenshot above, this would be 9407 Northeast Vanouver Mall Drive, Vancouver, WA, US .

Civic addresses can be further broken into places or locations. The primary civic address could have multiple buildings or is a multi-story building. Within the civic address, you can define places or more specific descriptors, such as Suite or Floor.

In the screenshot above, the place is Suite 104 #912 . Instead of creating multiple civic addresses for a multi-floor building, you can instead define places within the location.

The CivicAddressId denotes the unique identifier for the civic address, and the LocationId denotes the more specific place of Suite 104 #912 within the associated civic address. Not every user will have a Location as their emergency address may only be the physical address.

Putting It All Together

Now that you know how to find the user’s phone number and the emergency location, here is a script to find all voice users and output a report showing the name, phone number, and emergency location information. You can include as many emergency location properties as you need.

Note in the output below it shows a phone number assigned to a user and phone number that is currently unassigned. The second phone number is also only tied to the civic address, hence the Place property is blank. Not every emergency location contains a place.

get csphonenumberassignment

By adding a parameter to a PowerShell command, you can extract more information about your Teams voice users. You can then take this information and generate a nice report on voice users.

Questions or comments? If so, leave a comment below or find me on  Twitter  or  LinkedIn  to discuss further.

Related Post

Powershell script parameters: getting started guide, powershell scripting: getting started guide, powershell foreach: everything you need to know.

get csphonenumberassignment

All about Microsoft 365

Teams PowerShell module finally adds support for application authentication!

Seem all I blog about lately is PowerShell… so here’s another article. Kind of important one at that – the Microsoft Teams PowerShell module has added (preview) support for application context authentication!

Let’s start with why this is important. Basically, it allows you to run scripts unattended, without a logged in user. We covered many such examples for Exchange Online PowerShell, where the V2 module has had support for certificate-based authentication for a while now. Other methods, such as authenticating via a client secret can also be leveraged, although not in “supported” manner. The situation with the Microsoft Teams PowerShell module is largely the same, with only certificate-based auth officially supported. However, the module does allow you to pass access tokens (yes, plural) directly, which means you can leverage other flows as needed.

So how do we get this working? First, you need the latest preview version of the Microsoft Teams PowerShell module, namely 4.7.1-preview, which you can get from the usual location over at the PowerShell gallery . Once the module is updated, you can use the newly introduced – CertificateThumbprint , – ApplicationId , – TenantId and/or – AccessTokens parameters for the Connect-MicrosoftTeams   cmdlet. The official documentation walks you over all the details, but we will of course cover them here too.

As with all other things Graph, in order to connect you will have to obtain a valid access token. Now, since the Microsoft Teams PowerShell module incorporates both the old-style Skype for Business and new-style Teams cmdlets, under the cover it effectively uses two different access tokens. Why? Because each “resource” needs a separate token. Thus, we need a token for the Skype and Teams Tenant Admin API resource, also represented via the https://*.api.interfaces.records.teams.microsoft.com URI or 48ac35b8-9aa8-4d74-927d-1f4a14a0b239 GUID. And another one for the Graph API resource, represented via https://graph.microsoft.com/ and 00000003-0000-0000-c000-000000000000 .

An important requirement, not properly detailed in the documentation, is that both tokens need to have the same AppId claim, in other words you need to have a single app registration with both these resources added. You cannot obtain a Graph API token for one app, and use a different app to obtain the Skype and Teams Tenant Admin API token. We’ll come back to this point later.

You will also need to have the corresponding permissions/scopes for each of these APIs. In the case of the Graph API, the full set of scopes includes: AppCatalog.ReadWrite.All , User.Read.All , Group.ReadWrite.All , Channel.Delete.All , ChannelSettings.ReadWrite.All , ChannelMember.ReadWrite.All , TeamSettings.ReadWrite.All . Having all of these will ensure that all of the Graph API-based Teams cmdlets will work. There is no requirement to have all these scopes granted to however, and the module will not prevent you from connecting if one or more of these is missing. The corresponding cmdlet however might not work as expected. Another thing to keep in mind is that the Group.ReadWrite.All scope “trumps” many of the individual scopes listed above, thus allowing you to perform operations such as update settings or delete a channel, without having the individual scopes listed explicitly.

The situation is a bit more peculiar when it comes to the Skype and Teams Tenant Admin API. If you have bothered to ever look at the scopes defined for said resource, you will notice that two application permission scopes exists, and none of them pertains to PowerShell cmdlet. In fact, the documentation also states this fact, as follows: “ For *-Cs cmdlets – no API permissions are needed. ” Effectively, you do not need to add any scopes for the Skype and Teams Tenant Admin API resource in your app registration, or even add said resource at all. It also means, that any app that has been granted Graph API scopes can potentially be used to connect to and execute *-CS* cmdlets, without any checks in place. No admin roles are required to be assigned to the matching service principal object either.

With all the above in mind, here’s how to connect to Teams PowerShell via a certificate:

Connecting to Teams PowerShell via certificate-based authentication

As noted above, it’s important to understand that we can now use any of the *-CS* cmdlets which are currently supported. The list includes: Get-CsTenant , Get-CsOnlineUser , Get-CsOnlineVoiceUser and *-CsOnlineSipDomain . While there’s not much bad you can do by having access to said cmdlets, as more and more cmdlets get ported to support application context scenarios, the lack of resource-specific controls might pose to be a challenge here.

Another interesting thing to note is that we can use the – AccessTokens parameter to connect within the user context, too. The process remains largely the same – have an app registration for the two resources, obtain tokens for a given user, pass them. Since the delegate permissions model does enforce additional constraints on the effective permissions though, you will not be able to run all the cmdlets, unless you also have the relevant Teams admin role(s) assigned. Here’s the relevant code:

Since we’re connected in the user context, we will now be able to run any and all cmdlets that the user is privy to – not limited to the list above. The difference stems from the fact that before all cmdlets can support application context, some changed need to be made on the backend. The same situation happened with the Exchange Online cmdlets – it took a while before (most of) them can be run as a service principal object, and not a user.

Interestingly enough, when using the delegate permissions model (user context), we cannot obtain an access token unless the resource is specifically added in the app manifest. Failing to do so will result in an error such as the below:

Exception : System.AggregateException: One or more errors occurred. —> Microsoft.Identity.Client.MsalServiceException: AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client’s application registration. Client app ID: 9dd50c8b-0eb9-47e9-af9e-80d200b11505(Reporting API Application). Resource value from request: 48ac35b8-9aa8-4d74-927d-1f4a14a0b239. Resource app ID: 48ac35b8-9aa8-4d74-927d-1f4a14a0b239. List of valid resources from app registration: 00000003-0000-0000-c000-000000000000, 00000002-0000-0ff1-ce00-000000000000, 00000009-0000-0000-c000-000000000000, c5393580-f805-4401-95e8-94b7a6ef2fc2.

I might be late to the party, but I never noticed this difference in behavior between the delegate and application permissions context. And I definitely prefer the way the former one is handling things.  But anyway, I’ll update the article once I have more clarity on that front.

UPDATE: I seem to have overlooked the fact that the service principal corresponding to my test app had the Global reader admin role assigned, which explains why I’m able to run the Get-*CS* cmdlets currently supported within the app context. Removing the Global reader role results in the cmdlets throwing “Access denied” errors, so that’s good. I’m still a bit puzzled as to why am I able to obtain a valid access token for said resource in the first place, but that’s not an issue with the module itself. I’ll circle back once I have more clarity on that part.

5 thoughts on “ Teams PowerShell module finally adds support for application authentication! ”

' src=

One can also assign the app the “Skype for business” Admin role, so that the “*CS*” cmdlets function.

What is the pros/cons in assigning an admin role in comparison to granting API permissions?

' src=

Do you know what method would be best to use in order to check if “connection” to teams is still available. In other words if connect-microsoftteams is still connected/access token is still valid?

' src=

For now, run a test via any of the cmdlets (preferably one that returns a single object) and check for output. Going forward, they might add the analog of Exchange’s Get-ConnectionInformation.

' src=

I already use CBA for Exchange-Online and Microsoft Graph and it works fine. Now I wanted to test it for Microsoft Teams and downloaded version 4.7.1-preview (in the meantime 4.8.0 is out).

I followed the Microsoft Instructions and added the API Permissions listed in the article under “App Registrations” (not Enterprise Applications).

I now have the following API permissions set (Type: Application)

API/Permissions name Type Description Admin consent required Status Microsoft Graph (8) AppCatalog.ReadWrite.All Application Read and write to all app catalogs Yes Granted for Swisscard AECS Channel.Delete.All Application Delete channels Yes Granted for Swisscard AECS ChannelMember.ReadWrite.All Application Add and remove members from all channels Yes Granted for Swisscard AECS ChannelSettings.ReadWrite.All Application Read and write the names, descriptions, and settings of all channels Yes Granted for Swisscard AECS Group.ReadWrite.All Application Read and write all groups Yes Granted for Swisscard AECS Organization.Read.All Application Read organization information Yes Granted for Swisscard AECS TeamSettings.ReadWrite.All Application Read and change all teams’ settings Yes Granted for Swisscard AECS User.ReadWrite.All Application Read and write all users’ full profiles Yes Granted for Swisscard AECS Office 365 Exchange Online (1) Exchange.ManageAsApp Application Manage Exchange As Application Yes Granted for Swisscard AECS

I as well assigned my “Provisioning APP” to the Azure AD Roles “Teams Administrator” and “Skype for Business Administrator”. Have no idea if this is necessary.

I can successfully connect with

Connect-MicrosoftTeams -CertificateThumbprint …

I can use the following cmdlets and they work as expected:

– Get-Team – Get-TeamUser – Add-TeamUser – Remove-TeamUser

But when it comes to creating a new team an error is thrown:

PS > New-Team -DisplayName “Test Team” -Description “Test Team” -Visibility Private New-Team : Error occurred while executing Code: BadRequest Message: /me request is only valid with delegated authentication flow. InnerError: RequestId: 682e11bc-8140-44ec-a3a5-8141d7bc6563 DateTimeStamp: 2022-10-13T08:10:22 HttpStatusCode: BadRequest At line:1 char:1 + New-Team -DisplayName “Test Team” -Description “Test Team” -Visibilit … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-Team], ApiException + FullyQualifiedErrorId : Microsoft.Teams.PowerShell.TeamsCmdlets.ErrorHandling.ApiException,Microsoft.Teams.Power Shell.TeamsCmdlets.NewTeam

Why should new-team follow a “delegated” flow (/me) ???

Any idea what’s wrong ? Is this a bug ? If yes, where can I file a bug report ?

Regards, Oliver

The issue here is with how the cmdlet is coded – if you don’t provide a value for the Owner parameter, it will try to assign the current users as owner, and this obviously cannot work in the app scenario. Thus, simply run it with the -Owner parameter:

Another thing to keep in mind is that not all cmdlets are currently supported for app permissions, although the list is growing:

Leave a Reply Cancel reply

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

Save my name, email, and website in this browser for the next time I comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed .

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Remove-Cs Phone Number Assignment

This cmdlet will remove/unassign a phone number from a user or a resource account (online application instance).

Description

This cmdlet removes/unassigns a phone number from a user or resource account. The phone number continues to be available in the tenant.

Unassigning a phone number from a user or resource account will automatically set EnterpriseVoiceEnabled to False.

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 removes/unassigns the Microsoft Calling Plan phone number +1 (206) 555-1234 from the user [email protected].

This example removes/unassigns the phone number from [email protected].

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.

-PhoneNumber

The phone number to unassign from the user or resource account. Supports E.164 format and non-E.164 format. Needs to be without the prefixed "tel:".

-PhoneNumberType

The type of phone number to unassign from the user or resource account. The supported values are DirectRouting, CallingPlan and OperatorConnect.

Unassigns the phone number from the user or resource account.

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.

Related Links

  • Set-CsPhoneNumberAssignment
  • Get-CsPhoneNumberAssignment

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

COMMENTS

  1. Get-CsPhoneNumberAssignment (MicrosoftTeamsPowerShell)

    Example 3. PowerShell. Copy. Get-CsPhoneNumberAssignment -CapabilitiesContain "VoiceApplicationAssignment,ConferenceAssignment". This example returns all phone numbers that have both the capability VoiceApplicationAssignment and the capability ConferenceAssignment assigned, but phone numbers that have only one of these capabilities assigned won ...

  2. Get-CsPhoneNumberAssignment (MicrosoftTeamsPowerShell)

    This cmdlet displays information about one or more phone numbers. You can filter the phone numbers to return by using different parameters. Returned results are sorted by TelephoneNumber in ascending order. If you are using both -Skip X and -Top Y for filtering, the returned results will first be skipped by X, and then the top Y results will be returned.

  3. Get all available user numbers in Calling Plans

    You can check how many numbers you have in your Teams Calling Plans. PowerShell cmdlet to use is Get-CsPhoneNumberAssignment. Description. In the example below, we'll list all the user numbers. We're only interested in the ones, which are available to assign. Therefore, we'll filter out the numbers already assigned.

  4. Microsoft Teams PowerShell Phone Number Assigning Cmdlet Change

    The new cmdlet Set-CsPhoneNumberAssignment doesn't work exactly the same way as the old cmdlets. Read the documentation for more details. Set-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber +61987654321 -PhoneNumberType CallingPlan. The options for -PhoneNumberType (required) are DirectRouting, CallingPlan and ...

  5. office-docs-powershell/teams/teams-ps/teams/Get-CsPhoneNumberAssignment

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  6. Use Set/Remove-CsPhoneNumberAssignment in MicrosoftTeams

    To check the Licenses use this Code. If you need to Add a License use this Code. Now let's check the CsUser. Assign the Number. Get-CsOnlineUser -Identity [email protected] | fl EnterpriseVoiceEnabled, *HostingProvider, HostedVoiceMail, *um*, *LineUri. If you want to remove the Number.

  7. Script: Get Microsoft Teams phone numbers and where they are assigned

    This PowerShell script which collects assigned and unassigned phone numbers from Microsoft Teams and shows you where they are used. The script supports Users, Meeting Rooms, Online Application Instances (Resource Accounts) and Dial-in Conference numbers. The script can output the results to the console or to a CSV. Example output:

  8. Teams PowerShell: List organisation phone numbers

    You can perform the below command in Microsoft Teams PowerShell to quickly list all the phone numbers within your organisation and their type. Get-CsPhoneNumberAssignment | Format-Table TelephoneNumber, NumberType, ActivationState, City. You can perform the below command to list the user accounts that phone numbers are assigned to:

  9. How to Find the Microsoft Teams Phone Number

    To retrieve your Microsoft Teams phone number, enter the command "Get-CsPhoneNumberAssignment" in the PowerShell window. You can use filters to narrow down the search, like "-User" or "-Location". You'll then see your phone number displayed. Once you have your phone number, type "Exit" or click the close button.

  10. Get-CsPhoneNumberAssignment

    The PowerShell cmdlet Get-CsPhoneNumberAssignment is used in Microsoft Teams to retrieve information about phone number assignments in your organization. It can be used to view details such as the phone number, the type of assignment, the user or resource associated with the number, and the time of the assignment.

  11. GitHub

    Get-CsPhoneNumberAssignment -LineUri 12145551212. Specifying a partial number will likely show more matches. Get-CsPhoneNumberAssignment -LineUri 1214. Note that since it must look at all of the related objects in order to build the object, it can take a minute or so to complete.

  12. Update to Get-CsOnlineUser and Get-CsUserPolicyAssignment cmdlet in the

    What you need to do to prepare: When this change is implemented, Administrators will no longer be able to get the LocationPolicy and OptionFlags from Get-CsOnlineUser cmdlet. Instead, administrators will need to use the Teams PowerShell Module cmdlets: Get-CsPhoneNumberAssignment -IsoCountryCode to get the LocationPolicy information.

  13. Find Microsoft Teams Emergency Address using PowerShell

    1. Get-CsPhoneNumberAssignment -TelephoneNumber +13606823750. Next, use the Get-CsOnlineLisLocation command and the LocationId from the results to view information about the phone number's assigned emergency location. The location includes the address, city, state or province, country or region, and GPS coordinates. ?

  14. Unable to assign a Teams Phone number to a brand new user account

    Try to get rid of the stale entries in the Phone number field using the command below: Set-CsPhoneNumberAssignment -Identity "upngoeshere" -PhoneNumber "" Then try to assign again Set-CsPhoneNumberAssignment -Identity "upngoeshere" -PhoneNumber "+16*****"

  15. Teams PowerShell module finally adds support for application

    Kind of important one at that - the Microsoft Teams PowerShell module has added (preview) support for application context authentication! Let's start with why this is important. Basically, it allows you to run scripts unattended, without a logged in user. We covered many such examples for Exchange Online PowerShell, where the V2 module has ...

  16. PowerShell cmdlet reference for Auto attendants and Call queues

    The following cmdlets allow you to manage Auto attendants: New-CsAutoAttendant. Get-CsAutoAttendant. Set-CsAutoAttendant. Update-CsAutoAttendant. Remove-CsAutoAttendant. New-CsOnlineTimeRange. New-CsOnlineDateTimeRange. New-CsOnlineSchedule.

  17. Get-CsPhoneNumberAssignment Azure Automation Error 401 Unauthorized

    Has anyone gotten the cmdlet Get-CsPhoneNumberAssignment to work in Azure Automation with a system managed identity? According to MS, almost all cmdlet are now supported for application based authentication.

  18. Remove-CsPhoneNumberAssignment (MicrosoftTeamsPowerShell)

    Remove-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber +12065551234 -PhoneNumberType CallingPlan. This example removes/unassigns the Microsoft Calling Plan phone number +1 (206) 555-1234 from the user [email protected].