0

We have some security groups inside our AD. Some of them are mail enabled the others are not. now we want to add user to those security groups using power automate.

So which action we need to use:

enter image description here

OR

johnjohn123_1-1659733097669.png

EDIT

  • This is the mail enabled security group::

enter image description here

  • This is the security group:

enter image description here

2 Answers 2

1

"Add member to groups" action will only work for Office 365 Group (which are mail enabled)

"Add user to Group" action will work for both the cases i.e. Office 365 Group (Mail enabled) or Normal security Group

So in your case if you have both the scenario then you should use action "Add User to group".

Make sure that "Add user to group" action will except only "GroupId" and "UserId" as input so you will need user additional actions to grab those details based on group name and user principal name.

Official Documentation

Add User to group (Azure AD): https://docs.microsoft.com/en-us/connectors/azuread/#add-user-to-group

Add Member to group(Office 365 Groups) : https://docs.microsoft.com/en-us/connectors/office365groups/#add-member-to-group

Hope it will help to you. Please mark this as answer if it works for you.

4
  • but based on my test, the "Add Member to group" will work in-case the security group is NOT mail enabled, while if it mail enabled security group i will get this error Cannot Update a mail-enabled security groups and or distribution list.
    – John John
    Commented Aug 6, 2022 at 12:51
  • i also tried to add members inside the mail-enabled security group using the Azure Add user to group, and i get the same error
    – John John
    Commented Aug 6, 2022 at 13:22
  • 1
    Can you add screen shot of Security Group if possible so that I can get more idea what kind of group you have? Commented Aug 8, 2022 at 7:26
  • ok updated my question with 2 screen shots
    – John John
    Commented Aug 8, 2022 at 9:14
1

For security groups:

You can use "Add user to Group" action from "Azure AD" connector in Power Automate.

enter image description here

For mail-enabled security groups:

Mail-enabled security groups are owned by Exchange Online. As per my test you cannot add users to these group using Azure AD - "Add user to Group" action or Office 365 groups - "Add member to group" action.

5
  • so what are the options to add members to mail-enabled security groups using cloud flow?
    – John John
    Commented Aug 8, 2022 at 10:34
  • 1
    Unable to find any action for this case in cloud flow. As per the GitHub thread, only way to add users to a mail-enabled security group programmatically requires a PowerShell script. Related: Microsoft documentation. Commented Aug 8, 2022 at 10:40
  • ok thanks, but per my knowledge we can not call powershell script from could flow?
    – John John
    Commented Aug 8, 2022 at 10:49
  • 1
    Yes, no direct (standard) action to run PowerShell. But there are ways to do it using Azure & premium services. Check this and this for reference. Commented Aug 8, 2022 at 10:54
  • Hi @JohnJohn, does this help you in any way? If yes, please Upvote(^) and accept as an Answer as it helped you & it will help others with similar question in future to find the correct answer easily. It also removes this question from "Unanswered questions" list. Commented Sep 2, 2022 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.