How to Configure Teams Phone Auto Attendants in PowerShell Using New-CsAutoAttendant

In Microsoft Teams Phone System, Auto Attendants serve as the automated front door for enterprise telecommunications. They greet external callers, play corporate announcements, offer Interactive Voice Response (IVR) menu choices via Dual-Tone Multi-Frequency (DTMF) keypresses or speech recognition, and route calls intelligently to users, call queues, shared voicemail, or external telephone numbers. While administrators can configure Auto Attendants through the Microsoft Teams admin center, large enterprise deployments, disaster recovery provisioning, and automated tenant buildouts require programmatic administration. In the Microsoft Teams PowerShell module, administrators create, update, and manage Auto Attendants using the *-CsAutoAttendant cmdlets.

Understanding Microsoft Teams Auto Attendant Architecture

An Auto Attendant in Microsoft Teams is composed of several interdependent logical entities configured together:

  • Resource Account: A disabled Microsoft Entra ID user account paired with a Teams Phone Resource Account license. It holds the primary public telephone number (DID) and acts as the telephony anchor for the Auto Attendant.
  • Call Flows: Defines the business logic governing how callers are handled. An Auto Attendant can maintain separate call flows for default business hours, after-hours schedules, and corporate holidays.
  • Menu and Greeting Options: Includes text-to-speech (TTS) prompts or uploaded audio files (WAV, MP3, or WMA) that greet callers and present options (e.g., “Press 1 for Sales, Press 2 for Support”).
  • Dial by Name (Directory Search): Allows callers to search corporate employee directories by speaking a name or spelling it using telephone keypad numbers.
  • Language and Time Zone: Sets the text-to-speech voice synthesizer accent, recognition language, and operational time zone.

Connecting to the Microsoft Teams PowerShell Module

Configuring Auto Attendants requires Teams Administrator permissions. Open an elevated PowerShell console and connect to your tenant:

# Install Microsoft Teams module if not present
Install-Module -Name MicrosoftTeams -Force -AllowClobber

# Authenticate to tenant
Connect-MicrosoftTeams

Inspecting Existing Auto Attendants

To list all Auto Attendants currently active in your Microsoft 365 tenant:

Get-CsAutoAttendant

To inspect detailed configuration properties for a specific Auto Attendant:

Get-CsAutoAttendant -Identity "b7c251d8-0401-4475-bfa3-02f0a1c1d89e" | Select-Object Name, LanguageId, TimeZoneId, Operator, DefaultCallFlow | Format-List

Building Auto Attendant Menus and Call Flows

Creating an Auto Attendant programmatically requires constructing the underlying prompt and menu objects before assembling the parent Auto Attendant entity.

Step 1: Construct Menu Options

Define the interactive menu choices. The following commands configure Option 1 to transfer to a Sales Call Queue and Option 2 to route to a Support Call Queue:

# Query target Call Queue application instance IDs
$SalesQueueId = (Get-CsCallQueue -Name "Sales-Tier1-Queue").Identity
$SupportQueueId = (Get-CsCallQueue -Name "Support-Tier1-Queue").Identity

# Create menu option 1 (Sales)
$Option1 = New-CsAutoAttendantMenuOption `
  -KeypadOption 1 `
  -Action TransferCallToTarget `
  -CallTarget (New-CsAutoAttendantCallableEntity -Identity $SalesQueueId -Type User)

# Create menu option 2 (Support)
$Option2 = New-CsAutoAttendantMenuOption `
  -KeypadOption 2 `
  -Action TransferCallToTarget `
  -CallTarget (New-CsAutoAttendantCallableEntity -Identity $SupportQueueId -Type User)

Step 2: Construct the Menu and Greeting Prompts

Create the greeting prompt using Text-to-Speech (TTS) and associate the menu options:

# Define text-to-speech prompt
$GreetingText = "Thank you for calling Contoso Global. For Sales, press 1. For Technical Support, press 2."
$MenuPrompt = New-CsAutoAttendantPrompt -TextToSpeechPrompt $GreetingText

# Assemble the menu object
$MainMenu = New-CsAutoAttendantMenu `
  -Name "Contoso-Main-Menu" `
  -Prompts @($MenuPrompt) `
  -MenuOptions @($Option1, $Option2)

Step 3: Construct the Default Call Flow

Package the menu into an active call flow:

$DefaultFlow = New-CsAutoAttendantCallFlow `
  -Name "Default-Business-Hours-Flow" `
  -Menu $MainMenu

Creating the Auto Attendant with New-CsAutoAttendant

Once the call flow components are instantiated, create the parent Auto Attendant using New-CsAutoAttendant:

$NewAA = New-CsAutoAttendant `
  -Name "Contoso-HQ-AutoAttendant" `
  -LanguageId "en-GB" `
  -TimeZoneId "GMT Standard Time" `
  -DefaultCallFlow $DefaultFlow

# Output newly generated Auto Attendant ID
Write-Output "Auto Attendant Created: $($NewAA.Identity)"

Associating an Application Instance (Resource Account)

To enable the Auto Attendant to receive inbound PSTN calls, link it to an existing Resource Account possessing an assigned phone number:

# Retrieve Resource Account ObjectId
$ResourceAccount = Get-CsOnlineApplicationInstance -UserPrincipalName "[email protected]"

# Bind Resource Account to the Auto Attendant
New-CsAutoAttendantApplicationInstanceAssociation `
  -AutoAttendantId $NewAA.Identity `
  -ApplicationInstanceId $ResourceAccount.ObjectId

Updating Existing Auto Attendants with Set-CsAutoAttendant

To update the greeting text or alter language settings on an existing Auto Attendant:

# Retrieve existing Auto Attendant object
$AA = Get-CsAutoAttendant -Identity $NewAA.Identity

# Update language to UK English
$AA.LanguageId = "en-GB"

# Apply changes
Set-CsAutoAttendant -Instance $AA

Removing an Auto Attendant

When decommissioning an Auto Attendant, first disassociate all assigned resource accounts, then remove the entity using Remove-CsAutoAttendant:

# Remove application instance association
Remove-CsAutoAttendantApplicationInstanceAssociation `
  -AutoAttendantId $NewAA.Identity `
  -ApplicationInstanceId $ResourceAccount.ObjectId

# Delete the Auto Attendant
Remove-CsAutoAttendant -Identity $NewAA.Identity -Confirm:$false

By leveraging PowerShell’s CsAutoAttendant cmdlets, enterprise voice administrators can automate multi-tier IVR deployments, maintain consistent global telephony configurations, and implement reliable call routing across Microsoft Teams Phone deployments.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.