Powershell script to add members to teams?

Not applicable

Is there a powershell script to add exiting AD users/members to Exisitng Teams?

14 Replies
My understanding is that you will have to use the Microsoft Graph in PS to be able to add team members

You should be able to do it via regular cmdlets too, i.e.


Add-UnifiedGroupLinks -Identity team -LinkType Member -Links


However things happen slooooooow with this approach, so Graph should be better I guess.

FYI, MS just announced that some groups for certain Managers and their Direct Reports will be getting created automatically to, see


THis may be helpful


I dont believe I have the option of using the Microsoft Graph API yet. We dont have any Azure accounts as well as i'm not quite sure how to do any of that. I still just connect to Office365 through a Azure Active Directory Module for Powershell


Thank you for the cmdlet - That did work. Is there anyway to also set the role as well for the user? (Owner/Member)


Yes, all roles are different "link" types:


Add-UnifiedGroupLinks -Identity team -LinkType Owner -Links

Dynamic group creation has been delayed and rolled out to a select set of customers first to gather more feedback.


is there a difference between this Unified Group and the Azure AD powershell Add-AzureADGroupMember cmdlet, for example? I just did some tests with the AAD powershell and that managed to work for editing membership of a MS Team (supported by its underlying O365 group). I was just curious what capabilities or what is different with this UnifiedGroup cmdlet I see mentioned here and on some MS blogs.   Thanks!

@Sonia Cuff is there any news about MS Teams supporting dynamic (attribute-based) memberships now, or soon in the future? 

Teams members are stored in Azure AD groups, those can be populated dynamically if you have Azure AD P2 licenses, see


Thanks very much Dean for the link, I've read that article before but appears to have some new information in there. Actually turns out it's just P1 to support dynamic groups as well which is a plus, (which luckily I have) but now working out the dynamics of using powershell with custom functions, it's not standard cmdlets to enable this in powershell.


I have an open Premier case about this capability.   The case notes say that our issue appears to be "enableDynamicMembershipTeams value is set to False for tenant".  This gives me hope that this capability will be available soon.   It would still require a AD PRemeium license though.

Yes : 



Add-TeamUser -GroupId $($TheTeam.GroupId) -Role Owner/Member -User $UserPrincipalName


Have you ever tried the below example before? When i do, the owner that is added is not able to add apps to the new Team, where as anyone else added as a owner / member from the front end is able to

Scenario :

Create a New Team Via Powershell (Service Account)
Add another Owner
Go to front interface and install apps... result fails to install