ALOK
ALOK

Reputation: 1

Sync members of a particular Azure AD group as owners to all other AD groups using PowerShell

I need to sync members of a particular Azure AD group as the owner to all other AD groups using PowerShell. Currently, I understand we cannot add an AD group as the owner to other AD groups. Please help me with a workaround so that I can fetch users from an AD group and add the members of that group as owners of all other AD groups.

Upvotes: 0

Views: 231

Answers (1)

Allen Wu
Allen Wu

Reputation: 16438

This is just a design idea.

Use Get-AzureADGroupMember -ALL 1 to get the list of all members of an Azure AD group: List 1. See Get-AzureADGroupMember.

Use Get-AzureADGroup -ALL 1 to get a list of all Azure AD groups: List 2. See Get-AzureADGroup.

Exclude the particular Azure AD group from List 2: List 3.

Loop through List 1 and List 3: Add the member of List 1 as the owner to member of List 3 by using Add-AzureADGroupOwner -ObjectId {objectId} -RefObjectId {refObjectId}. See Add-AzureADGroupOwner.

Upvotes: 1

Related Questions