SOLVED
Home

via Powershell added Team Owner can´t create a Plan

%3CLINGO-SUB%20id%3D%22lingo-sub-290216%22%20slang%3D%22en-US%22%3Evia%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290216%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%40%20all%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%C2%B4ve%20a%20simple%20Problem%20but%20i%20didn%C2%B4t%20find%20a%20solution%20yet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%C2%B4ve%20a%20Service%20Account%20who%20creates%20a%20MS%20Teams%20via%20Powershell.%20The%20Script%20is%20straight%20forward%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConnect-MicrosoftTeams%20-Credential%20%24credteams%3CBR%20%2F%3E%3CBR%20%2F%3E%23Create%20Team%3CBR%20%2F%3Etry%7B%3CBR%20%2F%3E%26nbsp%3B%20%24team%20%3D%20New-Team%20-DisplayName%20%24Displayname%20-Description%20%24Description%20-Alias%20%24Displayname%20-AccessType%20%24accesstype%20-AddCreatorAsMember%20%24false%3CBR%20%2F%3EAdd-TeamUser%20-GroupId%20%24team.GroupId%20-User%20%24owner%20-Role%20Owner%3CBR%20%2F%3E%7D%3CBR%20%2F%3Ecatch%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%24ErrorMessage%20%3D%20%24_.Exception.Message%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%24FailedItem%20%3D%20%24_.Exception.ItemName%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3Efinally%7B%3CBR%20%2F%3E%7D%3CBR%20%2F%3EDisconnect-MicrosoftTeams%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20the%20new%20Owner%20creates%20a%20Planner%20in%20the%20Team%20an%20error%20appears%20that%20the%20creation%20of%20it%20failed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20Workaround%20is%2Cremove%20the%20new%20owner%20manually%20an%20add%20the%20owner%20again%20to%20the%20Team.%20Now%20it%C2%B4s%20possible%20to%20create%20a%20Planner.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHas%20anybody%20an%20idea%3F%3CBR%20%2F%3E%3CBR%20%2F%3EGreetz%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAndre%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-290216%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPlanner%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETeams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-309169%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-309169%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20right.%20As%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%26nbsp%3Bmentioned%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20particular%20scenario%20the%20Team%20had%20already%20been%20created%20and%20I%20needed%20to%20add%20other%2C%20multiple%2C%20owners%20to%20the%20Team.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308839%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308839%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20point%20is%20that%20even%20though%20New-Team%20does%20the%20right%20thing%20by%20adding%20the%20owner%20of%20a%20new%20team%20as%20a%20member%2C%20subsequent%20additions%20of%20owners%20with%20New-TeamUser%20might%20not...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308815%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308815%22%20slang%3D%22en-US%22%3E%3CP%3EI%20agree%20with%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F23556%22%20target%3D%22_blank%22%3E%40Magnus%20Sandtorv%3C%2FA%3E%2C%20if%20you%20use%20the%20new-team%20-owner%20it%20will%20create%20all%20the%20right%20permission%2C%20you%20also%20don't%20need%26nbsp%3B%3CSPAN%3E-AddCreatorAsMember%20anymore.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFor%20extra%20marks%20you%20could%20also%20call%20Microsoft%20Graph%20and%20add%20the%20Planner%20tab%20automatically%2C%20something%20I'm%20going%20to%20blog%20about%20soon.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308806%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308806%22%20slang%3D%22en-US%22%3E%3CP%3EWith%26nbsp%3Bversion%200.9.6%20of%20the%20module%20you%20can%20also%20add%20an%20owner%20while%20creating%20the%20team%20using%3C%2FP%3E%0A%3CPRE%3ENew-Team%20-Owner%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308385%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308385%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20you're%20right.%20Member%20first%20then%20owner%20is%20better.%20This%20method%20is%20actually%20enforced%20by%20the%20Office%20365%20Groups%20cmdlets...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308199%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20ile%20eklenen%20tak%C4%B1m%20sahibi%20can%C2%B4t%20bir%20Plan%20olu%C5%9Fturun%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308199%22%20slang%3D%22en-US%22%3EOlu%C5%9Ftrdu%20the%20main%20page%20to%20your%20account%20after%20you%20are%20not%20too%20hard%20I%20added%20but%20has%20not%20added%20any%20to%20Favorites%20is%20really%20that%20time%20can%20be%20very%20difficult.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-308191%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308191%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%20for%20solving%20this%20head%20scratcher%20for%20us!%20I%20also%20wanted%20to%20note%20that%2C%20for%20us%20anyway%2C%20the%20order%20in%20which%20you%20add%26nbsp%3Bthe%20users%20and%20subsequent%20roles%20matters.%26nbsp%3BRunning%20MicrosoftTeams%20powershell%20module%20v.%200.9.6%20we%20had%20to%20add%20the%20user%20as%20a%20member%20first%20and%20then%20an%20owner.%20Example%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EAdd-TeamUser%20-GroupId%20%24TeamName.GroupId%20-User%20%22user%40contoso.com%22%20-Role%20Member%3CBR%20%2F%3EAdd-TeamUser%20-GroupId%20%24TeamName.GroupId%20-User%20%22user%40contoso.com%22%20-Role%20Owner%3C%2FPRE%3E%3CP%3E%26nbsp%3BDoing%20the%20inverse%20would%20cause%20mixed%20results%20of%20the%20user%20not%20showing%20up%20as%26nbsp%3Bpart%20of%20the%20team%20at%20all%20or%20showing%20up%20in%20Teams%20with%20just%20the%20%22Member%22%20role.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290629%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290629%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22text-align%3A%20left%3B%22%3EI%20believe%20that%20you%20must%20add%20the%20user%20as%20an%20owner%20and%20as%20a%20member.%20Azure%20Active%20Directory%20separates%20the%20two%20roles%20(have%20a%20look%20at%20any%20group)%20to%20allow%20non-members%20to%20manage%20a%20group.%20Dynamic%20groups%20are%20a%20good%20example%20as%20it's%20not%20always%20the%20case%20that%20an%20owner%20comes%20within%20the%20scope%20of%20the%20query%20used%20to%20determine%20group%20membership.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3EFurther%20evidence%20is%20in%20Office%20365%20Groups%2C%20which%20have%20always%20insisted%20that%20you%20should%20add%20owners%20to%20both%20the%20owner%20and%20member%20lists.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3EI%20did%20some%20testing%20and%20have%20written%20up%20the%20issue%20in%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Foffice365itpros.com%2F2018%2F11%2F23%2Fcreating-teams-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foffice365itpros.com%2F2018%2F11%2F23%2Fcreating-teams-powershell%2F%3C%2FA%3E%20so%20that%20others%20don't%20fall%20into%20the%20same%20problem.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290547%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290547%22%20slang%3D%22en-US%22%3ETo%20add%20the%20User%20first%20as%20a%20Member%20an%20then%20set%20the%20same%20User%20as%20Owner%20works%20fine%20but%20i%20think%20there%20must%20be%20a%20change%20in%20the%20PowerShell%20Module.%3CBR%20%2F%3EYou%20see%20this%20also%20in%20the%20Teams%20Admin%20Center.%20The%20User%20is%20set%20as%20a%20Owner%20in%20the%20Team%2C%20but%20when%20you%20switch%20the%20user%20as%20a%20member%20you%20get%20a%20notification%2C%20User%20deleted%20but%20the%20User%20is%20still%20shown%20in%20the%20Portal.%20When%20you%20now%20want%20to%20delete%20the%20User%20you%20get%20an%20error%20Message.%3CBR%20%2F%3E%3CBR%20%2F%3EVery%20Strange%20but%20i%20hope%20the%20Teams%20Powershell%20Team%20will%20fix%20it%20%3B)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290491%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290491%22%20slang%3D%22en-US%22%3EYeah%20but%20I%E2%80%99m%20saying%20if%20someone%20is%20only%20listed%20as%20an%20owner%20they%20will%20have%20issues%20with%20search%20on%20the%20attached%20sharepoint.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290488%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290488%22%20slang%3D%22en-US%22%3EA%20team%20member%20is%20also%20a%20group%20member%20with%20access%20to%20the%20underlying%20SharePoint%20site.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290459%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290459%22%20slang%3D%22en-US%22%3EAlso%20need%20to%20make%20sure%20they%20are%20members%20for%20the%20connected%20SharePoint%20as%20none%20of%20the%20search%20indexing%20works%20right%20when%20an%20owner%20isn%E2%80%99t%20also%20a%20member%20of%20the%20group.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290372%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290372%22%20slang%3D%22en-US%22%3EIn%20version%200.9.5%20of%20the%20Microsoft%20Teams%20PowerShell%20module%20you%20also%20need%20to%20add%20the%20owner%20as%20a%20member%20to%20allow%20access%20to%20Planner.%3CBR%20%2F%3E%3CBR%20%2F%3EAdd-TeamUser%20-GroupId%20%24team.GroupId%20-User%20%24owner%20-Role%20Member%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290255%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290255%22%20slang%3D%22en-US%22%3E%3CP%3ESeems%20to%20be%20working%20fine%20with%20same%20scenario.%20Did%20you%20try%20straight%20after%20creating%20team%20using%20PS%20or%20allowed%20sometime%20to%20replicate%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290240%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290240%22%20slang%3D%22en-US%22%3EA%20quick%20update%20from%20my%20side%3A%20I'm%20able%20to%20reproduce%20the%20error%20you%20are%20habing...very%20weird%20because%20apparently%20everything%20is%20fine%20with%20the%20user%20in%20regards%20of%20being%20an%20owner%20of%20the%20Team%20and%20the%20underlying%20Group%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290232%22%20slang%3D%22en-US%22%3ERe%3A%20via%20Powershell%20added%20Team%20Owner%20can%C2%B4t%20create%20a%20Plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290232%22%20slang%3D%22en-US%22%3EThat's%20very%20strange%20and%20the%20creation%20of%20Teams%20by%20means%20of%20PS%20should%20not%20introduce%20any%20side%20effects%20such%20as%20having%20problems%20when%20creating%20a%20Planner%20Plan.%3C%2FLINGO-BODY%3E
Highlighted
Andre Schmidt
New Contributor

