How to update Teams Call Queue settings based on Calendar scheduling

Hi All,

a Customer ask me recently how they could update some Teams Call Queue settings based on a Calendar scheduling.

For example they wants to change the “On-Duty mobile number” based on the On-Duty Operator’s shift

Let’s see how!

Prerequisites #1: Azure Automation setup

We will use (again!) the Azure Automation solution to achieve this goal.
Before continue, please setup these steps from my previous article:

How to use Lightweight Bot and Azure Automation to interact with Teams Call Queue

  1. Azure Automation Account creation
  2. Add Teams PowerShell Module
  3. Add Azure Automation Credentials
  4. Call Queue settings and Identity
  5. Runbook and Webhook setup

The Solution

The idea is to use a Power Automate Flow that will trigger few minutes before the Shift change, read the new On-Duty Operator information, retrieve the mobile number from Entra ID and execute an Azure Automation Runbook to change the Call Queue external number to call.

Prerequisites #2: Shared Mailbox Calendar

It’s quite common to use a Shared Mailbox Calendar for this kind of needs, but it’s important to correctly share this calendar to the user that will host the Power Automate Flow (see next step).

  1. Create a Shared Mailbox.
    For example: On-Duty Calendar
  2. Add the user that will run the Power Automate Flow as a Member of the Shared Mailbox
  3. Use Outlook to access the Shared Mailbox Calendar
    https://outlook.office.com/calendar/<SharedMailboxEmailaddress>/view/month
  4. Share the calendar the to the user associated to the Power Automate Flow

Calendar appointments for the shifts

In this example, the Calendar appointments to register the shifts needs to have the On-Call Duty Operator’s user part of the UPN as the Title.

For example if Luca Vitali, with a UPN “luca.vitali@domain.com”, is the Operator from 20.00 to 08.00, you have to create an appointment in this time slot with luca.vitali as Title

Power Automate Flow

Now that we’ve everything we need from the steps above (Shared Mailbox Calendar and Azure Automation Webhook), we can create the Flow.
Remember that you need a Power Automate Premium license to execute this flow (HTTP actions are PREMIUM)

This is the Flow overview:

The flow will be executed thanks to the Trigger “When an upcoming event is starting soon (V3)”
You should now be able to see the Shared Mailbox Calendar.
I suggest to set to 5 minutes the “Look-Ahead Time” value.

In this example the Subject of the calendar appointment will be the user part of the UPN, so we have to add the domain part to obtain the full UPN

Then we use the result to make a Entra ID search and obtain the Mobile number of the On-Duty Operator

Last but not least, we can invoke the Azure Automation Webhook and pass it the On-Duty Operator mobile number. The Runbook will then set this number as the Teams Call Queue external number to call.

Because Azure Automation Webhook do not answer to the call with any kind of response, it’s mandatory to use this trick to complete the Flow.
Add a simple task and use Configure run after to execute it in every conditions.

As always, I hope this could help some of you.
Best.
Luca

5 thoughts on “How to update Teams Call Queue settings based on Calendar scheduling

Add yours

      1. Hi Simon,
        The MS Shift variant could be very interesting to create, thank you for this suggestion. I’ll work on it!
        About the second request, I’m not sure to correctly understand what do you mean. Could you please provide more details?
        Thanks. Luca

        Like

  1. Hi there Luca, this is great and just what I need for my admin team.ā€‚So anyways, what I am planning on doing it our current on-call number, going to port it over into our Teams environment, and setup this to use their Team numbers, but my question is, do you have an idea how to handle text messages using this process?ā€‚Since for the most part mainly they receive texts, very seldom receive calls?

    Liked by 1 person

    1. Hi Daniel, happy this article could help you! I’m honest, I’ve never managed text (SMS), and no customer ask me to managed them.
      I’m quite sure that this solution will completely break the SMS routing to the on-duty mobile phone, nothing in this solution support SMS (SS7 protocol).
      I’m sorry.

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

Up ↑