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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Office 365 group - rem...
Power Automate
Unanswered

Office 365 group - remove disabled users

(0) ShareShare
ReportReport
Posted on by 151

With the current set of connectors, I am able to build a flow that can list groups where I am the owner, list their members, and remove disabled user accounts from the group. If you would like to see such a flow, let me know. 

But, what I am missing is to list all Office 365 groups in the tenant and do the same as above using a service account with a "Groups administrator" role assigned in AzureAD. 

I have looked at LogicApp but the set of connectors for this purpose is quite similar. 

Can you give me a tip on how to list all Office 365 groups without being an owner of those?

 

Thx in advance

Mike

Categories:
  • Ellis Karim Profile Picture
    12,377 Super User 2026 Season 2 on at

    I've been able to follow the blog post below and list all AAD Groups:

    2021-12-22_23-25-20.png

    I managed to create a demo flow, based on a previous template I had, that lists all groups in my organisation:

    2021-12-22_23-29-50.png

     

    2021-12-23_00-36-18.png

    The API can only return a maximum of 999 items. There may be a way to get more results, but my AAD has less than 999 groups. See: Handling Pagination with the MS Graph API in Logic Apps and Power Automate

    if you need to get more than 999 items - but this is not something I have yet had to implement.

    2021-12-22_23-30-43.png

    I'm using  Azure Key Vault to keep API keys and other secrets secure. For testing you will need to paste in the secret for the HTTP action.

     

    The TenantID

    https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview

    2021-12-22_23-49-29.png

    Client ID (Application ID):

    2021-12-22_23-44-24.png

    Hope this helps.


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Michal Z. Profile Picture
    151 on at

    Thank you @ekarim2020 for a very detailed response. 

    This looks like a way to go. 

    I can see that using Graph API I can list groups (https://graph.microsoft.com/v1.0/groups?$filter/groupTypes eq 'unified'), list their owners and members, and even remove members.

    This way all I need from PowerAutomate or Logic App is to check if the user/member is enabled or not using Get user profile (V2) from Office 365 Users connector. And even the last part can be replaced with Graph API. 

  • Ellis Karim Profile Picture
    12,377 Super User 2026 Season 2 on at

    I prefer to use the available connectors and actions where possible. If these can't do what I need or it's going to be a lot more work and complexity that can be avoided, I'll look at using Graph API calls.

     

    There is also the following Office 365 Groups action:

    2021-12-24_09-59-02.png

    This returns a maximum of 100 items.  Using a graph API call with HTTP action has so far provided what I need.

     

    Ellis

  • metrognome Profile Picture
    61 on at

    I am actually on the lookout for a flow that will run a check on the members' mailtips and highlight those that are disabled for me ot remove/delete. 

    IF you have anything like this, would be interested to read.

  • Ellis Karim Profile Picture
    12,377 Super User 2026 Season 2 on at

    Sorry, I didn't understand sentence about mailtips:


    @metrognome wrote:

    I am actually on the lookout for a flow that will run a check on the members' mailtips and highlight those that are disabled for me ot remove/delete. 

    IF you have anything like this, would be interested to read.


    Ellis

  • Ellis Karim Profile Picture
    12,377 Super User 2026 Season 2 on at

    Sorry, I didn't understand sentence about mailtips:


    @metrognome wrote:

    I am actually on the lookout for a flow that will run a check on the members' mailtips and highlight those that are disabled for me ot remove/delete. 

    IF you have anything like this, would be interested to read.


    Ellis

  • metrognome Profile Picture
    61 on at

    Mailtips is basically one option of the Outlook/O365 connector and basically mailtip returns either the out of office of a user or a warning that the mailbox is no longer operational (discontinued, deleted or full).

    It is a "quick and dirty" shortcut to check for an accounts's status and (especially in flows) bypass people when their out of office is active.

  • Ellis Karim Profile Picture
    12,377 Super User 2026 Season 2 on at

    See if the following post helps:

    Determine users out of office status based on mailtips - Automatic Replies on or not

    https://powerusers.microsoft.com/t5/Building-Flows/Determine-users-out-of-office-status-based-on-mailtips-Automatic/m-p/599256/highlight/true#M79112

     

    And the following extract from a flow:

    Snag_160684f.png

     

    Also, the Search for users can return the account enabled status for each account:

    Snag_1632f4e.png

    Ellis

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard