You can check how many numbers you have in your Teams Calling Plans. PowerShell cmdlet to use is Get-CsOnlineTelephoneNumber
NOTE: The article below doesn't apply to numbers provided via Direct Routing
We'll use Teams PowerShell module. Since version 2.0 the cmdlet to use is:
If you use earlier version you can still use the legacy way:
$sfbSession = New-CsOnlineSession Import-PSSession $sfbSession
NOTE: If you still use Skype for Business Online module, remember that it's being decomissioned. I have an article showing how to migrate to new module.
The cmdlet we'll be using is
$allNumbers = Get-CsOnlineTelephoneNumber -IsNotAssigned -ResultSize 2147483647 -InventoryType Subscriber
Parameters we use:
-IsNotAssigned- self explanatory
-ResultSize 2147483647- there's no support for Unlimited, in contrary to other Microsoft 365 cmdlets, so we specify maximum value (based on the docs)
-InventoryType Subscriber- based on the docs, it's used to display numbers, which can be assigned to users.
Now we have our numbers saved into variable. We can process them, as we need.
# Group by city $allNumbers | Group-Object CityCode -NoElement # List all numbers $allNumbers.Id # Copy all numbers to clipboard $allNumbers.Id | clip