Hi @ all

 

I´ve a simple Problem but i didn´t find a solution yet.

 

I´ve a Service Account who creates a MS Teams via Powershell. The Script is straight forward:

 

Connect-MicrosoftTeams -Credential $credteams

#Create Team
try{
  $team = New-Team -DisplayName $Displayname -Description $Description -Alias $Displayname -AccessType $accesstype -AddCreatorAsMember $false
Add-TeamUser -GroupId $team.GroupId -User $owner -Role Owner
}
catch{
    $ErrorMessage = $_.Exception.Message
    $FailedItem = $_.Exception.ItemName

}
finally{
}
Disconnect-MicrosoftTeams

 

 

If the new Owner creates a Planner in the Team an error appears that the creation of it failed.

 

My Workaround is,remove the new owner manually an add the owner again to the Team. Now it´s possible to create a Planner.

 

Has anybody an idea?

Greetz

 

Andre

 

16 Replies
Highlighted
That's very strange and the creation of Teams by means of PS should not introduce any side effects such as having problems when creating a Planner Plan.
Highlighted
A quick update from my side: I'm able to reproduce the error you are habing...very weird because apparently everything is fine with the user in regards of being an owner of the Team and the underlying Group
Highlighted

Seems to be working fine with same scenario. Did you try straight after creating team using PS or allowed sometime to replicate?

