Sameer Shahul
Sameer Shahul

Reputation: 21

Unable to add a group as a owner to another group in Azure AD

We want to add admin group as a owner to all other groups. When we tried to add via powershell command we got below error

'Group' is invalid for the 'owners' reference

Upvotes: 1

Views: 2587

Answers (1)

Allen Wu
Allen Wu

Reputation: 16458

It's not support to add a group as a owner to all other groups currently.

You could use Get-AzureADGroupMember to get a list of the group member and then foreach them to add all the members as owners of other groups.

An example:

$adgms = Get-AzureADGroupMember -ObjectId "{objectId of the admin group}" -All $true
foreach($adgm in $adgms){
    Add-AzureADGroupOwner -ObjectId "{objectId of the target group}" -RefObjectId $adgm.ObjectId
}

Upvotes: 3

Related Questions