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

Iron 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?