Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Prerequisites
- Ensure you have tenant administration rights.
- The agents, distribution lists, and Teams channels mentioned in this article have already been created.
Determine if the
MicrosoftTeamsPowerShell module is already installed.Get-InstalledModule -Name MicrosoftTeamsIf the
MicrosoftTeamsPowerShell module is already installed, the output from the command will look similar to:Get-InstalledModule -Name MicrosoftTeams Version Name Repository Description ------- ---- ---------- ----------- 7.7.0 MicrosoftTeams PSGallery Microsoft Teams cmdlets module for Windows PowerShell and PowerShell Core....Proceed to Step 2.
If the
MicrosoftTeamsPowerShell model is not already installed, proceed to Step 3.Update the
MicrosoftTeamsmoduleUpdate-Module MicrosoftTeamsProceed to the Scenarios
Install the
MicrosoftTeamsPowerShell modeule on your computer.Set up your computer for Windows PowerShell
MSTeams Module Installed
Install-Module -Name MicrosoftTeams -Force -AllowClobberMicrosoft Graph module installed
Install-Module -Name Microsoft.Graph -Force -AllowClobber
Scenarios
Sales (Users and Groups)
- Nested behind Auto Attendant: Yes
- Calling: Through Sales auto attendant only - no resource account required
- Language: English US
- Greeting: None (calls are greeted by the Sales auto attendant)
- Music on hold: Play an audio file
- Filename: sales-hold-in-queue-music.wav
- Call Answering: Users
- Bill@contoso.com
- Mary@contoso.com
- Call Answering: Group
- Sales@contoso.com
- Conference Mode: On
- Routing method: Round Robin
- Presence-based routing: On
- Call agents can opt out of taking calls: Yes
- Call agent alert time: 15
- Call overflow handling: 200
- Redirect to: Adele@contoso.com
- Call timeout handling: 120 seconds
- Redirect to: Adele@contoso.com
- No agents handling
- Apply to all calls
- Redirect to: Adele@contoso.com
- Callback: No
- Service Level: 20 seconds
- Auth User
- Adele@contoso.com
- Voice Applications Policy: Sales
- Compliance Recording: No
- Shared call history: Yes
- Template: Sales
- Automatic recording: No
Expand to see PowerShell commands
Login
When prompted, enter your Teams administrator credentials.
$credential = Get-Credential
Connect-MicrosoftTeams -Credential $credential
Connect-MgGraph -Credential $credential
Create Audio Files
Replace d:\\ with the path to where the wav files are stored on your computer.
$content = [System.IO.File]::ReadAllBytes('d:\sales-hold-in-queue-music.wav')
$audioFileSalesHoldInQueueMusicID = (Import-CsOnlineAudioFile -ApplicationID HuntGroup -FileName "sales-hold-in-queue-music.wav" -Content $content).ID
Create Shared Call History template
Create Automatic Recording for Call Queue template
Get Users ID
$userAdeleID = (Get-CsOnlineUser -Identity "sip:adele@contoso.com").Identity
$userSalesBillID = (Get-CsOnlineUser -Identity "sip:bill@contoso.com").Identity
$userSalesMaryID = (Get-CsOnlineUser -Identity "sip:mary@contoso.com").Identity
Get list of supported languages
Get-CsAutoAttendantSupportedLanguage
Create Call queue
New-CsCallQueue -Name "Sales" -AgentAlertTime 15 -AllowOptOut $true -MusicOnHoldAudioFileID $audioFileSalesHoldInQueueMusicID -OverflowAction Forward -OverflowActionTarget $userAdeleID -OverflowThreshold 200 -TimeoutAction Forward -TimeoutActionTarget $userAdeleID -TimeoutThreshold 120 -RoutingMethod Attendant -ConferenceMode $true -User @($userSalesBillID, $userSalesMaryID) -LanguageID "en-US"
Support (Microsoft Shifts)
- Nested behind Auto Attendant: Yes -
- Calling: Through Support auto attendant, internally, and via the PSTN - resource account required
- Language: English UK
- Greeting: Play an audio file
- Filename: support-greeting.wav
- Music on hold: Play an audio file
- Filename: support-hold-in-queue-music.wav
- Call Answering: Microsoft Shifts Support Team
- Support@contoso.com
- Conference Mode: On
- Routing method: Longest Idle
- Presence-based routing: N/A – on by default because of Longest Idle
- Call agents can opt out of taking calls: No
- Call agent alert time: 15
- Call overflow handling: 200
- Redirect: Support Shared Voicemail
- Play an audio file (support-shared-voicemail-greeting.wav)
- Transcription enabled
- Redirect: Support Shared Voicemail
- Call timeout handling: 45 minutes
- Redirect: Support Shared Voicemail
- TTS: "We're sorry to have kept you waiting and are now transferring your call to voicemail."
- Transcription enabled
- Redirect: Support Shared Voicemail
- No agents handling
- Callback: Yes
- Service Level: 30 seconds
- Auth User
- Compliance Recording
- Shared call history
- automatic recording
Expand to see PowerShell commands
Login
When prompted, enter your Teams administrator credentials.
$credential = Get-Credential
Connect-MicrosoftTeams -Credential $credential
Connect-MgGraph -Credential $credential
Create audio files
Replace d:\\ with the path to where the wav files are stored on your computer.
$content1 = [System.IO.File]::ReadAllBytes('d:\support-greeting.wav')
$audioFileSupportGreetingID = (Import-CsOnlineAudioFile -ApplicationID HuntGroup -FileName "support-greeting.wav" -Content $content1).ID
$content2 = [System.IO.File]::ReadAllBytes('d:\support-hold-in-queue-music.wav')
$audioFileSupportHoldInQueueMusicID = (Import-CsOnlineAudioFile -ApplicationID HuntGroup -FileName "support-hold-in-queue-music.wav" -Content $content2).ID
$content3 = [System.IO.File]::ReadAllBytes('d:\support-shared-voicemail-greeting.wav')
$audioFileSupportSharedVoicemailGreetingID = (Import-CsOnlineAudioFile -ApplicationID HuntGroup -FileName "support-shared-voicemail-greeting.wav" -Content $content3).ID
Get Support team group ID
$teamSupportID = (Get-Team -DisplayName "Support").GroupID
Get list of supported languages
Get-CsAutoAttendantSupportedLanguage
Create Call queue
New-CsCallQueue -Name "Support" -AgentAlertTime 15 -AllowOptOut $false -DistributionLists $teamSupportID -WelcomeMusicAudioFileID $audioFileSupportGreetingID -MusicOnHoldAudioFileID $audioFileSupportHoldInQueueMusicID -OverflowAction SharedVoicemail -OverflowActionTarget $teamSupportID -OverflowThreshold 200 -OverflowSharedVoicemailAudioFilePrompt $audioFileSupportSharedVoicemailGreetingID -EnableOverflowSharedVoicemailTranscription $true -TimeoutAction SharedVoicemail -TimeoutActionTarget $teamSupportID -TimeoutThreshold 2700 -TimeoutSharedVoicemailTextToSpeechPrompt "We're sorry to have kept you waiting and are now transferring your call to voicemail." -EnableTimeoutSharedVoicemailTranscription $true -RoutingMethod LongestIdle -ConferenceMode $true -LanguageID "en-US"
Get license types
Get-MgSubscribedSku
Create and Assign Resource Account
A phone number isn't required here as the call queue is nested behind an auto attendant.
- ApplicationID
- Auto Attendant: ce933385-9390-45d1-9512-c8d228074e07
- Call Queue: 11cd3e2e-fccb-42ad-ad00-878b93575e07
The license type shown after (PHONESYSTEM_VIRTUALUSER) must be one that's listed by the Get-MgSubscribedSku cmdlet.
New-CsOnlineApplicationInstance -UserPrincipalName Support-RA@contoso.com -DisplayName "Support" -ApplicationID "11cd3e2e-fccb-42ad-ad00-878b93575e07"
Update-MgUser -UserId "Support-RA@contoso.com" -UsageLocation US
Set-MgUserLicense -UserId "Support-RA@contoso.com" -AddLicenses @(contoso:PHONESYSTEM_VIRTUALUSER) -RemoveLicenses @()
$applicationInstanceID = (Get-CsOnlineUser -Identity "Support-RA@contoso.com").Identity
$callQueueID = (Get-CsCallQueue -NameFilter "Support").Identity
New-CsOnlineApplicationInstanceAssociation -Identities @($applicationInstanceID) -ConfigurationID $callQueueID -ConfigurationType CallQueue
Facilities (Teams Channel)
- Nested behind Auto Attendant: No
- Direct calling from PSTN: No (internal calling only)
- Language: French FR
- Greeting: None
- Music on hold: default
- Call Answering: Team: Facilities
- Call Answering Channel: Help Desk
- Channel Owner: Fred@contoso.com
- Conference Mode: On
- Routing method: Round Robin
- Presence-based routing: On
- Call agents can opt out of taking calls: No
- Call agent alert time: 15
- Call overflow handling: 200
- Disconnect
- Call timeout handling: 45 minutes
- Disconnect
- No agents handling
- Callback: Yes
- Service Level: 30 seconds
- Auth User
- Compliance Recording
- Shared call history
- automatic recording
Expand to see PowerShell commands
Login
When prompted, enter your Teams administrator credentials.
$credential = Get-Credential
Connect-MicrosoftTeams -Credential $credential
Connect-MgGraph -Credential $credential
Get Facilities team group ID
$teamFacilitiesGroupID = (Get-Team -DisplayName "Facilities").GroupID
Get Facilities Help Desk team channel ID
Get-TeamChannel -GroupId $teamFacilitiesGroupID
$teamFacilitiesHelpDeskChannelID = "{assign ID from output of above command}"
Get Facilities Help Desk channel owner user ID
$teamFacilitiesHelpDeskChannelUserID = (Get-TeamChannelUser -GroupId $teamFacilitiesGroupID -DisplayName "Help Desk" -Role Owner).UserId
Get on behalf of Calling Resource Account ID
$oboResourceAccountID = (Get-CsOnlineUser -Identity "MainAA-RA@contoso.com").Identity
Get list of supported languages
Get-CsAutoAttendantSupportedLanguage
Create Call queue
New-CsCallQueue -Name "Facilities" -AgentAlertTime 15 -AllowOptOut $false -ChannelId $teamFacilitiesHelpDeskChannelID -ChannelUserObjectId $teamFacilitiesHelpDeskChannelUserID -ConferenceMode $true -DistributionList $teamFacilitiesGroupID -LanguageID "fr-FR" -OboResourceAccountIds $oboResourceAccountID -OverflowAction DisconnectWithBusy -OverflowThreshold 200 -RoutingMethod RoundRobin -TimeoutAction Disconnect -TimeoutThreshold 2700 -UseDefaultMusicOnHold $true
Get license types
Get-MgSubscribedSku
Create and assign Resource Account
A phone number isn't required here as the call queue is nested behind an auto attendant.
- ApplicationID
- Auto Attendant: ce933385-9390-45d1-9512-c8d228074e07
- Call Queue: 11cd3e2e-fccb-42ad-ad00-878b93575e07
The license type shown after (PHONESYSTEM_VIRTUALUSER) must be one that's listed by the Get-MgSubscribedSku cmdlet.
New-CsOnlineApplicationInstance -UserPrincipalName Facilities-RA@contoso.com -DisplayName "Facilities" -ApplicationID "11cd3e2e-fccb-42ad-ad00-878b93575e07"
Update-MgUser -UserId "Facilities-RA@contoso.com" -UsageLocation US
Set-MgUserLicense -UserId "Facilities-RA@contoso.com" -AddLicenses @(contoso:PHONESYSTEM_VIRTUALUSER) -RemoveLicenses @()
$applicationInstanceID = (Get-CsOnlineUser -Identity "Facilities-RA@contoso.com").Identity
$callQueueID = (Get-CsCallQueue -NameFilter "Facilities").Identity
New-CsOnlineApplicationInstanceAssociation -Identities @($applicationInstanceID) -ConfigurationID $callQueueID -ConfigurationType CallQueue
Related articles
Plan for Teams Auto attendants and Call queues