How to Use Update-MgGroup to Update Microsoft 365 Groups?

Managing Microsoft 365 Groups is a crucial part of maintaining organizational structure, access controls, and communication workflows. Whether you're rebranding teams, updating descriptions, or controlling visibility, the Update-MgGroup cmdlet in Microsoft Graph PowerShell makes these tasks quick and efficient.

In this blog, we'll walk you through what Update-MgGroup does, why it's useful, its syntax, real-world usage examples, and frequently asked questions.

What is Update-MgGroup?

Update-MgGroup is a Microsoft Graph PowerShell cmdlet used to modify the properties of Microsoft 365 Groups. This includes attributes such as display name, description, visibility (public/private), mail settings, and more.

Why Use Update-MgGroup?

Here’s why Update-MgGroup is essential for Microsoft 365 administrators:

  • It’s Graph-powered and supports the modern Microsoft 365 API model.
  • You can easily update individual or multiple group attributes.
  • It supports bulk group updates via automation.
  • It's part of the Microsoft.Graph module, replacing legacy Set-UnifiedGroup or Set-AzureADGroup.

Cmdlet Syntax

Update-MgGroup -GroupId <String> [-DisplayName <String>] [-Description <String>] [-MailNickname <String>] [-Visibility <String>] [-SecurityEnabled <Boolean>] [-MailEnabled <Boolean>] [-WhatIf] [-Confirm] 

You can also use the -BodyParameter switch with a hashtable to update multiple properties at once.

Usage Examples

Note:-BodyParameter is not required for simple updates to one or two fields. However, it's recommended for grouped or dynamic updates, especially in loops or bulk scenarios.

Example 1: Update Group Display Name and Description (without -BodyParameter)

Update-MgGroup -GroupId "12345678-90ab-cdef-1234-567890abcdef" ` -DisplayName "New Group Name" `-Description "Updated group description"

Example 2: Change Group Visibility to Private

Update-MgGroup -GroupId "12345678-90ab-cdef-1234-567890abcdef" -Visibility Private

Example 3: Enable or Disable a Group's Mail and Security Settings

Update-MgGroup -GroupId "12345678-90ab-cdef-1234-567890abcdef" `-MailEnabled $true `-SecurityEnabled $false

Example 4: Bulk Group Update (Using CSV Input)

Let’s say you want to update the descriptions and visibility of multiple groups.

Sample CSV (groups.csv):

GroupId,DisplayName,Description,Visibility
11111111-1111-1111-1111-111111111111,Team Alpha,Core dev team,Private
22222222-2222-2222-2222-222222222222,Marketing Hub,Campaigns and Outreach,Public
                                        

Script:

# Import CSV file

$groups = Import-Csv -Path "C:\Path\To\groups.csv"

# Loop through and update each group
foreach ($group in $groups) {
    try {
        $params = @{
        DisplayName = $group.DisplayName
        Description = $group.Description
        Visibility  = $group.Visibility
    }
                                                
    Update-MgGroup -GroupId $group.GroupId -BodyParameter $params
                                                
    Write-Host "Updated group: $($group.DisplayName)"
    }
    catch {
        Write-Host "Failed to update group: $($group.DisplayName). Error: $_"
    }
}
                                            

Frequently Asked Questions

  • Do I need -BodyParameter for every update?
    Not always. You can directly pass parameters like -DisplayName or -Visibility. -BodyParameter is best when updating several properties together.
  • Can I change the group's email address (MailNickname)?
    Yes, but be cautious—changing the mail nickname can affect the group’s mail routing and alias.
  • What permissions are needed?
    You’ll need Group.ReadWrite.All delegated or application permissions.
  • Does it work for both Microsoft 365 Groups and Security Groups?
    Yes, Update-MgGroup works on both types, but some properties may be applicable only to Microsoft 365 groups.

Use Cases

  • Department Rebranding: Update group names, mail nicknames, and descriptions.
  • Security Hardening: Change group visibility from public to private.
  • Automation: Perform bulk updates across all Microsoft 365 groups from HR/IT data sources.
  • Mail-Only Groups: Enable or disable MailEnabled settings dynamically.

Conclusion

The Update-MgGroup cmdlet is a powerful, flexible way to manage and maintain Microsoft 365 Groups using Graph PowerShell. Whether you’re making small tweaks or automating large updates, this cmdlet helps keep your environment clean, secure, and up to date.

Take advantage of Microsoft Graph’s power and future-proof your group management workflows—start with Update-MgGroup today!

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex