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
- Azure Automation Account creation
- Add Teams PowerShell Module
- Add Azure Automation Credentials
- Call Queue settings and Identity
- 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).
- Create a Shared Mailbox.
For example: On-Duty Calendar - Add the user that will run the Power Automate Flow as a Member of the Shared Mailbox
- Use Outlook to access the Shared Mailbox Calendar
https://outlook.office.com/calendar/<SharedMailboxEmailaddress>/view/month - 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
Awesome.āAny variant on this from MS Teams Shifts?
LikeLike
should finish my text… any variant from an exchange mailbox (ical or other) source of a on-call-rota?
LikeLiked by 1 person
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
LikeLike
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?
LikeLiked by 1 person
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.
LikeLike