Currently Power365 Directory Sync supports the creation of an Office 365 Group. Once that group is created in the target, it can be used to create a new team. At this time, to create the new team, it is recommended that Team’s PowerShell module be used.
There are several options to create a new Team with an existing Office 365 Group. The new team may be created using the Team client, web client or PowerShell. Additional information can be found here.
The Team PowerShell module is recommended for bulk operations. This example provides a method to create a new Team in the target using an existing Office 365 Group, if the group is not already attached to a Team.
- Install-Module MicrosoftTeams
- Connect to Exchange Online
- Connect-MicrosoftTeams
- Run Script
# This script creates new teams based on the existing groups
# If the group is already associated with a team, it is skipped
# If you do not have the Teams module installed, run "install-module microsoftteams" before proceeding
# Tenant Creds
$TargetAdminAccount = "O365.Admin@contoso.onmicrosoft.com"
$MyPW = "PASSWORD1234"
$Targetpasswd = ConvertTo-SecureString
$MyPW -AsPlainText -Force
$TargetCreds = New-Object System.Management.Automation.PSCredential ($TargetAdminAccount, $Targetpasswd)
# Connect to Exchange Online
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $TargetCreds -Authentication Basic –AllowRedirection
Import-PSSession $Session
Import-Module msonline
Connect-MsolService -Credential $TargetCreds
# Install Teams Module
#Install-Module MicrosoftTeams
#Connect to Teams
Connect-MicrosoftTeams -Credential $TargetCreds
# Convert All Groups to Teams if the group is not already part of a team
$UnifiedGroups = Get-UnifiedGroup -ResultSize Unlimited
$Teams = Get-Team
foreach ($Group in $UnifiedGroups)
{ If (!($Teams.GroupId -match $group.ExternalDirectoryObjectId))
{
New-Team -Group $Group.ExternalDirectoryObjectId
}
}
Additional Information
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center