Skip to content

Restore Exchange Online user mailbox | Cloud only (Fully Hosted) environment | Article 3#3 | Part 10#23

In the current article, we review the second option for restoring Soft Deleted Exchange Online mailbox. In this scenario, we “Instantiate” the restore process by using a PowerShell command (Undo-SoftDeletedMailbox), that will restore the Soft Deleted Exchange Online mailbox, and also, create a NEW Office 365 user account that will associated with the recovered Exchange mailbox.

In this method, we directly restore the Soft Deleted Exchange Online mailbox vs. the conventional way, in which we restore the Office 365 user account that considers the owner of the deleted Exchange Online mailbox (this method was reviewed in the previous article).

The use of the PowerShell command Undo-SoftDeletedMailbox

The PowerShell command that we use for restoring the Soft Deleted Exchange Online mailbox is Undo-SoftDeletedMailbox

We can use the PowerShell command Undo-SoftDeletedMailbox for two types of restoring scenarios:

Scenario 1#2 – restore the Soft Deleted Exchange Online + Create a NEW Office 365 user account.

Scenario 2#2 – restore the Soft Deleted Exchange Online, and connect the recovered Exchange mailbox to the original user account that considers as the mailbox owner.

The option that seems associatively the preferred option is – restoring the Exchange Online mailbox + restore the original Office 365 user account that associated with the mailbox.

As mentioned in a previous article, this restore option, is not implemented properly in an Office 365 based environment. Maybe in the future, the “issue” will be fixed.

