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
$GroupId = "<GroupId>"
$Owners = @("<OwnerId>", "<OwnerId2>", "<OwnerId3>")
foreach ($OwnerId in $Owners) {
New-MgGroupOwner -GroupId $GroupId -DirectoryObjectId $OwnerId
}
New-MgGroupOwner, ensure the user or service principal already exists in Azure AD.Get-MgUser – for usersGet-MgServicePrincipal – for apps or servicesNew-MgGroupOwner, you must use the Directory Object ID of the user or service principal.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