There is a requirement to add and remove User to/from Azure AD group of Type Microsoft 365 using Power Apps.
There are below steps:
- Gallery (galGroupMembers) to display the list of existing Users in a selected AD Group
- Create People Picker (cmbUser) to search User
- Button (btnAddUser) to Add user to AD Group
- Button (btnRemoveUser) to Remove User
Gallery to display list of users
You will get Group ID from Azure Group properies. Write below code in Items property of galGroupMembers Gallery. You can then use ThisItem.displayName and ThisItem.mail as text properties of Labels to display User Name and User Mail in the gallery.
People Picker to search a User
Use a ComboBox cmbUser and write below in Items Property. Write [“DisplayName”,”Mail”] in SearchFields and [“DisplayName”,”Mail”] in DisplayFields properties of Combobox
Add User to AD Group
Add below on OnSelect property of btnAddUser Button
Remove User from AD Group
Add below on OnSelect property of btnRemoveUser Button. Please Note only Group Owners can remove a user from the Group.