One of the most complex activities for Teams admins is creating call queues and auto attendants. You don't create them every day, but when you do, you might need to create a lot of them at once.
In this tutorial, you'll learn how to automate all the required steps. You'll create an auto attendant and associate it with a call queue for a full-fledged voice application.
Tip
This article is a part of the series about managing Teams call queues and auto attendants with PowerShell.
Part 1 - Automating Call Queue and Auto Attendant onboarding (this article)
You'll create an auto attendant and configure it to redirect to the call queue.
An auto attendant in conjunction with a call queue ensures the best flexibility. It is also easy to extend. The diagram of what you're going to create would be:
Auto attendant with call queue configuration
For simplicity, you'll not assign the number to your application yet.
Call Queue
Ok then, enough talking. Let's start creating. Before you start, connect to Microsoft Teams from your PowerShell:
powershell
Connect-MicrosoftTeams
You can now specify variables to use later:
powershell
# Your config$cqName = 'RobTestQueue2'$resourceAccountDomain = 'yourdomain.onmicrosoft.com'
Before working on the auto attendant, you can create a call queue. In that configuration, you'll be able to configure forward to the call queue immediately.
You might wonder why use splatting when you provide only one or two parameters to the cmdlet. You're right that it seems a bit unnecessary. The purpose of it here is to make the code easily expandable when you add more features.
powershell
# Create resource account of call queue type$cqRaParams = @{
UserPrincipalName = "RA_CQ_$cqName@$resourceAccountDomain"# ID taken from cmdlet documentation
ApplicationId = '11cd3e2e-fccb-42ad-ad00-878b93575e07'
DisplayName = "RA_CQ_$cqName"}$newCqRa = New-CsOnlineApplicationInstance @cqRaParams
# Create call queue$newCqParams = @{
Name = "CQ_$($cqName)"
UseDefaultMusicOnHold = $true}$newCq = New-CsCallQueue @newCqParams
# Associate resource account with call queue$newCqAppInstanceParams = @{# Requires array of strings# Use array sub-expression operator
Identities = @($newCqRa.ObjectId)
ConfigurationId = $newCq.Identity
ConfigurationType = 'CallQueue'
ErrorAction = 'Stop'}$associationRes = New-CsOnlineApplicationInstanceAssociation @newCqAppInstanceParams
You finished the first part - congrats! The next one is a little bit more complicated. Fear not, though - you'll get there smoothly.
Auto Attendant
Your call queue is up and running. Let's work on the auto attendant.
Setting a resource account is very similar to the one you created for a call queue. The only difference is the application ID you'll use:
powershell
$newAaRaParams = @{
UserPrincipalName = "RA_AA_$($cqName)@$resourceAccountDomain"# ID taken from cmdlet documentation
ApplicationId = 'ce933385-9390-45d1-9512-c8d228074e07'
DisplayName = "RA_AA_$($cqName)"}$newAaRa = New-CsOnlineApplicationInstance @newAaRaParams
To create auto attendant, you use New-CsAutoAttendant. It requires 4 parameters:
Name
LanguageId
TimeZoneId
DefaultCallFlow
For finding mandatory parameters, you'll have to check the documentation. Look for names not surrounded with square brackets [ ... ]. Take a look at the example:
Mandatory and optional params based on documentation
The first three of the parameters listed above are strings. They can be defined inline. DefaultCallFlow can be created using New-CsAutoAttendantCallFlow, which takes name and menu.
The cmdlet to create the menu is New-CsAutoAttendantMenu. The only required parameter for it is Name.
However, to configure automatic forward to the call queue, you'll have to configure some objects:
You now have a working application - take a moment to do your happy dance 🎉. Once done, you can think about adding more functionalities:
Call queue members (so someone receives the calls)
Telephone number so clients can call it. Remember to assign Virtual Phone System license, unless you already have group-based licensing doing that for you.
Creating call queues and auto attendants is a time-consuming process. As usual, PowerShell might help you to save some time. Use the skeleton from this article and adapt it to your needs. Happy coding!