removing a person from all microsoft teams / an organisation

Not applicable

Hi there, 


How can we remove people from ALL microsoft teams / an organisation rather than separately per team? 


Where does an admin person go to resolve this?


Kind regards,


11 Replies
If you go to the azure portal ->users and delete the guest account, the user will be removed
Thanks Adam, must find someone who can access azure portal

Will doing this remove the person from the email / organisation though? when what we want is just to remove them from all microsoft teams they may be part of?

Adam is correct if you are referring to a guest (someone you have invited from an external organisation). But you have the option to block as well which you may want to consider if you are keeping objects in your Azure AD for auditing purposes

@adam deltinger is there a complete list of what is left when you delete a guest? That may be important to get just for awareness.

Best, Chris
AFAIK then you have to do this manually! There might be another way programmatically though, but I’m not sure
Hi @Deleted,

Ah ok - if you are referring to a guest, see the answers above.

If you are a referring to a user within the organisation itself I would not recommend deleting them in AD as this will nuke their other services. To just remove them from Teams, I would recommend Powershell

1. Get the Teams a user may be a part of

2. Remove users from Teams

This is much quicker than trying to sort through the teams and doing it manually in the Teams client. An optional step after doing this is to turn off the Teams licence on that user within their Office 365 licence.

Hope that clarifies.

Best, Chris
By the way, you could automate this by means of PowerShell
Good in theory, then only problem is that command only returns the logged in users Teams ;). So basically that won't give you much. Right now the only thing you could automate is removing them from all Office 365 Groups which will remove them from Teams, but if they have other Office 365 workloads such as Yammer created groups, stand alone planner plans, or just Office 365 groups in general that they need to still be included in, then this won't be an option.

But if you are trying to just remove them from everything then you can find or we could point you to powershell where you can automate this. You can also just go to the users Groups and remove all those as well to accomplish the same, but it's usually mixed in with distro lists as well so won't always work.
Hmmm, I didn't know that it only returns the logged in users Teams. Learnt something new today - thanks! How about pulling it using the Graph - have you had experience using that?

Best, Chris

I recently went through this exercise. I first used Tony Redmonds script here to get a list of all groups and enabled teams.

In order to get if the group is teams enabled i had to add the admin account to all groups first to get the report to show which were teams enabled with details. Once that was done i ran the below script to remove that admin account from all groups/teams.


Apologies if powershell code is not permitted here. If so, admin may remove.


The unifiedgroup.csv is the group name exported out of the master report from Tony Redmonds Script. 


$unifiedgroups1 = import-csv C:\temp\unifiedgroup.csv
Foreach ($unifiedgroups in $unifiedgroups1) {
remove-unifiedgrouplinks -identity $ -links -linktype members -confirm:$false


This worked for me in being able to remove accounts out of all groups including teams at once. Once you have the script output of all teams you can modify the CSV to only include Teams only or all Groups/teams.


@takers365I've not tried running your script yet but do you know what would happen in the following scenarios:


- the user being removed is the only member of a Team

- the user being removed is the only Owner


Would be great if there was a way (in the admin center even) to take care of the above scenarios prior to deleting a user from the Office 365 tenant . Does anyone know what would happen in the above scenarios when I just delete a user? Do I get orphan teams floating around somewhere?