[TUTO] – Azure AD: how to purge the Recycle Bin Azure Active Directory

0
3938

We will see together in this tutorial how to purge the Azure Active Directory Recycle Bin before the deadline of 30 days.

We had seen in a previous tutorial how to remove a user from your Azure AD and as we had mentioned, for questions of security, objects are not really totally deleted. There are indeed stored in a recycle bin and are restorable up to 30 days after their deletions.

[TUTO] – Azure AD : How to remove a user in Azure Active Directory

 

First of all, you will need the module MSOL and its Powershell commands to be able to connect to the Azure Active Directory domain and so be able to act on items in this area.

I will probably return to the installation of the module in a next tutorial, in the meantime feel free to follow the documentation from Microsoft here this https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-msonlinev1?view=azureadps-2.0.

 

Start a Powershell console and then enter the following command to connect :

Connect-MsolService

A connection prompt appears and simply use a local account “onmicrosoft.com”, or a verified domain account to connect. Of course, the account must have the necessary rights to connect.

 

It is now time to take the request to purge the entire recycle bin, here’s the order:

Note: It is also possible to target a specific user. In this case, you simply specify the UPN of the user by adding the option -UserPrincipalName “UPN_Utilisateur” after Get-MsolUser.
Get-MsolUser - ReturnDeletedUsers | Remove-MsolUser - RemoveFromRecycleBin - Force

LAISSER UN COMMENTAIRE

Please enter your comment!
Please enter your name here