Forum Discussion

JFM_12's avatar
JFM_12
Iron Contributor
Jun 25, 2025
Solved

Add existing Holiday to Auto Attendant

Hello

I have created an Auto Attendant and would like to add an existing Holiday that is already configured to 

the Auto Attendant with Powershell.

Is it also possible to rename the CallFlow so that is not unique.

Regards
JFM_12

5 Replies

  • To add an existing Holiday to an Auto Attendant in Microsoft Teams using PowerShell, you should use the Teams PowerShell Module (MicrosoftTeams). You can associate a pre-configured Holiday set with an Auto Attendant using the Set-CsAutoAttendant cmdlet.

    # Connect to Teams PowerShell
    Connect-MicrosoftTeams
    
    # Get the Auto Attendant and Holiday objects
    $autoAttendant = Get-CsAutoAttendant -Identity "<AutoAttendantId or Name>"
    $holidaySet = Get-CsAutoAttendantHolidaySet -Identity "<HolidaySetId or Name>"
    
    # Update the Auto Attendant to use the Holiday set
    Set-CsAutoAttendant -Identity $autoAttendant.Identity -HolidaySets @($holidaySet.Identity)

    Replace <AutoAttendantId or Name> and <HolidaySetId or Name> with your actual values.

     

    Renaming a flow:

    • Call Flow names do not have to be unique across all Auto Attendants, but they must be unique within the same Auto Attendant.
    • You can rename a Call Flow by updating its Name property and then updating the Auto Attendant.
    # Get the Auto Attendant
    $aa = Get-CsAutoAttendant -Identity "<AutoAttendantId or Name>"
    
    # Find the call flow you want to rename
    $callFlow = $aa.CallFlows | Where-Object { $_.Name -eq "OldName" }
    
    # Rename the call flow
    $callFlow.Name = "NewName"
    
    # Update the Auto Attendant with the renamed call flow
    Set-CsAutoAttendant -Instance $aa



    Ref: Set-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn

    Get-CsAutoAttendantHolidays (MicrosoftTeamsPowerShell) | Microsoft Learn

     

     

     

    Thanks, 

    Prasad Das

    ------------------------------------------------------------------------------------------  

    If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.  

    • JFM_12's avatar
      JFM_12
      Iron Contributor

      Hello Prasad Das
      Thank you very much for your answer.
      There is an error for the adding

      Set-CsAutoAttendant : A parameter cannot be found that matches parameter name 'HolidaySets'.

      As far that I see on explanation the ID of the Get-CsAutoAttendantHolidays needs to be the ID of an existing AA which has the holidays.

      The Set-CsAutoAttendant uses only the parameter Instance
      Have a great day

      JFM_12

      • Prasad_Das-MSFT's avatar
        Prasad_Das-MSFT
        Icon for Microsoft rankMicrosoft

        Here's an example which you can follow:

        $autoAttendant = Get-CsAutoAttendant -Identity "fa9081d6-b4f3-5c96-baec-0b00077709e5"
        
        $christmasGreetingPrompt = New-CsAutoAttendantPrompt -TextToSpeechPrompt "Our offices are closed for Christmas from December 24 to December 26. Please call back later."
        $christmasMenuOption = New-CsAutoAttendantMenuOption -Action DisconnectCall -DtmfResponse Automatic
        $christmasMenu = New-CsAutoAttendantMenu -Name "Christmas Menu" -MenuOptions @($christmasMenuOption)
        $christmasCallFlow = New-CsAutoAttendantCallFlow -Name "Christmas" -Greetings @($christmasGreetingPrompt) -Menu $christmasMenu
        
        $dtr = New-CsOnlineDateTimeRange -Start "24/12/2017" -End "26/12/2017"
        $christmasSchedule = New-CsOnlineSchedule -Name "Christmas" -FixedSchedule -DateTimeRanges @($dtr)
        
        $christmasCallHandlingAssociation = New-CsAutoAttendantCallHandlingAssociation -Type Holiday -ScheduleId $christmasSchedule.Id -CallFlowId $christmasCallFlow.Id
        
        $autoAttendant.CallFlows += @($christmasCallFlow)
        $autoAttendant.CallHandlingAssociations += @($christmasCallHandlingAssociation)
        
        Set-CsAutoAttendant -Instance $autoAttendant


        This example adds a Christmas holiday to an AA that has an Identity of fa9081d6-b4f3-5c96-baec-0b00077709e5.

        Ref: Set-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn

         

        TAC reference here - https://learn.microsoft.com/en-us/microsoftteams/create-a-phone-system-auto-attendant?tabs=call-flow#step-23-set-up-call-flows-for-holidays-optional

Resources