Sometimes we need to delete a user from deleted users in Office 365 Admin Portal.

You can do most things using PowerShell, but that’s too much for such a simple task.

Step 1

First things first, we need to register an app in Azure. Go to Azure Active Directory > App Registrations and create a new app. Write down the (Application) Client ID and Directory (tenant) ID.

Go to API permissions and add the following “Application” permissions:


…then click Grant admin consent.

In Certificates & secrets click New client secret and create a new App Secret. Note it down now. Make sure you take note of the Value and not the Secret ID.

Step 2

Create a custom connector in Power Platform and call it Graph AD Directory. Go to Power Automate or Power Apps > Data > Custom Connectors. Give your connector a name and configure base URL as below:

Click next and under the authentication, select OAuth 2.0, select Azure Active Directory under identify provider.

Paste Client ID, Secret and Tenant ID from your notes. Use in Authorization URL and in Resource URL and .default in scope.

Step 3

Create two definitions: ListDeletedItems and PermanentlyDeleteItem.

Create the first definition: Name it as ListDeletedItems and click Import from sample and paste this link:$orderBy=displayName – the orderBy parameter is optional. Paste Accept application/json in headers, and click Import.

Create the second definition: Name it as PermanentlyDeleteItem and click Import from sample and paste this link:{object-id}. Paste Accept application/json in headers, and click Import.

Step 4

Create an app. Go to the Data tab, add a new connection, and search for the custom connector you created in Step 3.

Add a New Blank Screen. Create a button, rename it to btnListDeletedItems and paste the following into the OnSelect property:


Add a new Gallery control, and in Items, enter:


In the Screen OnVisible property, paste:


Inside the galley, you have a few properties to choose from, I selected: ThisItem.displayName, ThisItem.jobTitle and ThisItem.userPrincipalName. I also added a Trash icon and in the OnSelect property, paste the following:


The first action is to delete the current object ID and the second action is to refresh the list of Deleted Items.

That’s it.