Hello Everyone
Hope everyone doing good. Today we are going to see, how to copy Members from one Azure AD Groups to Another Azure AD Groups using simple powershell command. As a 0365 admin, we may face this kind of situation any time. I believe this post would be helpful
We must call the Connect-AzureAD, cmdlet before running the below commands from windows powershell
Get-AzureADGroupMember and Add-AzureADGroupMember - is the powershell command to full fill the kind of request comes from business
first collect the Object ID from source and Target groups. To collect the Object we can use Entra Portal [GUI]
https://entra.microsoft.com/
Home- Groups | All groups
Select the Source group and Target groups and check in the properties to find out the object ID
In my case , The below are the source group and target group - Object ID
Source Object ID : 9c24a6d1-3be9-429f-af20-79dc38093970
Target Object ID : 839e1b56-8be5-4dc6-8cce-4e6acad3379f
command
Get-AzureADGroupMember -ObjectID 9c24a6d1-3be9-429f-af20-79dc38093970 -All $true) | ForEach-Object {Add-AzureADGroupMember -ObjectId 839e1b56-8be5-4dc6-8cce-4e6acad3379f -RefObjectId $_.ObjectID}
ObjectId DisplayName UserPrincipalName UerType
-------- ----------- ----------------- --------
ff72d6db-ccdc-42dd-940e-52b1245da9b6 craft user2 craft2@craftnet.in Member
212ee3f1-cdc6-4e9d-ac3d-8dd9a185e319 Venkataprakash venkataprakash#gmail.@2t6xvv.onmicrosoft.com Guest
=========================================================================
I believe, you learned something useful and enjoyed. Happy Learning 😃
Comments
Post a Comment