Teams Auto Attendant and Call Queue Spring-Cleaning

Are your Teams Auto Attendants, Call Queues and Resource Accounts a mess? Or have you lost track of who created which accounts or Voice…

Are your Teams Auto Attendants, Call Queues and Resource Accounts a mess? Or have you lost track of who created which accounts or Voice Apps? You know what they say…

Too Many Cooks Spoil the Broth.

It’s not really spring yet but who cares? Cleaning up your environment is always a good thing. Today we’re talking Teams Phone reporting again. In case you’ve missed some of my previous articles, here’s an overview of what handy scripts I already released last year.

Report on Teams Call Queue Opt In Status and Assignment Paths

Find All Auto Attendants and Call Queues a User is Associated with

Automatically render Microsoft Teams Call Flow Diagrams

How To Export a Teams Call Flow to PNG

I remember that somebody on social media asked me if it was possible to get a list of all Resource Accounts which are not assigned to any Auto Attendant or Call Queue. That’s why I wrote this script in December 2022.

M365CallFlowVisualizer/FindUnassignedResourceAccounts.ps1 at main · mozziemozz/M365CallFlowVisualizer (

This time, I’ve taken it even further and used the M365 Call Flow Visualizer to not only find unused Resource Accounts but also Call Queues and Auto Attendants which are not in use.

What Qualifies as Not in Use?

First of all, any Attendant or any Queue which does not have a Resource Account assigned, can’t be called, or transferred to. They exist, but they’re useless until a Resource Account is linked. This means that all Queues and Attendants which do not have a Resource Account assigned, will be included in the report.

The concept of how Resource Accounts work in combination with Queues and Attendants is explained in detail in the article linked below.

Everything You Ever Wanted to Know About Teams Resource Accounts

Next, the script checks for all Auto Attendants and Call Queues which have a Resource Account without Phone Number assigned. Of course, these are often nested behind top-level Voice Apps and thus can be called without issues. My new script runs the Visualizer (without creating any diagrams) for all top-level Voice Apps (Attendants and Queues with phone numbers) to create a list of all their nested Voice Apps.

Because the Visualizer is also able to read and process user calling settings, it will even detect if a Voice App is set as a user’s forwarding or unanswered target and thus also add it to the list of all nested Voice Apps.

If this list does not contain the current Voice App, it will be included in the report as well. In complex environments, this will save you a lot of time since you don’t need to click through all your Voice Apps manually to check them.

Last but not least, it uses the same code bits from the original “FindUnassignedResourceAccounts.ps1” script to add any Resource Account which is not associated with any Voice App to the report.


There’s one caveat though. In theory, you could have a Voice App (or multiple) which are only called internally by their SIP Address. In this case, the Voice App doesn’t need to be nested anywhere and it doesn’t need a phone number either. All it needs is to have a Resource Account assigned. These Apps will be included in the report as well, so make sure to be extra careful before you actually delete anything.

Under the Hood

During testing, I noticed that Voice Apps which are nested inside a Holiday Call Handling were not detected by the script either. I’ve updated my M365 Call Flow Visualizer so that it will now also expand Auto Attendants and Call Queues which are part of a Holiday transfer action.

Initially, I thought I’d only be able to do this for transfers to Call Queues and Auto Attendants. But with some persistence I was able to also display IVRs which are configured as part of a Holiday Call Handling! Yes, really! This means that the Visualizer can now render every possible call flow which can be configured. At least to my knowledge.

Here’s an example of the new functionality. We can see that the Call Handling for National Swiss Holiday forwards to the Call Queue Ext Pstn Fwd Test inside the Holiday table. Unfortunately, linking both CQ Nodes together, would have messed up the left-right direction of the subgraph and instead made it a top-down one. Therefore, I had to get creative and just link the call flow of the Voice App to the Holiday Subgraph. As an exception, there are now two nodes for the Call Queue Ext Pstn Fwd Test. One is inside the Holiday table, and one is placed in the main diagram.

It’s basically the same for Holiday IVRs (Voice Menus). They include the name of the Holiday Call Handling in which they are configured. This makes it a little easier to spot the corresponding node in the main diagram.

If you want to try this for yourself, you need to add the following parameters when you call the script.

-ShowNestedHolidayCallFlows $true

-ShowNestedHolidayIVRs $true

If you’re interested in learning more about how Holidays work in Teams, consider giving this article a read.

Everything You Ever Wanted to Know About Teams Holidays

Example Output

The script will generate a CSV file containing all unused components including the reason as to why they’re not in use.

I struggled a bit to find a perfect naming for all the columns. The column “Association” tells you whether the Voice App has a Resource Account assigned or if the Resource Account is assigned to a Voice App. The other ones should be self-explanatory.

Free Download

The script is available for free in my GitHub Repo of the M365 Call Flow Visualizer. Make sure that you clone it or download the whole repository as Zip file since there are dependencies.

M365CallFlowVisualizer/FindUnusedVoiceAppsAndResourceAccounts.ps1 at main · mozziemozz/M365CallFlowVisualizer (

Please use this script at your own risk, even though the script does not change or delete anything in your environment. (It only uses Get-* Cmdlets). Just promise to make sure that you verify that any Auto Attendant or Call Queues are indeed not needed anymore before you hit that delete button. Even if you still have to manually confirm and delete unused Voice Apps, I still hope that the output of the script makes it easier for you to identify them at scale.

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Hosted on GitHub Pages
Built with Hugo
Theme Stack designed by Jimmy