New-Team : groupId couldn't be found, groupId is invalid.

%3CLINGO-SUB%20id%3D%22lingo-sub-2265708%22%20slang%3D%22en-US%22%3ENew-Team%20%3A%20groupId%20couldn't%20be%20found%2C%20groupId%20is%20invalid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2265708%22%20slang%3D%22en-US%22%3E%3CP%3EHello%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20following%20script%2C%20but%20I%20am%20getting%20following%20error.%20Am%20I%20missing%20something%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-Team%20%3A%20groupId%20couldn't%20be%20found%2C%20groupId%20is%20invalid.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EImport-Module%20Microsoft.Online.SharePoint.PowerShell%20-DisableNameChecking%0A%20%0A%24AdminCenterURL%20%3D%20%22https%3A%2F%2Fcrescent-admin.sharepoint.com%22%0A%24SiteURL%20%3D%20%22https%3A%2F%2Fcrescent.sharepoint.com%2Fsites%2Flegal%22%0A%20%0A%23Get%20Credentials%20to%20connect%0A%24Cred%20%3D%20Get-Credential%0A%20%0A%23Connect%20to%20SharePoint%20Online%0AConnect-SPOService%20-Url%20%24AdminCenterURL%20-Credential%20%24Cred%0A%20%0A%23Connect%20to%20Microsoft%20Teams%0AConnect-MicrosoftTeams%20-Credential%20%24Cred%0A%20%0A%23Get%20the%20Site%20collection%0A%24Site%20%3D%20Get-SPOSite%20-Identity%20%24SiteURL%0A%20%0A%23Create%20Teams%20from%20the%20SharePoint%20Site%0ANew-Team%20-GroupId%20%24Site.GroupId.Guid%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2265708%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2266012%22%20slang%3D%22en-US%22%3ERe%3A%20New-Team%20%3A%20groupId%20couldn't%20be%20found%2C%20groupId%20is%20invalid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2266012%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F35729%22%20target%3D%22_blank%22%3E%40Avian%201%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYour%20script%20works%20for%20me.%20I'm%20using%202.0.0%20version%20of%20the%20MicrosoftTeams%20PowerShell%20module.%3C%2FP%3E%0A%3CP%3EIs%20it%20possible%20that%20the%20site%20you%20are%20promoting%20as%20a%20team%20is%20not%20Microsoft%20365%20Group%20enabled%3F%3C%2FP%3E%0A%3CP%3EIs%20%24Site.GroupId%20returning%20a%20value%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2266184%22%20slang%3D%22en-US%22%3ERe%3A%20New-Team%20%3A%20groupId%20couldn't%20be%20found%2C%20groupId%20is%20invalid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2266184%22%20slang%3D%22en-US%22%3EHow%20to%20check%20that%20Microsoft%20365%20group%20is%20enabled%20or%20not%20for%20site%3F%3CBR%20%2F%3E%3CBR%20%2F%3EYes%2C%20%24Site.GroupID%20is%20returning%20value%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2267557%22%20slang%3D%22en-US%22%3ERe%3A%20New-Team%20%3A%20groupId%20couldn't%20be%20found%2C%20groupId%20is%20invalid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2267557%22%20slang%3D%22en-US%22%3EWith%20that%20template%2C%20there%20is%20no%20Microsoft%20365%20Group%20connected%20to%20that%20site.%3CBR%20%2F%3EHow%20are%20you%20creating%20those%20sites%3F%3C%2FLINGO-BODY%3E
Frequent Contributor

Hello

 

I am using following script and am getting following error. Am I missing something?

 

New-Team : GroupId couldn't be found, GroupId is invalid.

 

 

 

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
 
$AdminCenterURL = "https://avian-admin.sharepoint.com"
$SiteURL = "https://avian.sharepoint.com/sites/legal"
 
#Get Credentials to connect
$Cred = Get-Credential
 
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential $Cred
 
#Connect to Microsoft Teams
Connect-MicrosoftTeams -Credential $Cred
 
#Get the Site collection
$Site = Get-SPOSite -Identity $SiteURL
 
#Create Teams from the SharePoint Site
New-Team -GroupId $Site.GroupId.Guid

 

 

 

3 Replies

Hi @Avian 1 

 

Your script works for me. I'm using 2.0.0 version of the MicrosoftTeams PowerShell module.

Is it possible that the site you are promoting as a team is not Microsoft 365 Group enabled?

Is $Site.GroupId returning a value?

How to check that Microsoft 365 group is enabled or not for site?

Yes, $Site.GroupID is returning value

 

However if I test same script in another tenant, it is working fine, creating team site, but when I see the list of SharePoint sites in SharePoint Admin, Primary Admin is showing as user name instead of Group owners and Template it is showing as Team site (no Microsoft group) instead of Team Site.  However when I create site manually, everything is coming properly. This is strange.

 

Regards

Avian

With that template, there is no Microsoft 365 Group connected to that site.
How are you creating those sites?