New-CsOnlineDirectRoutingTelephoneNumberUploadOrder
This cmdlet creates a request to upload Direct Routing telephone numbers to Microsoft Teams telephone number management inventory.
Syntax
InputByList (Default)
New-CsOnlineDirectRoutingTelephoneNumberUploadOrder
[-TelephoneNumber <String>]
[-LocationId <String>]
[-AcquiredCapability <String>]
[-NetworkSiteId <String>]
[-ReverseNumberLookup <String>]
[-Tag <String>]
[<CommonParameters>]
InputByRange
New-CsOnlineDirectRoutingTelephoneNumberUploadOrder
[-LocationId <String>]
[-AcquiredCapability <String>]
[-NetworkSiteId <String>]
[-ReverseNumberLookup <String>]
[-Tag <String>]
[-StartingNumber <String>]
[-EndingNumber <String>]
[<CommonParameters>]
InputByFile
New-CsOnlineDirectRoutingTelephoneNumberUploadOrder
[-FileContent <Byte[]>]
[<CommonParameters>]
Description
This cmdlet uploads Direct Routing telephone numbers to Microsoft Teams telephone number management inventory. Once uploaded the phone numbers will be visible in Teams PowerShell as acquired Direct Routing phone numbers. The output of the cmdlet is the "orderId" of the asynchronous Direct Routing Number creation operation. Each upload request supports a maximum of 10,000 telephone numbers, including CSV uploads with additional attributes. Split larger lists into separate upload requests of no more than 10,000 numbers each.
The cmdlet is an asynchronous operation and will return an OrderId as output. You can use the Get-CsOnlineTelephoneNumberOrder cmdlet to check the status of the OrderId, including any error or warning messages that might result from the operation: Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId "orderId".
A telephone number can be uploaded by itself or with associated attributes. When uploading a range telephone numbers, attributes are applied equally to all the numbers in range. If the telephone number is already in Microsoft Teams database, the upload may fail.
Note
CSV uploads that include additional telephone number attributes are supported in Teams PowerShell but aren't yet available in the Teams admin center. Use Teams PowerShell to upload numbers with these attributes.
Examples
Example 1
PS C:\> New-CsOnlineDirectRoutingTelephoneNumberUploadOrder -TelephoneNumber "+123456789"
cdf3073a-6fbb-4ade-a8af-e8fa1f3b9c13
In this example, a new Direct Routing telephone number "+123456789" is being uploaded to Microsoft Teams telephone number management inventory. The output of the cmdlet is the OrderId that can be used with the Get-CsOnlineTelephoneNumberOrder cmdlet to retrieve the status of the order: Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId "orderId".
Example 2
PS C:\> New-CsOnlineDirectRoutingTelephoneNumberUploadOrder -TelephoneNumber "+123456789,+134567890,+145678901"
cdf3073a-6fbb-4ade-a8af-e8fa1f3b9c14
In this example, a list of telephone numbers is being uploaded to Microsoft Teams telephone number management inventory. The output of the cmdlet is the OrderId that can be used with the Get-CsOnlineTelephoneNumberOrder cmdlet to retrieve the status of the order: Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId "orderId".
Example 3
PS C:\> New-CsOnlineDirectRoutingTelephoneNumberUploadOrder -StartingNumber "+12000000" -EndingNumber "+12000009"
cdf3073a-6fbb-4ade-a8af-e8fa1f3b9c13
In this example, a range of Direct Routing telephone numbers from "+12000000" to "+12000009" are being uploaded to Microsoft Teams telephone number management inventory. The output of the cmdlet is the OrderId that can be used with the Get-CsOnlineTelephoneNumberOrder cmdlet to retrieve the status of the order: Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId "orderId".
Example 4
This example uploads Direct Routing telephone numbers from a CSV file without additional attributes.
Create a comma-separated CSV file with a TelephoneNumber header and one telephone number per row.
Before running the example, replace the sample numbers with your Direct Routing telephone numbers and set $csvPath to a file in an existing folder on your computer. The example creates or overwrites that file using UTF-8 encoding. If you use a spreadsheet editor, format the telephone number column as text to preserve the leading + sign.
After connecting to Microsoft Teams with Connect-MicrosoftTeams, create the CSV file from a PowerShell here-string, read the file as a byte array, and pass its contents to -FileContent:
$csvPath = "C:\Temp\DrNumber.csv"
$csvContent = @'
TelephoneNumber
+12065550100
+12065550101
'@
Set-Content -LiteralPath $csvPath -Value $csvContent -Encoding UTF8 -ErrorAction Stop
$drlist = [System.IO.File]::ReadAllBytes($csvPath)
$orderId = New-CsOnlineDirectRoutingTelephoneNumberUploadOrder -FileContent $drlist
Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId $orderId
The upload runs asynchronously. The returned OrderId identifies the request; it doesn't indicate that the upload has completed. Run Get-CsOnlineTelephoneNumberOrder again to check progress and review any errors or warnings. Each upload can contain up to 10,000 telephone numbers.
Example 5
This example uploads Direct Routing telephone numbers with different attributes for each number. Use Teams PowerShell module version 7.9.0 or later.
Create a comma-separated CSV file using the following column names. Column names are case-sensitive. Use the plural names Tags and AcquiredCapabilities in the file, not the singular PowerShell parameter names Tag and AcquiredCapability.
| Column | Required | Description |
|---|---|---|
TelephoneNumber |
Yes | The Direct Routing telephone number to upload. Include one number per row. |
LocationId |
No | The location ID to associate with the number. Retrieve a location ID with Get-CsOnlineLisLocation. |
Tags |
No | Tags to assign or create for the number. Separate multiple tags with semicolons (;), for example, Seattle;Reception. |
AcquiredCapabilities |
No | Capabilities for the number: ConferenceAssignment, VoiceApplicationAssignment, UserAssignment, or SharedCalling. Separate multiple capabilities with semicolons (;). |
NetworkSiteId |
No | The network site ID to associate with the number. Retrieve network sites with Get-CsTenantNetworkSite. |
ReverseNumberLookup |
No | Set to SkipInternalVoip to route internal calls to the number through external PSTN connectivity instead of internal VoIP reverse number lookup. |
Omit optional columns that you don't need, or leave their cells empty for individual numbers. An empty optional cell supplies no value for that attribute. Keep the comma separators for empty cells so that the remaining values stay in the correct columns. Separate columns with commas, not semicolons; semicolons separate multiple values within a cell.
The following example includes all six supported columns.
Before running the example, replace the sample telephone numbers, location ID, network site ID, and tags with values for your organization. Use an existing location ID and network site ID from your tenant, and select the capabilities and reverse number lookup behavior appropriate for each number. Set $csvPath to a file in an existing folder on your computer. The example creates or overwrites that file using UTF-8 encoding, preserving the telephone numbers as text.
After connecting to Microsoft Teams, create the CSV file from a PowerShell here-string, upload its contents, and check the order status:
$csvPath = "C:\Temp\DrNumberWithAttributes.csv"
$csvContent = @'
TelephoneNumber,LocationId,Tags,AcquiredCapabilities,NetworkSiteId,ReverseNumberLookup
+12065550100,11111111-2222-3333-4444-555555555555,Seattle;Reception,UserAssignment;ConferenceAssignment,Seattle,SkipInternalVoip
+12065550101,,Support,VoiceApplicationAssignment,,
+12065550102,,,,,
'@
Set-Content -LiteralPath $csvPath -Value $csvContent -Encoding UTF8 -ErrorAction Stop
$drlist = [System.IO.File]::ReadAllBytes($csvPath)
$orderId = New-CsOnlineDirectRoutingTelephoneNumberUploadOrder -FileContent $drlist
Get-CsOnlineTelephoneNumberOrder -OrderType DirectRoutingNumberCreation -OrderId $orderId
The first data row supplies all five additional attributes, including two tags and two capabilities. The second data row supplies only a tag and a capability. The third data row uploads a number without additional attributes.
For a CSV upload, specify the attributes in the file. Don't combine -FileContent with -TelephoneNumber, -StartingNumber, -EndingNumber, or the individual attribute parameters.
Parameters
-AcquiredCapability
This is the list of Acquired Capabilities the number(s) have. Supported capabilities are ConferenceAssignment, VoiceApplicationAssignment, UserAssignment, and SharedCalling.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByList
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-EndingNumber
This is the ending number of a range of Direct Routing telephone number you wish to upload to Microsoft Teams telephone number management inventory.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-FileContent
This is the content of a .csv file that includes the Direct Routing telephone numbers and associated attributes to be uploaded to the Microsoft Teams telephone number management inventory. This parameter can be used to upload up to 10,000 numbers at a time.
Pass a byte array, such as the output of [System.IO.File]::ReadAllBytes(), not a file path or the objects returned by Import-Csv. The file must contain the case-sensitive TelephoneNumber header. Optional columns are LocationId, Tags, AcquiredCapabilities, NetworkSiteId, and ReverseNumberLookup. Attribute values apply to the number on the same row. See Examples 4 and 5 for CSV preparation and upload instructions.
Parameter properties
| Type: | Byte[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByFile
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-LocationId
The LocationId of the location to assign to the specific user. You can get it using Get-CsOnlineLisLocation. You can set the location on both assigned and unassigned phone numbers.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByList
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-NetworkSiteId
ID of a network site. A network site represents a location where your organization has a physical venue, such as offices, a set of buildings, or a campus.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByList
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ReverseNumberLookup
This parameter is used to control the behavior of reverse number lookup (RNL) for a phone number. When RNL is set to 'SkipInternalVoip', an internal call to this phone number will not attempt to pass through internal VoIP via reverse number lookup in Microsoft Teams. Instead the call will be established through external PSTN connectivity directly.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByList
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-StartingNumber
This is the starting number of a range of Direct Routing telephone number you wish to upload to Microsoft Teams telephone number management inventory.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Tag
Indicates the tag to be assigned or created for telephone number(s).
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
InputByList
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
InputByRange
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-TelephoneNumber
This is the Direct Routing telephone numbers you wish to upload to Microsoft Teams telephone number management inventory. It is comma delimited list of one or more Direct Routing telephone numbers.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
None
Outputs
System.String
Notes
The cmdlet is available in Teams PowerShell module 6.7.1 or later. Telephone number attributes LocationId, AcquiredCapability, NetworkSiteId, ReverseNumberLookup, and Tag are supported from Teams PowerShell module version 7.9.0 or later