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
- ## Input Parameters
- $siteURL="https://c986.sharepoint.com/sites/ukcommunicationsitedemo"
- $tenantURL="https://c986-admin.sharepoint.com"
- $credential = Get-Credential
-
- ## Connect to Microsoft Teams
- Connect-MicrosoftTeams -Credential $credential
-
- ## Connectto SharePoint Online Service
- Connect-SPOService -Url $tenantURL -Credential $credential
- $site = Get-SPOSite -Identity $siteURL
-
- ## Create a new Team
- 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.