Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community

Move AAD user to Selected group throup powershell

Copper Contributor

Hi All,

 

I have to move AAD users into selected security group in AzureActiveDirectory through PowerShell.

 

However am able to connect AZUREAD through powershell, but am not able to get my users list and Group name.

 

Please give me your valuable suggestions.

How we can move users to a group in AAD using Powershell.

 

regards,

Anil

1 Reply

I think you asked the same question on the Azure AD forums over at MSDN, no? Did you check my reply there? To do the same task via PowerShell, you can use the following cmdlets:

 

Get-MsolUser to list the users in question and get the ID

Get-MsolGroup to get the Group ID

Add-MsolGroupMember to add the users

 

For example, once you have the Group ID and the user ID, you can use:

 

Add-MsolGroupMember -GroupObjectId a1813eff-a80b-4ac9-bbdc-8e0821b76809 -GroupMemberObjectId 93e15856-895f-43a8-9d60-23b343c26dae

 

As you can see, the cmdlets are not very user friendly, so you might want to stick to the UI.