Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Suggested answer

Cannot Update a mail-enabled security groups and or distribution list.

Like (1) ShareShare
ReportReport
Posted on 16 Apr 2025 20:05:20 by 1,546 Super User 2024 Season 1
I have a list of Groups IDs, which include; Security Groups, Mail-Enabled Security group, Distribution lists, Office 365 groups.
 
now i have a user email and the user ID. and i want to remove the user from all the groups:-
 
I tried using Graph API:-
 
 
and using the built-in Remove Member from group:-
 
 
 
but both raised the same error, on distribution lists and mail-enabled groups:-
 
Cannot Update a mail-enabled security groups and or distribution list.
 "error": {
    "code": "Request_BadRequest",
    "message": "Cannot Update a mail-enabled security groups and or distribution list.",
}
 
any advice how to remove those members?
  • w.p Profile Picture
    4,163 on 20 Apr 2025 at 22:58:22
    Cannot Update a mail-enabled security groups and or distribution list.
     
    Sorry, I take it back. After a quick look, it seems PowerShell is your only option, since mail-enabled security groups are managed by Exchange and aren’t exposed in Power Automate.
     
    SharePoint Diary - Salaudeen Rajack
    Office 365: Remove a user from All Security groups using PowerShell
  • Suggested answer
    w.p Profile Picture
    4,163 on 20 Apr 2025 at 22:25:50
    Cannot Update a mail-enabled security groups and or distribution list.
    Maybe you don't need PowerShell; I just tested it with a security group.
    Method: DELETE
    https://graph.microsoft.com/v1.0/groups/{group-id}/members/{user-id}/$ref
     
     
      
  • w.p Profile Picture
    4,163 on 20 Apr 2025 at 20:49:55
    Cannot Update a mail-enabled security groups and or distribution list.
    @johnjohnPter
    I don't have the access, but I came across this topic before.
    You may need to do some research or create another post specifically about it—someone might be able to assist.
     
    Ben Stegink: Getting started with Azure Automation and Power Automate
     
     
    DamoBird365:
    How to Restore a Deleted Power Automate Flow via PowerShell, Power Automate and Power Apps
    Trigger Flow when you log on, run from Windows Batch or PowerShell Script Power Automate
    https://youtu.be/kPbn4WMCXUU
     
    Salaudeen Rajack: Connect to Microsoft Graph with Connect-MgGraph in PowerShell
     
  • johnjohnPter Profile Picture
    1,546 Super User 2024 Season 1 on 20 Apr 2025 at 20:06:02
    Cannot Update a mail-enabled security groups and or distribution list.
     
    I need the service to be called using URL, as inside our service desk we need to call this end-point,, so not sure how i can call power shell script from power automate? is this is possible, then yes i am open to this option,, thanks
     
    Is it possible to remove a member from a security group using power shell? also i am open to use azure function..
  • w.p Profile Picture
    4,163 on 20 Apr 2025 at 01:03:08
    Cannot Update a mail-enabled security groups and or distribution list.
    Just putting the option out here—have you considered using PowerShell or Power Automate Flow through PowerShell?
  • Pstork1 Profile Picture
    66,114 Most Valuable Professional on 17 Apr 2025 at 17:55:45
    Cannot Update a mail-enabled security groups and or distribution list.
    The Azure function would be using the same API so I would assume the limitation would still apply.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,546 Super User 2024 Season 1 on 16 Apr 2025 at 21:54:01
    Cannot Update a mail-enabled security groups and or distribution list.
    @Pstork1 ok thanks for the info. so let say i created an Http azure function, which can be called from power automate, will i be able to do this inside my azure function?
  • Suggested answer
    Pstork1 Profile Picture
    66,114 Most Valuable Professional on 16 Apr 2025 at 20:28:38
    Cannot Update a mail-enabled security groups and or distribution list.
    Check the note in this documentation. Learn about groups, group membership, and access - Microsoft Entra | Microsoft Learn. Distribution Lists and mail enabled security groups can only be managed in Exchange. Currently there is no way to do it from Power Automate or MS Graph.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Using Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 7 Super User 2025 Season 1

#2
vipuljain03 Profile Picture

vipuljain03 4

#3
VictorIvanidze Profile Picture

VictorIvanidze 2

Overall leaderboard

Featured topics

Restore a deleted flow