Highlighted
Solution
In version 0.9.5 of the Microsoft Teams PowerShell module you also need to add the owner as a member to allow access to Planner.

Add-TeamUser -GroupId $team.GroupId -User $owner -Role Member
Highlighted
Also need to make sure they are members for the connected SharePoint as none of the search indexing works right when an owner isn’t also a member of the group.
Highlighted
A team member is also a group member with access to the underlying SharePoint site.
Highlighted
Yeah but I’m saying if someone is only listed as an owner they will have issues with search on the attached sharepoint.
Highlighted
To add the User first as a Member an then set the same User as Owner works fine but i think there must be a change in the PowerShell Module.
You see this also in the Teams Admin Center. The User is set as a Owner in the Team, but when you switch the user as a member you get a notification, User deleted but the User is still shown in the Portal. When you now want to delete the User you get an error Message.

Very Strange but i hope the Teams Powershell Team will fix it ;)
Highlighted

I believe that you must add the user as an owner and as a member. Azure Active Directory separates the two roles (have a look at any group) to allow non-members to manage a group. Dynamic groups are a good example as it's not always the case that an owner comes within the scope of the query used to determine group membership.

 

Further evidence is in Office 365 Groups, which have always insisted that you should add owners to both the owner and member lists.

 

I did some testing and have written up the issue in https://office365itpros.com/2018/11/23/creating-teams-powershell/ so that others don't fall into the same problem.

Highlighted

Thanks @Tony Redmond for solving this head scratcher for us! I also wanted to note that, for us anyway, the order in which you add the users and subsequent roles matters. Running MicrosoftTeams powershell module v. 0.9.6 we had to add the user as a member first and then an owner. Example:

 

Add-TeamUser -GroupId $TeamName.GroupId -User "user@contoso.com" -Role Member
Add-TeamUser -GroupId $TeamName.GroupId -User "user@contoso.com" -Role Owner

 Doing the inverse would cause mixed results of the user not showing up as part of the team at all or showing up in Teams with just the "Member" role.

Highlighted
Oluştrdu the main page to your account after you are not too hard I added but has not added any to Favorites is really that time can be very difficult.
Highlighted

Yes, you're right. Member first then owner is better. This method is actually enforced by the Office 365 Groups cmdlets...

Highlighted

With version 0.9.6 of the module you can also add an owner while creating the team using

New-Team -Owner

 

Highlighted

I agree with @Deleted, if you use the new-team -owner it will create all the right permission, you also don't need -AddCreatorAsMember anymore.

 

For extra marks you could also call Microsoft Graph and add the Planner tab automatically, something I'm going to blog about soon.

Highlighted

The point is that even though New-Team does the right thing by adding the owner of a new team as a member, subsequent additions of owners with New-TeamUser might not...

Highlighted

That's right. As @Tony Redmond mentioned:

 

In my particular scenario the Team had already been created and I needed to add other, multiple, owners to the Team.