Microsoft 365 provides multiple features and services for managing working data as well as for retaining them as needed. It is critical for you as an IT administrator to understand the features available for ensuring that deleted data can be restored and that you can import other data and use Microsoft 365 as an archive.
This course will focus on how to manage archival, deletion, and restoration of content and data within Microsoft 365. By the end of this course, you will know the various options available for that and when to use the Admin Center or PowerShell to restore data and content. We will also discuss some of the important aspects of working with deleted data.
Learning Objectives
- Identify content for recovery
- Ensure your end-users have the data they need
- Recover data in Microsoft 365
- Archive data in Microsoft 365
Intended Audience
This course is intended for people who want to become a Microsoft 365 Certified: Security Administrator Associate.
Prerequisites
If you wish to follow along with this course, it is recommended that you have a Microsoft 365 tenant, an account with Global Administrator access, as well as content within SharePoint Online and OneDrive for Business, a few Exchange Online mailboxes, and users in Azure Active Directory.
So, let's talk about using inactive mailboxes and litigation holds. When an employee leaves the organization, you obviously can remove their Microsoft 365 account. The employees mailbox data is then retained for 30 days, normally. During this period, you can recover the mailbox data by undeleting the account. However, after 30 days, the data is then permanently removed. Microsoft 365 added support for inactive mailboxes within Microsoft exchange online to extend that recovery period, and organizations can retain the mailbox for regulatory compliance with this feature.
Inactive mailboxes are enabled once you apply a hold to a mailbox. The best practice approach to applying a hold is to use Microsoft retention policies or retention labels. Once the retention policy or label is applied, you can then remove the user account, which will then convert the mailbox into an inactive mailbox. To make a mailbox inactive, the user must be assigned an Exchange Online Plan 2 license or have the Exchange Online Archiving add-on associated to them. Once the retention policy or label is applied and the hold is enabled, you can simply delete the user account. The license will then be freed up for other use, and the mailbox will display as inactive.
If you no longer need to retain the contents of inactive mailbox, you can permanently delete the inactive mailbox by removing the hold applied to the inactive mailbox. The mailbox will be retained for 183 days after you remove the hold or retention policy and be recoverable during that time. After 183 days, the mailbox will be marked for a permanent deletion, and the mailbox will become nonrecoverable. So, let's go into our environment, and we'll first look at how we enable an Inactive Mailbox using the Compliance Center. And then we'll look at how we restore the Inactive Mailbox content into another mailbox.
So, here we are, back in the admin center. The first thing we'll do is scroll down here on the left to the compliance center. This all launched separately in a different tab. Once we get to the compliance center, then we're going to navigate into retention option, or at least inside what's referred to as the information governance option here. So I'm going to click here 'Information governance'. Once that loads, then we can click onto 'Retention policies', and you'll see that we have a list of retention policies now. I've already pre-created one just purely based on the fact that it takes about 24 hours for these things to be enabled in your environment.
So, I'm going to click on 'Create Inactive Mailboxes', and you can see this is a very simple one. It's just focused on exchange email, and it keeps content for 10 days. So, let me just edit this. So, this is the process that you'll go through to create the retention policy. So, I've called it, Create Inactive Mailboxes. Choose 'Next'. I've chose a 'Static' scope instead of Adaptive, which means I'm choosing the location it needs to be associated to. I chose 'Next', and then I went into just 'Exchange'. I unchecked all the other options, clicked 'Edit', and then I selected the specific accounts that I wanted to put as Inactive Mailboxes. So this is Christy and Joanna. Once I've added those two accounts, I made sure that it was just targeted to them. Choose 'Next'.
I then went through and set my 'Custom' settings to restore for 10 days, and I'm not going to delete anything, but if you're creating this as part of a production environment, then you'll obviously need to go through and determine what you want to do as part of a disposition goes. Choose 'Next' and then click 'Submit' and save. Now I'm going to cancel it because I've already saved my home. Now that needs to wait at least a day in order for that to be available. Now, of course, the next steps after this to convert something to an Inactive Mailbox is to wait for this to be applied.
Once it's been applied, then we can go back to our admin center, scroll to our list of users, identify those users. So, if we go into Joanna for example, you'll see that Joanna has already gone because I already deleted her. But if I go to the other account, which is Christie, I can say 'Delete User'. I'm going to go wait for the delete option; it does a check against the licensing and a few other things. Click 'Delete User', and what this will do is delete the user from Azure active directory, and then a process kicks off. It's not immediate, but it will then convert that to a inactive mailbox. So, if I click 'Deleted Users', for example, you can see that I've got my Christie and Joanna available here.
Now let's say we have waited for the process to complete. I can now come back to my 'Retention policies', and you'll see we have an option called 'Inactive Mailbox'. If I click into this option, just 'Refresh', you can see that Joanna has been listed in there because I met all the criteria. I associated retention policy that has been applied to the mailbox, and then I deleted the corresponding account. Now what will happen is the process will run, and shortly Christie's account will show up in here as well.
The key to this is that everything takes a little bit of time to actually function. So, let's say that we've got this mailbox. We've got Joanna's one here, and we realized that we'd like to restore the information that's in that mailbox back into a new mailbox or some mailbox that at least exists in the exchange platform. So, let's go back to our PowerShell, which is what we're going to utilize because if we notice here I can click into the mailbox, but I have no way of restoring that. And so, that comes by using PowerShell. So, let's go back to PowerShell screen.
So, back in PowerShell, the first thing I'm going to do is create a variable. I'll call it inactivemailbox, and then we'll say, Get-Mailbox. And then, of course, we've got a property called InactiveMailboxOnly, and I don't need to specify the identity because I only really have one inactive mailbox. But if we had multiple inactive mailboxes, which we do know because Christie is now shown up, I would need to know the unique identifier. So, let's go back and pick Joanna here, get the same query and we'll say, Identity. I'll just put Joanna in there, and then say $inactivemailbox. And now I've selected Joanna. So, let me just clear that. So, I have my inactive mailbox.
Now in order for us to restore, we obviously need a source, which would be the inactive mailbox, and then we also need a mailbox that we're going to go into. So, let me flick back to my admin center and we'll just double check our mailboxes. So, here we are, back in the admin center. Let me go to here at 'Active Users'. We'll look at our list of users that we have. And let's say we want to use Adele, so I know that it's AdeleV. Okay, so, we can inject all of the contents of the inactive mailbox directly into Adele's mailbox instead. So, let's go back to our PowerShell screen now.
Okay, so, the first thing we have to do is we have to get some specific information from there, and the first one is going to be this legacy exchange link. So, this is effectively the X500 proxy address that was associated to the specific mailbox that was inactive. And we'll need that because we actually need to add that to whatever the mailbox that we're adding it to needs to be. So, first off, let's just do get, I'll tell you what, let's create a variable here. Let's call it targetmailbox, and we'll say, Get-Mailbox -Identity. And then, of course, we're not going to use Joanna. We're going to use AdeleV like so. So, let's just make sure we have that; target mailbox. Yes, we do.
So, what we have to do now is add that specific LegacyDN to the existing mailbox. So I'm going to say Set-Mailbox like so and then the identity that I've got I can say targetmailbox and I could say UserPrincipalName and then going to say email addresses. And then we're going to put some kind of key value pair type options in here. We're going to basically add that value. So let me go into here and say, Add = And then from here I can say X500, and I can then go through and add that il.mailboxLegacyExchangeDN il.mailboxLegacyExchangeDN like so. So, that should give us a value that we're looking for. And then I can press 'Enter' here, and this will take that inactive mailbox LegacyExchangeDN and associate that to the mailbox.
So, what I can now do is if we just go back to targetmailbox and say, Get, and then just say, targetmailbox | FL, what we should be able to do is scroll through here. I'll tell you what we'll do. Instead of doing the list, we'll say EmailAddresses and you'll say let me, the easiest one here is to just expand that property. You'll see that we've now got Adele SMTP and X500 is the Joanna account, which was the LegacyDN that was there beforehand. So, we have that value. Now, notice what happened if I take this LegacyExchangeDN, you'll see that its just typed LegacyExchangeDN, not the actual value.
So, to resolve this issue, what we'll need to do is actually add in the correct value instead. So, this is just a PowerShell update that we need to make. We'll obviously need to remove a specific email address, instead of it saying LegacyExchangeDN we need it to actually have, if we go inactive LegacyExchangeDN, it needs to have this entire value associated to it, not the word LegacyExchange. So, let's clear the screen. And we'll loop back through our set of values and this option here we can simply change that to, say, Remove like so. So, then remove that specific value instead. So, what we should then be able to do is go back and retrieve that target mailbox again.
So, we'll just do that. We'll say targetmailbox, Select -Expand. Let's do expand on here, -ExpandProperty, and EmailAddresses. And then you should see that one's gone. So, let's go back through and get that specific value we're looking for. So, I'm going to go and manually copy this. So, I have the exact string value that we're looking for. And then when we go back to remove or add, I'm going to remove this dynamic, and paste it in like so, and then I'm going to press 'Enter'.
Okay, so, this should now have updated. So, I should be able to say select and actually go back and repopulate that. There we go. And sure enough, it now has X500 Joanna. So, that was our first task was making sure that we have the right values associated for restoring. At this point, what we're able to do is to simply issue a New-MailboxRestoreRequest, a source mailbox that we're trying to get to. If I go here, SourceMailbox will be inactivemailbox, and we'll use the distinguished name so we know what it is.
All we need is to specify the target mailbox itself, which in our scenario is going to be targetmailbox, and we'll just use UserPrincipalName to get that one. And then, of course, we can specify the target root folder that we want to put things into. So, TargetRootFolder, and I'm going to call it Inactive Mailbox. So, that means we can kick-off the restore, specify the existing mailbox that's there in the archive or the inactive, I should say, and then we can move it into the new one. So, let's just execute this. This will now go ahead and take the mail from the inactive mailbox and copy all of that into a new root folder called Inactive Mailbox into Adele's. And our last step here now our last step here once it's all finished, now bear in mind, you can see the status is queued. We have to wait for that to finish. But once it's done, you can then go ahead and remove that LegacyDN from the mailbox itself.
Liam Cleary is a Microsoft MVP and Microsoft Certified Trainer focused on Microsoft 365 and Azure. He's been working with Microsoft Cloud and Azure technologies since their creation and focuses heavily on deployments, management, and the security of Microsoft 365 and Azure. He also holds multiple certifications for both Microsoft 365 and Azure.