다음을 통해 공유


Azure Troubleshooting: How to Restore Deleted Objects


Introduction

We are all familiar with AD restore and Recycle Bin functionalities.  Azure also has a recycle bin.  When you delete an object, that object is not permanently deleted. By default, that object will be in a recycle bin for 30 days. 

The output of Get-MsolUser -ReturnDeletedUsers PowerShell cmdlet will provide all the objects from Recycle Bin.  Once you have this information, you can either restore an individual object or restore all object using Restore-MsolUser PowerShell cmdlet. 

The following section provides step-by-step instruction of restoring an object from Azure Recycle Bin:

  1. Open PowerShell window

  2. Import Azure Active Directory Module for Windows PowerShell

  3. Import MSOnline module

  4. Logging into your Azure Tenant using Connect-MsolService cmdlet

       

  5. Run Get-MsolUser -ReturnDeletedUsers to display all the objects in Recycle Bin

     

  6. Based on the object result, we have 5 objects in the Recycle Bin. 

  7. You can use Restore-MsolUser -UserPricipleName .,UPN> cmdlet to restore an individual object as shown below:

  8. Or you can restore all objects from Recycle Bin using Get-MsolUser -ReturnDeletedUsers | Restore-MsolUser cmdlet.

PowerShell cmdlet reference

  1. Get-MsolUser :  https://msdn.microsoft.com/en-us/library/azure/dn194109(v=azure.98).aspx
  2. Restore-MsolUser : https://msdn.microsoft.com/en-us/library/azure/dn194109(v=azure.98).aspx