Create a Team From Existing SharePoint Online Modern Team Site Using PowerShell

In this blog, you will see how to create a team in Microsoft Teams from an existing SharePoint Online modern team site (connected to Office 365 group) using PowerShell.
 
I have created a modern team site (connected to an Office 365 group) and created multiple document libraries and lists in the site. I want to create a Team in Microsoft Teams using this site so that files will be shared in this SharePoint site instead of creating a new site and also, I can have the same site structure (document libraries, lists etc.) which was already created.
 
 
Note
This approach will not work for SharePoint Online Modern Communication site.
 
Prerequisites
 
Install the Teams Cmdlets module.
 
Reference URL: https://www.powershellgallery.com/packages/MicrosoftTeams/1.0.5
 
PowerShell Script
  1. ## Input Parameters  
  2. $siteURL="https://c986.sharepoint.com/sites/ukcommunicationsitedemo"  
  3. $tenantURL="https://c986-admin.sharepoint.com"  
  4. $credential = Get-Credential  
  5.  
  6. ## Connect to Microsoft Teams  
  7. Connect-MicrosoftTeams -Credential $credential  
  8.  
  9. ## Connectto SharePoint Online Service  
  10. Connect-SPOService -Url $tenantURL -Credential $credential  
  11. $site = Get-SPOSite -Identity $siteURL  
  12.  
  13. ## Create a new Team  
  14. New-Team -GroupId $site.GroupId.Guid   
Result
 
A new team was created successfully and it will be using the existing SharePoint Modern Team Site
 
 

Summary

 
Thus, in this blog, you saw how to create a team in Microsoft Teams from existing SharePoint Online modern team site (connected to Office 365 group) using PowerShell.