Adding/assigning additional phone numbers/removing
You have completed the initial configuration and now want to make adjustments on the Phone team system.
In advance, you added/removed the "Microsoft Teams option" in the customer or partner portal for the desired phone number and added/removed the Microsoft telephony license to the team user.
1. Preparation
1.1 Install/update "Microsoft Teams" module
-
Open PowerShell as administrator.
-
Install or update the Microsoft Teams module with the following command:
Set-ExecutionPolicy RemoteSigned -Force
Install-Module MicrosoftTeams -RequiredVersion 7.1.0 -AllowClobber
- Finish PowerShell after installing the module.
You can miss this step should your module be up to date.
2. Start the session
- Reopen PowerShell (PowerShell as administrator does not need)
- Import the Team PowerShell module
Import-Module MicrosoftTeams
- To start working with the Microsoft Teams PowerShell module, type the following command:
Connect-MicrosoftTeams
- The following is a pop-up for Microsoft 365 authentication. Your user must be assigned the Microsoft role "Global Administrator" or "Team Administrator".
3. Add/remove additional phone number
Choose whether you want to add or remove sipcall numbers from the Phone System team:
- Add additional phone number (Option a)
- Remove phone number(s) (Option b)
3.1a Assign phone number
Assign the desired sipcall number to any existing Microsoft 365 user or team resources account with the following command to:
Set-CsPhoneNumberAssignment -identity "yourusername@yourcompany.com" -PhoneNumber "+<sipcallPhoneNumber>" -PhoneNumberType DirectRouting
Example with 3 users and a "Team Resources Account" (for team telephone auto attendant):
Set-CsPhoneNumberAssignment -identity "homer.simpson@thesimpsons.ch" -PhoneNumber "+41441234001" -PhoneNumberType DirectRouting
Set-CsPhoneNumberAssignment -identity "marge.simpson@thesimpsons.ch" -PhoneNumber "+41441234002" -PhoneNumberType DirectRouting
Set-CsPhoneNumberAssignment -identity "bart.simpson@thesimpsons.ch" -PhoneNumber "+41441234003" -PhoneNumberType DirectRouting
Set-CsPhoneNumberAssignment -identity "mainnumber@thesimpsons.ch" -PhoneNumber "+41441234000" -PhoneNumberType DirectRouting
3.2a Assigne policy
You can assign the policy individually or for several users as a batch:
- Assign variant individually
- Assign batch variant
Grant a user permission for the policy:
Grant-CsOnlineVoiceRoutingPolicy -Identity "yourusername@yourcompany.com" -PolicyName "sipcall"
Example:
Grant-CsOnlineVoiceRoutingPolicy -Identity "homer.simpson@thesimpsons.ch" -PolicyName "sipcall"
Grant-CsOnlineVoiceRoutingPolicy -Identity "marge.simpson@thesimpsons.ch" -PolicyName "sipcall"
Grant-CsOnlineVoiceRoutingPolicy -Identity "bart.simpson@thesimpsons.ch" -PolicyName "sipcall"
Grant-CsOnlineVoiceRoutingPolicy -Identity "mainnumber@thesimpsons.ch" -PolicyName "sipcall"
Replace yourusername1@yourcompany.com
, yourusername2@yourcompany.com
with your users and add more if needed.
$users_ids = @("yourusername1@yourcompany.com","yourusername2@yourcompany.com")
New-CsBatchPolicyAssignmentOperation -PolicyType OnlineVoiceRoutingPolicy -PolicyName "sipcall" -Identity $users_ids -OperationName "Batch assign voice routing"
Example:
$users_ids = @("homer.simpson@thesimpsons.ch","marge.simpson@thesimpsons.ch","bart.simpson@thesimpsons.ch","mainnumber@thesimpsons.ch")
New-CsBatchPolicyAssignmentOperation -PolicyType OnlineVoiceRoutingPolicy -PolicyName "sipcall" -Identity $users_ids -OperationName "20240418 batch ticket aaa-bb-123"
3.1b Remove telephony features
Disable the telephony features for the desired users and remove the phone number using the following commands:
Remove-CsPhoneNumberAssignment -Identity "yourusername@yourcompany.com" -RemoveAll
Example:
Remove-CsPhoneNumberAssignment -Identity "homer.simpson@thesimpsons.ch" -RemoveAll
Remove-CsPhoneNumberAssignment -Identity "marge.simpson@thesimpsons.ch" -RemoveAll
Remove-CsPhoneNumberAssignment -Identity "bart.simpson@thesimpsons.ch" -RemoveAll
Remove-CsPhoneNumberAssignment -Identity "hauptnummer@thesimpsons.ch" -RemoveAll
4. Check Configuration
Afterward, test according to the Check Configuration article.
5. End PowerShell Session
End the PowerShell session:
Disconnect-MicrosoftTeams
Allow Microsoft some time after completing the configuration.
It may take up to 1 hour for the configuration to take full effect.