Hello ,
I was wondering if there is way to automate the delete process of a user from the 365 environment using power Automate.
What our process is when someone leaves the company is to block sign in / remove him from all groups but keep the account active for 60 days and then delete that account . I was wondering if there is a way we can automate this using Power Automate. Any help I would truly appreciate. Thank you.
@Thanasis One way to delete a user from a Microsoft List using Power Automate is to create a flow asking for user input (ask for the employee's first and last name) and store that in a variable. Then, automate opening web browser tabs to the desired list URL where you can search the name (via the variable defined earlier in the flow), and if that name is found, have the flow use the UI to delete them from that list.
This can be repeated if you have multiple lists that you want to remove somebody from.
Initially while posting a comment here, I had no idea on how to fill up those fields, but after exploring a lot found the way to fill it up and got fed up as I keep getting the error whatever I try- either invalid or insufficient privileges, while I am the global admin as I am using my test tenant account.
@Sara16 you will need to configure those yourself. This is a good link describing how to How To Setup MS Graph API Authentication For Power Automate (zeitgeistcode.com). Hope that helps. I usually put the ClientID, Secret, and Tenant in Variables at the beginning of the flow so that it's easy to maintain.
@shavora Can you please provide the whole screenshot to know what values to be passed for the remaining fields of this 'HTTP'??
@Thanasis I am not sure you need to create a Sharpoint list for the functionality to work like you want. I am not sure why it's necessary. You can assign a user a security group with no permissions in Office 364 as well as assign them to an Azure ad group with no license attached. Those two things you can do from power automate. With or without a sharepoint list, that's possible, but a Sharepoint list can make it easier to track it, assign status start and end and be able to delete them from those criteria.
With this function you can disable an azure user:
@Thanasis Can you create an AD group with no rights to place them in? This you can do from power automate. You can also disable Azure users from power automate. Not sure these ideas meet your reqiurements though. I misread that t wasn't deleting you needed.
@shavora That is great. Can I ask one more thing. What do I need to do if I want to disable and not delete ?
@Thanasis If you mean the Azure user/license, you can delete a user with HTTP with calling graph.microsoft.com
Though you will need to:
stampcoin
87
Michael E. Gernaey
70
Super User 2025 Season 1
David_MA
48
Super User 2025 Season 1