VoIP:Teams:Microsoft Management: Difference between revisions
From VTX Public Wiki
(Move section in subpage) |
(→Number Mapping : Assign/Unassign numbers to Microsoft accounts: unassign number manually in Powershell Command Prompt) |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
{{Notice|1=You can use this interfaces for the Domain Management, User management, License management and Software Management}} |
{{Notice|1=You can use this interfaces for the Domain Management, User management, License management and Software Management}} |
||
*''' |
*'''Signup URL''' : https://signup.microsoft.com/ |
||
*''' |
*'''Main Admin URL''' : https://admin.microsoft.com/ |
||
*''' |
**'''Domain Management URL''': https://admin.microsoft.com/Adminportal/Home#/Domains |
||
* |
**'''User Management URL''': https://admin.microsoft.com/Adminportal/Home#/users |
||
** |
**'''Purchase Services URL''': https://admin.microsoft.com/adminportal/home?add=sub&adminportal=1#/catalog |
||
== Create a temporarily user in the <servicenumber>.teams.ipvoip.ch domain == |
|||
⚫ | |||
{{Warning|1=None of your user will use the <servicenumber>.teams.ipvoip.ch, but as stated in the Requirements above, we need to create a temporarily user in this domain with the Teams + Phone System licenses in order to be able to create the CsOnlineVoiceRoute towards VTX SBC}} |
|||
* '''Problematic''': We wish to create a enableteams@'''<servicenumber>.teams.ipvoip.ch''' to enable Teams connection towards VTX VoIP platform |
|||
* '''Solution''': Please follow the procedure below |
|||
# Connect to https://admin.microsoft.com/Adminportal/Home#/users |
|||
# Create a new user enableteams@'''<servicenumber>.teams.ipvoip.ch''' ( First Name: "Temp User" / Last Name : "VTX Teams" / Login : enableteams@<servicenumber>.teams.ipvoip.ch / No Admin Right / "Teams" and "Phone System" licenses / No need to remember its password, we won't connect with it). |
|||
# Wait a few seconds/minutes/hours for Teams to be enabled on this user https://admin.microsoft.com/AdminPortal/Home#/teamsprovisioning |
|||
# Now even after user is created you night need to wait minutes/hours before being able to create Voice Routing ( especially the New-CsOnlineVoiceRoute ), so if you can please wait 4hours, if not, try to create the routing, if you get error, try again |
|||
# Once everything is working ( routing + user mapping + incoming and outgoing calls ), you can delete this user to free up the licenses |
|||
⚫ | |||
{{Notice|1=You will only need to do voice routing setup once for all users}} |
{{Notice|1=You will only need to do voice routing setup once for all users}} |
||
{{Warning|1=It will take several hours for Microsoft to create your domain after linking it in the Kiosk, so it is wise to wait a few hours before trying to create the routing. If it is not ready, you won't be able to login or Voice Routing will not work. So you will need to be really patient.}} |
{{Warning|1=It will take several hours for Microsoft to create your domain after linking it in the Kiosk, so it is wise to wait a few hours before trying to create the routing. If it is not ready, you won't be able to login or Voice Routing will not work. So you will need to be really patient.}} |
||
{{Warning|1=If the script displays a red error on New-CsOnlineVoiceRoutingPolicy, please read [[ |
{{Warning|1=If the script displays a red error on New-CsOnlineVoiceRoutingPolicy, please read [[{{FULLPAGENAME}}#New-CsOnlineVoiceRoutingPolicy_-_Cannot_find_specified_Online_PSTN_usage]]}} |
||
{{Notice|1=Once Voice Routing has been correctly created without error, you can delete the user enableteams@<servicenumber>.teams.ipvoip.ch to free up its licenses, it is not needed anymore}} |
{{Notice|1=Once Voice Routing has been correctly created without error, you can delete the user enableteams@<servicenumber>.teams.ipvoip.ch to free up its licenses, it is not needed anymore}} |
||
Line 31: | Line 44: | ||
=== Create Voice Routing using a VTX Powershell Script |
=== Create Voice Routing using a VTX Powershell Script VTX_Teams_Create_Routing_Rules.ps1 === |
||
{{Warning|1=By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards}} |
{{Warning|1=By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards}} |
||
Line 37: | Line 50: | ||
# Download https://wiki.vtx.ch/media/ |
# Download https://wiki.vtx.ch/media/VTX_Teams_Create_Routing_Rules.ps1 on your computer ( Right Click on the link / Download ) |
||
# Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script ) |
# Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script ) |
||
# Execute it on your PC : It will ask you for these parameters and create the routing |
# Execute it on your PC : It will ask you for these parameters and create the routing |
||
## VTX Teams |
## VTX Teams Domain : ex: 123456.teams.ipvoip.ch |
||
## Your MS Teams Admin Credentials : ex: admin@COMPANY.onmicrosoft.com |
## Your MS Teams Admin Credentials : ex: admin@COMPANY.onmicrosoft.com |
||
Line 52: | Line 65: | ||
# Set Variables |
# Set Variables |
||
$ |
$TeamsDomain = '''"123456.teams.ipvoip.ch"''' |
||
⚫ | |||
# Connect to Microsoft Teams management and create all Voice Routing |
# Connect to Microsoft Teams management and create all Voice Routing |
||
Connect-MicrosoftTeams |
|||
$Session = New-CsOnlineSession -UserName $MSteamsAdminUser |
|||
⚫ | |||
Import-PSSession $Session -AllowClobber |
|||
New-CsOnlineVoiceRoute -Identity "CsOnlineVoiceRoute-$TeamsDomain" -Priority 0 -NumberPattern '.*' -OnlinePstnGatewayList "$TeamsDomain" -OnlinePstnUsages "CsOnlinePstnUsage-$TeamsDomain" |
|||
⚫ | |||
New- |
New-CsOnlineVoiceRoutingPolicy -Identity "CsOnlineVoiceRoutingPolicy-$TeamsDomain" -OnlinePstnUsages "CsOnlinePstnUsage-$TeamsDomain" |
||
New-CsOnlineVoiceRoutingPolicy -Identity "CsOnlineVoiceRoutingPolicy-$MSTeamsDomain" -OnlinePstnUsages "CsOnlinePstnUsage-$MSTeamsDomain" |
|||
Set-CsCallingLineIdentity -Identity Global -EnableUserOverride $True |
Set-CsCallingLineIdentity -Identity Global -EnableUserOverride $True |
||
Line 69: | Line 80: | ||
# Logout |
# Logout |
||
Disconnect-MicrosoftTeams |
|||
Get-PSSession | Remove-PSSession |
|||
==Number Mapping : Assign numbers to Microsoft accounts== |
==Number Mapping : Assign/Unassign numbers to Microsoft accounts== |
||
Now you will need to assign a number and a routing plan to each user with a "Microsoft 365 Phone System" license. You can use one of the following options to do it |
Now you will need to assign a number and a routing plan to each user with a "Microsoft 365 Phone System" license. You can use one of the following options to do it |
||
Line 78: | Line 89: | ||
=== Assign numbers using a VTX Powershell Script |
=== Assign/Unassign numbers using a VTX Powershell Script VTX_Teams_Assign_Numbers.ps1 === |
||
{{Warning|1=By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards}} |
{{Warning|1=By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards}} |
||
# Download https://wiki.vtx.ch/media/ |
# Download https://wiki.vtx.ch/media/VTX_Teams_Assign_Numbers.ps1 on your computer ( Right Click on the link / Download ) |
||
# Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script ) |
# Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script ) |
||
# Execute it on your PC : It will ask you for these parameters and create the routing |
# Execute it on your PC : It will ask you for these parameters and create the routing |
||
## VTX Teams |
## VTX Teams Domain : ex: 123456.teams.ipvoip.ch |
||
## Your MS Admin Credentials for : ex: admin@MSDOMAIN.onmicrosoft.com |
## Your MS Admin Credentials for : ex: admin@MSDOMAIN.onmicrosoft.com |
||
## The MS Team user email : ex: first.last@MSDOMAIN.onmicrosoft.com |
## The MS Team user email : ex: first.last@MSDOMAIN.onmicrosoft.com |
||
## The Telephone number you wish to set : ex: +41225661234 |
## The Telephone number you wish to set : ex: +41225661234 / or leave string empty to unassign number from user |
||
''Here is a list of screenshots to see how the script works'' |
|||
<table> |
|||
<tr><td> |
|||
[[Image:Teams-Number-Assignment-01.png|thumb|600px|left|Teams Assignment - 1st Warning - Is routing OK ?]] |
|||
</td><td> |
|||
[[Image:Teams-Number-Assignment-02.png|thumb|600px|left|Teams Assignment - Enter the Teams Domain Provided by VTX]] |
|||
</td></tr> |
|||
<tr><td> |
|||
[[Image:Teams-Number-Assignment-03.png|thumb|600px|left|Teams Assignment - Enter Teams Admin email]] |
|||
</td><td> |
|||
[[Image:Teams-Number-Assignment-04.png|thumb|600px|left|Teams Assignment - Enter Teams User Email]] |
|||
</td></tr> |
|||
<tr><td> |
|||
[[Image:Teams-Number-Assignment-05.png|thumb|600px|left|Teams Assignment - Enter Teams User Phone Number or use empty string to remove the number]] |
|||
</td><td> |
|||
[[Image:Teams-Number-Assignment-09.png|thumb|600px|left|Teams Assignment - Disable voicemail on the user ?]] |
|||
</td></tr> |
|||
<tr><td> |
|||
[[Image:Teams-Number-Assignment-06.png|thumb|600px|left|Teams Assignment - Setup another user ?]] |
|||
</td><td> |
|||
[[Image:Teams-Number-Assignment-07.png|thumb|600px|left|Teams Assignment - List all user setup ?]] |
|||
</td></tr> |
|||
<tr><td> |
|||
[[Image:Teams-Number-Assignment-08.png|thumb|600px|left|Teams Assignment - 1st Warning - Is routing OK ?]] |
|||
</td><td> |
|||
</td></tr> |
|||
</table> |
|||
=== Or Assign numbers manually in Powershell Command Prompt === |
=== Or Assign numbers manually in Powershell Command Prompt === |
||
Line 99: | Line 139: | ||
# Set Variables |
# Set Variables |
||
$ |
$TeamsDomain = '''"123456.teams.ipvoip.ch"''' |
||
$ |
$TeamsUserEmail = "'''first.last@MSDOMAIN.onmicrosoft.com'''" |
||
⚫ | |||
$MSTeamsUserEmail = "'''first.last@MSDOMAIN.onmicrosoft.com'''" |
|||
⚫ | |||
# Connect to Microsoft Teams management and assign number and profile to the user |
# Connect to Microsoft Teams management and assign number and profile to the user |
||
Connect-MicrosoftTeams |
|||
$Session = New-CsOnlineSession -UserName $MSteamsAdminUser |
|||
Import-PSSession $Session -AllowClobber |
|||
# Assign a number to your user and the Call Routing |
# Assign a number to your user and the Call Routing |
||
Set-CsPhoneNumberAssignment -Identity "$TeamsUserEmail" -PhoneNumber "$TeamsUserNumber" -PhoneNumberType DirectRouting |
|||
Get-CsOnlineUser -Identity $MSTeamsUserEmail | Set-CsUser -EnterpriseVoiceEnabled $true -OnPremLineURI "tel:$MSTeamsUserNumber" |
|||
# Assign a Voice Routing Policy to your user to allow it to call out towards external numbers |
|||
Get-CsOnlineUser -Identity $MSTeamsUserEmail | Grant-CsOnlineVoiceRoutingPolicy -PolicyName "CsOnlineVoiceRoutingPolicy-$MSTeamsDomain" |
|||
Grant-CsOnlineVoiceRoutingPolicy -Identity $TeamsUserEmail -PolicyName "CsOnlineVoiceRoutingPolicy-$TeamsDomain" |
|||
⚫ | |||
# Disable voicemail of the user to prevent that it answers all calls if user is not connected |
|||
⚫ | |||
Set-CsOnlineVoicemailUserSettings -Identity $TeamsUserEmail -VoicemailEnabled $false |
|||
# Wait 60s for settings to be applied |
|||
Sleep -s 60 |
|||
⚫ | |||
⚫ | |||
# List all users with EnterPrise Voice Enabled |
|||
Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true)} ` | Select sipaddress,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,lineuri | Format-List |
|||
# Logout |
|||
Disconnect-MicrosoftTeams |
|||
=== Or Unassign numbers manually in Powershell Command Prompt === |
|||
{{Notice|1=If you prefer a manual setup, perform the following actions}} |
|||
# Open a powershell prompt on your PC |
|||
# Copy paste command below one by one changing the values in bold with your own |
|||
# Set Variables |
|||
$TeamsDomain = '''"123456.teams.ipvoip.ch"''' |
|||
⚫ | |||
$TeamsUserNumber = '''"+41215661234"''' |
|||
# Connect to Microsoft Teams management and assign or unassign number and profile to the user |
|||
Connect-MicrosoftTeams |
|||
# Unassign a number to your user and the Call Routing |
|||
Remove-CsPhoneNumberAssignment -Identity "$TeamsUserEmail" -PhoneNumber "$TeamsUserNumber" -PhoneNumberType DirectRouting |
|||
# Verify Your setup |
|||
Get-CsOnlineUser -Identity $TeamsUserEmail | Select EnterpriseVoiceEnabled,OnPremLineURI,OnlineVoiceRoutingPolicy,RegistrarPool | Format-List |
|||
# List all users with EnterPrise Voice Enabled |
# List all users with EnterPrise Voice Enabled |
||
Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true |
Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true)} ` | Select sipaddress,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,lineuri | Format-List |
||
# Logout |
# Logout |
||
Disconnect-MicrosoftTeams |
|||
Get-PSSession | Remove-PSSession |
Latest revision as of 08:28, 20 March 2023
Connect to Microsoft 365 Admin Portal[edit | edit source]
You can use this interfaces for the Domain Management, User management, License management and Software Management |
- Signup URL : https://signup.microsoft.com/
- Main Admin URL : https://admin.microsoft.com/
- Domain Management URL: https://admin.microsoft.com/Adminportal/Home#/Domains
- User Management URL: https://admin.microsoft.com/Adminportal/Home#/users
- Purchase Services URL: https://admin.microsoft.com/adminportal/home?add=sub&adminportal=1#/catalog
Create a temporarily user in the <servicenumber>.teams.ipvoip.ch domain[edit | edit source]
None of your user will use the <servicenumber>.teams.ipvoip.ch, but as stated in the Requirements above, we need to create a temporarily user in this domain with the Teams + Phone System licenses in order to be able to create the CsOnlineVoiceRoute towards VTX SBC |
- Problematic: We wish to create a enableteams@<servicenumber>.teams.ipvoip.ch to enable Teams connection towards VTX VoIP platform
- Solution: Please follow the procedure below
- Connect to https://admin.microsoft.com/Adminportal/Home#/users
- Create a new user enableteams@<servicenumber>.teams.ipvoip.ch ( First Name: "Temp User" / Last Name : "VTX Teams" / Login : enableteams@<servicenumber>.teams.ipvoip.ch / No Admin Right / "Teams" and "Phone System" licenses / No need to remember its password, we won't connect with it).
- Wait a few seconds/minutes/hours for Teams to be enabled on this user https://admin.microsoft.com/AdminPortal/Home#/teamsprovisioning
- Now even after user is created you night need to wait minutes/hours before being able to create Voice Routing ( especially the New-CsOnlineVoiceRoute ), so if you can please wait 4hours, if not, try to create the routing, if you get error, try again
- Once everything is working ( routing + user mapping + incoming and outgoing calls ), you can delete this user to free up the licenses
Voice Routing : Create Voice Routing to allow your users to use VTX Trunk[edit | edit source]
You will only need to do voice routing setup once for all users |
It will take several hours for Microsoft to create your domain after linking it in the Kiosk, so it is wise to wait a few hours before trying to create the routing. If it is not ready, you won't be able to login or Voice Routing will not work. So you will need to be really patient. |
If the script displays a red error on New-CsOnlineVoiceRoutingPolicy, please read VoIP:Teams:Microsoft Management#New-CsOnlineVoiceRoutingPolicy_-_Cannot_find_specified_Online_PSTN_usage |
Once Voice Routing has been correctly created without error, you can delete the user enableteams@<servicenumber>.teams.ipvoip.ch to free up its licenses, it is not needed anymore |
Now you will need to setup a routing plan. You can use one of the following options to do it
- Using a Powershell Script that will ask you questions
- Manually in Powershell
Create Voice Routing using a VTX Powershell Script VTX_Teams_Create_Routing_Rules.ps1[edit | edit source]
By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards |
When you run the script, please look at all red warning errors that are being displayed, and use this wiki to handle any error. You can run the script several time in case of problem, simply discard the "duplicated" errors afterwards. Using the next manual section will help you see where the error comes from |
- Download https://wiki.vtx.ch/media/VTX_Teams_Create_Routing_Rules.ps1 on your computer ( Right Click on the link / Download )
- Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script )
- Execute it on your PC : It will ask you for these parameters and create the routing
- VTX Teams Domain : ex: 123456.teams.ipvoip.ch
- Your MS Teams Admin Credentials : ex: admin@COMPANY.onmicrosoft.com
Or Create Voice Routing manually in Powershell Command Prompt[edit | edit source]
If you prefer a manual setup, perform the following actions |
- Open a powershell prompt on your PC
- Copy paste command below one by one changing the values in bold with your own
# Set Variables $TeamsDomain = "123456.teams.ipvoip.ch" # Connect to Microsoft Teams management and create all Voice Routing Connect-MicrosoftTeams Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="CsOnlinePstnUsage-$TeamsDomain"} New-CsOnlineVoiceRoute -Identity "CsOnlineVoiceRoute-$TeamsDomain" -Priority 0 -NumberPattern '.*' -OnlinePstnGatewayList "$TeamsDomain" -OnlinePstnUsages "CsOnlinePstnUsage-$TeamsDomain" New-CsOnlineVoiceRoutingPolicy -Identity "CsOnlineVoiceRoutingPolicy-$TeamsDomain" -OnlinePstnUsages "CsOnlinePstnUsage-$TeamsDomain" Set-CsCallingLineIdentity -Identity Global -EnableUserOverride $True # Verify all setup ( You can compare it with the Debug Section in the wiki ) Get-CsOnlinePstnUsage Get-CsOnlineVoiceRoute Get-CsOnlineVoiceRoutingPolicy Get-CsCallingLineIdentity # Logout Disconnect-MicrosoftTeams
Number Mapping : Assign/Unassign numbers to Microsoft accounts[edit | edit source]
Now you will need to assign a number and a routing plan to each user with a "Microsoft 365 Phone System" license. You can use one of the following options to do it
- Using a Powershell Script that will ask you questions
- Manually in Powershell
Assign/Unassign numbers using a VTX Powershell Script VTX_Teams_Assign_Numbers.ps1[edit | edit source]
By default for security reason, it is not allowed to execute a powershell script downloaded on the internet, that is why you will need to open them with Wordpad to check what it does, save it and execute it afterwards |
- Download https://wiki.vtx.ch/media/VTX_Teams_Assign_Numbers.ps1 on your computer ( Right Click on the link / Download )
- Open it with Wordpad and use Ctrl-s to save it again ( to inform the system that it is local script )
- Execute it on your PC : It will ask you for these parameters and create the routing
- VTX Teams Domain : ex: 123456.teams.ipvoip.ch
- Your MS Admin Credentials for : ex: admin@MSDOMAIN.onmicrosoft.com
- The MS Team user email : ex: first.last@MSDOMAIN.onmicrosoft.com
- The Telephone number you wish to set : ex: +41225661234 / or leave string empty to unassign number from user
Here is a list of screenshots to see how the script works
Or Assign numbers manually in Powershell Command Prompt[edit | edit source]
If you prefer a manual setup, perform the following actions |
- Open a powershell prompt on your PC
- Copy paste command below one by one changing the values in bold with your own
# Set Variables $TeamsDomain = "123456.teams.ipvoip.ch" $TeamsUserEmail = "first.last@MSDOMAIN.onmicrosoft.com" $TeamsUserNumber = "+41215661234" # Connect to Microsoft Teams management and assign number and profile to the user Connect-MicrosoftTeams # Assign a number to your user and the Call Routing Set-CsPhoneNumberAssignment -Identity "$TeamsUserEmail" -PhoneNumber "$TeamsUserNumber" -PhoneNumberType DirectRouting # Assign a Voice Routing Policy to your user to allow it to call out towards external numbers Grant-CsOnlineVoiceRoutingPolicy -Identity $TeamsUserEmail -PolicyName "CsOnlineVoiceRoutingPolicy-$TeamsDomain" # Disable voicemail of the user to prevent that it answers all calls if user is not connected Set-CsOnlineVoicemailUserSettings -Identity $TeamsUserEmail -VoicemailEnabled $false # Wait 60s for settings to be applied Sleep -s 60 # Verify Your setup Get-CsOnlineUser -Identity $TeamsUserEmail | Select EnterpriseVoiceEnabled,OnPremLineURI,OnlineVoiceRoutingPolicy,RegistrarPool | Format-List # List all users with EnterPrise Voice Enabled Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true)} ` | Select sipaddress,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,lineuri | Format-List # Logout Disconnect-MicrosoftTeams
Or Unassign numbers manually in Powershell Command Prompt[edit | edit source]
If you prefer a manual setup, perform the following actions |
- Open a powershell prompt on your PC
- Copy paste command below one by one changing the values in bold with your own
# Set Variables $TeamsDomain = "123456.teams.ipvoip.ch" $TeamsUserEmail = "first.last@MSDOMAIN.onmicrosoft.com" $TeamsUserNumber = "+41215661234" # Connect to Microsoft Teams management and assign or unassign number and profile to the user Connect-MicrosoftTeams # Unassign a number to your user and the Call Routing Remove-CsPhoneNumberAssignment -Identity "$TeamsUserEmail" -PhoneNumber "$TeamsUserNumber" -PhoneNumberType DirectRouting # Verify Your setup Get-CsOnlineUser -Identity $TeamsUserEmail | Select EnterpriseVoiceEnabled,OnPremLineURI,OnlineVoiceRoutingPolicy,RegistrarPool | Format-List # List all users with EnterPrise Voice Enabled Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true)} ` | Select sipaddress,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,lineuri | Format-List # Logout Disconnect-MicrosoftTeams