When managing Microsoft 365 Groups, it’s essential to assign ownership to ensure proper access, lifecycle management, and accountability. The New-MgGroupOwner cmdlet in Microsoft Graph PowerShell makes this task effortless by letting you programmatically assign owners to Microsoft 365 Groups — whether it's one owner, many owners, or importing from a CSV file.
In this blog, we'll explore the New-MgGroupOwner cmdlet with real-world examples and use cases.
New-MgGroupOwner is a cmdlet from the Microsoft Graph PowerShell SDK that lets you add owners to existing Microsoft 365 Groups. Owners are privileged members who can manage group settings, approve join requests, and remove members.
Using New-MgGroupOwner offers many benefits:
New-MgGroupOwner -GroupId <String> -DirectoryObjectId <String> [-Confirm]
$groupId = "12345abc-678d-90ef-ghij-klmnopqrstuv"
$directoryObjectId = "98765zyx-432w-vuts-rqpo-nmlkjihgfedc"
New-MgGroupOwner -GroupId $groupId -DirectoryObjectId $directoryObjectId
$groupId = "12345abc-678d-90ef-ghij-klmnopqrstuv"
$directoryObjectIds = @(
"98765zyx-432w-vuts-rqpo-nmlkjihgfedc",
"abcdef12-3456-7890-abcd-efghijklmnop"
)
foreach ($directoryObjectId in $directoryObjectIds) {
New-MgGroupOwner -GroupId $groupId -DirectoryObjectId $directoryObjectId
}
$groupId = "12345abc-678d-90ef-ghij-klmnopqrstuv"
$directoryObjectId = "98765zyx-432w-vuts-rqpo-nmlkjihgfedc"
New-MgGroupOwner -GroupId $groupId -DirectoryObjectId $directoryObjectId -Confirm
$csvPath = "C:\\path\\to\\your\\file.csv"
$groupOwners = Import-Csv -Path $csvPath
foreach ($owner in $groupOwners) {
New-MgGroupOwner -GroupId $owner.GroupId -DirectoryObjectId $owner.DirectoryObjectId
}
GroupId,DirectoryObjectId
12345abc-678d-90ef-ghij-klmnopqrstuv,98765zyx-432w-vuts-rqpo-nmlkjihgfedc
12345abc-678d-90ef-ghij-klmnopqrstuv,abcdef12-3456-7890-abcd-efghijklmnop
You can use:
Get-MgGroup -Filter "displayName eq 'Group Name'" | Select-Object Id, DisplayName
It’s the Object ID of a user or service principal. Use:
Get-MgUser -UserId user@domain.com | Select-Object Id
Only if they’ve been invited and accepted as guests in your directory. Owners must exist in Azure AD.
Managing Microsoft 365 Groups efficiently means assigning the right owners who can handle administrative tasks. The New-MgGroupOwner cmdlet gives you full control over ownership assignments via scripting — whether you're adding one owner or a hundred.
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