The Update-MgTeam cmdlet allows administrators to update settings for an existing Microsoft Team. This is essential for maintaining consistent team management policies, enabling or disabling features for users, and making large-scale updates efficiently.
Update-MgTeam -TeamId <String> [-BodyParameter <Hashtable>]
$params = @{
memberSettings = @{
allowCreateUpdateChannels = $true
}
messagingSettings = @{
allowUserEditMessages = $true
allowUserDeleteMessages = $true
}
funSettings = @{
allowGiphy = $true
giphyContentRating = "strict"
}
}
$teamId = "your-team-id"
Update-MgTeam -TeamId $teamId -BodyParameter $params
This example shows how to update a single team by changing member messaging and fun settings.
$teamIds = @("teamId1", "teamId2", "teamId3")
# Update settings for each team
$params = @{
memberSettings = @{
allowCreateUpdateChannels = $true
}
messagingSettings = @{
allowUserEditMessages = $true
allowUserDeleteMessages = $true
}
funSettings = @{
allowGiphy = $true
giphyContentRating = "strict"
}
}
foreach ($teamId in $teamIds) {
Update-MgTeam -TeamId $teamId -BodyParameter $params
Write-Host "Updated team with ID: $teamId"
}
TeamId,AllowCreateUpdateChannels,AllowUserEditMessages,AllowUserDeleteMessages
team-id-1,true,true,true
team-id-2,false,false,true
To update multiple teams using a CSV file, the following script will read the CSV and apply updates for each team:
$csv = Import-Csv -Path "C:\path\to\teams.csv"
foreach ($team in $csv) {
$params = @{
memberSettings = @{
allowCreateUpdateChannels = [bool]::Parse($team.AllowCreateUpdateChannels)
}
messagingSettings = @{
allowUserEditMessages = [bool]::Parse($team.AllowUserEditMessages)
allowUserDeleteMessages = [bool]::Parse($team.AllowUserDeleteMessages)
}
}
Update-MgTeam -TeamId $team.TeamId -BodyParameter $params
}
This example updates team settings to control whether users can use @team and @channel mentions, which can impact notification noise.
$params = @{
memberSettings = @{
allowTeamMentions = $false
allowChannelMentions = $false
}
}
Update-MgTeam `
-TeamId "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" `
-BodyParameter $params
This example controls what guest users are allowed to do within a Microsoft Team.
$params = @{
guestSettings = @{
allowCreateUpdateChannels = $false
allowDeleteChannels = $false
}
}
Update-MgTeam `
-TeamId "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" `
-BodyParameter $params
Get-MgTeam cmdlet.-BodyParameter to neatly structure your updates and avoid errors.| Error | Cause | Solution |
| Team Not Found | The TeamId provided might be incorrect or the team doesn't exist. | Verify the TeamId by running Get-MgTeam. Ensure that the team is part of your Microsoft 365 organization. |
| Invalid BodyParameter Structure | The hashtable provided in -BodyParameter is incorrectly structured. |
Ensure that you use the correct property names and value formats according to Microsoft Graph API documentation. Validate with a small test team before rolling out to production. |
| Insufficient Permissions | The account running the script doesn’t have sufficient permissions to update the team. | Ensure that your account has the required Teams Administrator role in Microsoft 365. |
The Update-MgTeam cmdlet is an invaluable tool for managing team settings across Microsoft Teams. With its flexibility, administrators can make single or bulk updates efficiently, maintaining control over how teams operate within the organization. By combining it with CSV files, this process becomes even more streamlined, making it an essential tool for Microsoft 365 administration.
© Created and Maintained by LEARNIT WELL SOLUTIONS. All Rights Reserved.