At the current time, my recommendation is to use the second option (Scenario 2#2) in which we use the Undo-SoftDeletedMailbox PowerShell command for:

  1. Recover the soft deleted Exchange Online mailbox.
  2. Creating a NEW Office 365 user account + Password.
  3. “Binding” the NEW Office 365 user account to the restored Exchange Online mailbox.

Restoring Exchange Online User mailbox – the flow of events

Before we start with the step by step instructions, a brief review of the “Restore process flow” in Office 365 and Exchange Online base environment.

When we restore a Soft Deleted Exchange mailbox, the following chain of events implemented:

Exchange Online infrastructure

  • Step 1#4 – Restoring the Exchange Online User mailbox. The status of the recovered Exchange Online mailbox is updated from – Soft Deleted mailbox to – “Active.”
  • Step 2#4 – Exchange Online synchronizes the “updated information” to Azure Active Directory infrastructure.

Azure Active Directory infrastructure

  • Step 3#4 – Azure Active Directory get the information about the change in the Exchange Online mailbox status (the fact the that Exchange Online mailbox was recovered).
  • Step 4#4 – Azure Active Directory creates a NEW user account and “bind” the user account to the Exchange Online User mailbox.
Restoring the Exchange Online USER mailbox - Chain of events

Directly restore the Soft deleted Exchange Online mailbox by using the PowerShell command Undo-SoftDeletedMailbox

The PowerShell command implements the restore process of Soft Deleted Exchange Online mailbox in Office 365 based environments Undo-SoftDeletedMailbox

The PowerShell command Undo-SoftDeletedMailbox logic and characters

Undo-SoftDeletedMailbox for restoring Soft Deleted Exchange Online mailbox, I would like to briefly review the syntax and the logic of the Undo-SoftDeletedMailbox command.

In our scenario, we use the PowerShell command Undo-SoftDeletedMailbox for executing two tasks:

  1. Restoring the Soft deleted Exchange Online mailbox.
  2. Creating a NEW Azure Active Directory user account.

For this reason, the PowerShell parameters that we need to provide, relate to the name of the Soft Deleted Exchange Online mailbox that we want to restore + the parameters that relate to the NEW Azure Active Directory user account that will create.

In the following diagram, we can see the “two parts” of the Undo-SoftDeletedMailbox PowerShell command.

In the first part, we specify the name of the Exchange Online Soft Deleted mailbox that we want to restore (number 1).

In the second part, we need to provide information that will use for creating the NEW Azure Active Directory user account.

The parameter – WindowsLiveID, will use for the UPN (Principal User Name) of the new Azure Active Directory user account + as the primary E-mail address (number 2). Besides, each Azure Active Directory user account should have a password.

For this reason, the second Azure Active Directory parameter that we need to provide is the user password.

The syntax of the Undo-SoftDeletedMailbox PowerShell command

An example of the PowerShell syntax is:

Undo-SoftDeletedMailbox <Mailbox> -WindowsLiveID <Office 365 user UPN> -Password <Password> (ConvertTo-SecureString -String <‘password‘> -AsPlainText -Force)

Note: The ability restores the Soft Deleted Exchange Online mailbox by using the PowerShell command Undo-SoftDeletedMailbox is based preliminary step, in which we need to connect Exchange Online using remote PowerShell.

In case that you need instructions how to create a Remote PowerShell session to Exchange Online, you can read the article – Connect to Exchange Online PowerShell

Restoring a Soft Deleted Exchange Online User mailbox by using the PowerShell command – Undo-SoftDeletedMailbox

In our scenario, we will restore a Soft Deleted Exchange Online mailbox that was associated with Office 365 user named- Brad.

The PowerShell command syntax that we use in our scenario is:

Undo-SoftDeletedMailbox Shared-MB02@o365info.com -WindowsLiveID
Shared-MB02@o365info.com -Password (ConvertTo-SecureString -String ‘Asd#4R12’ -AsPlainText -Force)

In the following screenshot, we can see that the Exchange Online mailbox restore process successfully completed.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -01

Using the Verbose PowerShell parameter

I have added to the PowerShell restore mailbox command, the parameter Verbose. Using the Verbose parameter, enable us to get additional information about what happens behind the scenes.

In our example, the additional information that we get from using the Verbose parameter:

VERBOSE: Creating mailbox “Bradp” with User Principal Name “Bradp@o365info.com” in organizational unit “EURPR05A001.prod.outlook.com/Microsoft Exchange Hosted Organizations/o365info2.onmicrosoft.com”.

Verify that the Exchange Online User mailbox restore process successfully completed

In case that the restore process successfully completed, the following objects should be restored:

  1. The mailbox – Brad, should appear in the Exchange Online Admin center, under the section
    of recipients \ resources.
  2. The user Brad should appear in the Azure Active Directory Admin Center, under the section of Active users.

Active Directory admin center – Active users

In the following screenshot, we can see that user “Brad,” was successfully restored.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -01

It’s important to emphasize that the “original owner” of the recovered Exchange mailbox (the Office 365 user account that was soft deleted) of the Room Mailbox, was not restored!

When we look in the Azure Active Directory – Deleted users section, we can see that the older user account – Brad, still exists.

This user account will automatically be deleted at the end of the 30-day period.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -02

The properties of the NEW user account

The important thing that I would like to emphasize is that the “Office 365 user account” is a NEW user account that doesn’t have any relationship to the “original user account” that deleted. For this none of the properties of the previous user account will not be restored.

In the following screenshot, we can see that the NEW user account doesn’t have Office 365 license.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -03

Also, the user account “details” are empty because this is a NEW user account.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -04

2.1 – Assign Office 365 license to the new user account

To be able to “activates” the NEW user account that created, we will need to assign Office 365 license.

In our example, we select the properties of the “NEW Brad Office 365 user account” and assign the required license (E3 in our example).

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -05

In the following screenshot, we can see that the required license was assigned.

Restore the Soft deleted Exchange Online user mailbox using PowerShell - Undo-SoftDeletedMailbox -06

Verifying if the Soft Deleted mailbox was successfully restored

Exchange Online admin center – recipients / resources

We start the verification process of the restored Bob mailbox, by “visiting” the Exchange Online recycle bin.

Using the Exchange Online admin center

We will look at the Exchange Online recycle bin content by using the Exchange admin center.

The another option that we can use for viewing the content of the Exchange recycle bin is – by using the “Deleted mailboxes” menu in the Exchange Online admin center.

To be able to view the list of Soft Deleted mailboxes, use the following steps:

  • Login to Exchange Online admin page
  • On the left menu bar, select the menu – recipients
  • On the top menu bar, choose the menu – mailboxes
  • Click on the three dots icon
  • Choose the menu – Deleted mailboxes
Verifying Exchange mailbox successfully restored - PowerShell - Undo-SoftDeletedMailbox-01

In the following screenshot, we can see that “Brad Soft Deleted mailbox” doesn’t appear anymore in the Exchange Online recycle bin.

Verifying Exchange mailbox successfully restored - PowerShell - Undo-SoftDeletedMailbox-02

3.3 – Looking at the active Exchange Online mailbox list

To be able to verify if Bob’s mailbox was successfully restored, we will use the Exchange Online admin center.

In the following screenshot, we can see that Bob’s mailbox successfully restored, and now it appears in the standard (active) mailbox list.

Verifying Exchange mailbox successfully restored - PowerShell - Undo-SoftDeletedMailbox-01

3.4 – Verify that the mailbox permissions were successfully restored

In this section, we would like to verify if the mailbox permissions, that were assigned to the Bob mailbox before the deletion of his mailbox deleted .

A quick reminder, before Bob’s mailbox, was deleted, Brad had Full access permissions on Bob’s mailbox.

In the following screenshot, we can see that we look at “Bob restore mailbox” properties, using the mailbox delegation menu; we can see that Brad had Full access permissions on Bob’s mailbox. The meaning is that the mailbox permissions successfully restored.

Verifying permissions Exchange mailbox restored mailbox - Undo-SoftDeletedMailbox-02

The next article in the current article series

The special characters of Directory synchronization in an Office 365 environment | Article 1#2 | Part 11#23

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *