Tip: Make Sure to Add Owners as Members When Creating New Teams

Creating New Teams is Easy

New teams can be created in a variety of ways – through a Teams client, via PowerShell, or by using the Graph API.

If you create a team via a client, the person creating the team is automatically added as the owner. Their account is also added to the membership of the underlying Azure Active Directory (and Office 365) group. Teams masks this fact by only ever displaying the owner entry if you check using a client or PowerShell.

For instance, here’s a small team with 1 owner and 3 members as viewed through the Teams client:

RWC19
Teams lists the membership of a team

Examining Team Membership

If we look at the membership of the team via PowerShell, we see the following:

But if we examine the membership via Azure Active Directory, we see:

And the same information is reported for the Office 365 Group:

Planner Likes Members

Why is this important? Well, it’s not if you only ever create new teams via a client. It becomes important if you create new teams via PowerShell or the Graph, because it means that you should always add new owners as members first, and then add them as an owner. If you don’t, applications that check for membership of the underlying group will fail. Planner is one application that I know that won’t allow a team owner access unless they are also a member, but that doesn’t mean that there aren’t others that will also fail, now or in the future.

Creating a New Team with PowerShell

The right way to create a new team with PowerShell is to create the team with the New-Team cmdlet and specify the name of the team owner in the call (this also adds that person as a member). Afterwards, add other owners and members of the team with the Add-TeamUser cmdlet, making sure to add the owners first as a team member and then as an owner.

In this example, we create a new team and then add one owner and one member. The $TeamId variable stores the GUID for the new team, which makes it easy to call Add-TeamUser. As you can see, Donald Vickers is added both as an owner and as a member.

All good clean PowerShell fun…

Note: The current Teams PowerShell module is 0.9.6. You need to use this version to see things work as described in this article.


We cover using PowerShell to work with Teams and Office 365 Groups in Chapter 14 of the Office 365 for IT Pros eBook. We like Teams, so there’s lots to discuss.

Advertisements

6 Replies to “Tip: Make Sure to Add Owners as Members When Creating New Teams”

    1. You could do this with PowerShell by running the Add-UnifiedGroupLinks cmdlet to add the admin account to each group.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.