Auto-Add new employees

Mathias Koprek
Occasional Contributor



Is it possible to add new members to a team automatically?

We have a team called "general". In this channel there should be all of our employees.
Let´s say our company gets 2 new employees. Both of them will be in the active directory group "employees". Is it possible that they will be automatically added to the team "general"?

Kind Regards


14 Replies

Hi Mathias!


Yes You can achieve this by making the teams Azure AD-group dynamic:

Thanks I will try this.

If I create a new group in the Azure AD will it be created in our Active Directory aswell?


Then You have to use Writeback. (Takes a little planning before you do that though...)


Okay thanks. I wanted to try this out now. Unfortunately I don´t get the membership type "Dynamic User" or the "Dynamic membership rules" that are described in your first link.
Am I doing something wrong?

It requires Azure AD Premium licenses to do dynamic membership.

Dynamic groups are the easy way to do this, but if you don't want to pay for the Azure AD P1 premium licenses, it's easy to script a solution with PowerShell.


1. Look for all new mailboxes (use a custom attribute to indicate whether the user is processed).

2. Call Add-TeamUser, Add-UnifiedGroupLinks, or Add-AzureADGroupMember to update the group/team with the new members.

3. Update the mailboxes to show that the users have been processed.

4. Stir and repeat daily.



I will give this a try!
Thanks a lot!

I am kinda new to PowerShell.

Do you have an example code or script for me? It would be easier for me to understand what exactly I need to do. will give you plenty of tips about how to use the Teams PowerShell module.


Every mailbox has 15 customizable attributes that you can use for your own purposes. Here's how to update a mailbox using CustomAttribute1 with a value that you can later check.


Set-Mailbox -Id Someone -CustomAttribute "Y"


To find all mailboxes that do not have the attribute set:


$Mbx = (Get-Mailbox -Filter {CustomAttribute1 -ne "Y"})


Now process each mailbox and add them to the Office 365 Group (you could also use Add-TeamUser but this is easier because it saves loading a module). Then also update the mailbox so we don't process it again.


ForEach ($M in $Mbx) {

   Add-UnifiedGroupLinks -Id MyGroup -LinkType Members -Links $M.Alias

   Set-Mailbox -Id $M.Alias -CustomAttribute1 "Y"



If you're getting into this kind of stuff, perhaps you should buy a good book that discusses how to use PowerShell with Groups and Teams. Like Office 365 for IT Pros (which I am involved in).

When you are under 200 objects, try to using "Cayosoft" for free. There is an dynamic group options. And you don't need deep dive experience in powershell.

Hi @Mathias Koprek, have you seen the new "Org-wide Teams" settings yet?



As noted earlier, org-wide teams are now available if your tenant is under 1,000 users.


If not, you'll still have to think about another method to add new users to a team automatically, subject to the limit for a team (currently 2,500 members).

Looks like Cayosoft has recently (Dec 2018) eliminated their <200 users-for-free option - their tool does a great job for Teams, AD and exchange mgmt without Powershell, but pricing more realistic for the 500+ companies.

Thanks for the info.
". If your environment has 100 users or less you can request a free subscription license for our commercial tools so you can use all of the features at no charge"
It's new price table.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies