Hi @Jonathan Enrique Nieves Pagan
Managing the removal of users from Microsoft Teams chats once their Microsoft 365 accounts have been deleted can be a bit complex, as there isn't an out-of-the-box policy specifically for this purpose. However, you can automate parts of the process to ensure that users are removed from Teams when their accounts are deleted in Active Directory (AD). Here's a general approach you can consider:
- Automate Account Deactivation and Deletion:
- Use PowerShell scripts to automate the deactivation and deletion of accounts. You can schedule these scripts to run periodically and check for accounts that need to be removed.
- Using Microsoft Graph API:
- Utilize the Microsoft Graph API to manage Teams users and their memberships in chats and teams. This allows you to programmatically remove users from chats.
- You can create a script that triggers upon account deletion to remove the user from all teams and chats.
- Dynamic Groups and Policies:
- Use Azure AD dynamic groups to manage memberships more effectively. When a user is deleted from Active Directory, their removal from dynamic groups can trigger subsequent actions for Teams.
- Implement conditional access policies to restrict access once users are marked for deletion.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.