A previous article explains how to delete Teams chats using an interactive Microsoft Graph PowerShell SDK session. This article builds on that information and explains how to use an Azure Automation runbook to find and remove specified chat threads by scanning all user accounts. The results of the scan and any removed chat threads are emailed to a nominated address at the end of processing.
A beta version of a Graph API to delete Teams chat threads allows administrators to remove unwanted chats. This article reviews how the API requests work to delete, list, and undo deleted chat threads using cmdlets from the Microsoft Graph PowerShell SDK. The first step is to find chats to remove, so we wrote a script to report all the chat threads for the signed-in user.