web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot Update a mail-e...
Power Automate
Unanswered

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

(1) ShareShare
ReportReport
Posted on by 1,811 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?
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at
    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
     
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
    @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?
  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at
    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
     
  • w.p Profile Picture
    8,339 Super User 2025 Season 2 on at
    Just putting the option out here—have you considered using PowerShell or Power Automate Flow through PowerShell?
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
     
    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
    8,339 Super User 2025 Season 2 on at
    @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
     
  • Suggested answer
    w.p Profile Picture
    8,339 Super User 2025 Season 2 on at
    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
    8,339 Super User 2025 Season 2 on at
     
    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard