Create a retention policy for Exchange Online

To proactively retain or delete mailbox content for data lifecycle management in Microsoft 365, we recommend that you use Microsoft 365 retention policies and retention labels from the Microsoft Purview compliance portal, instead of messaging records management that's described on this page. However, you should continue using messaging records management to move messages to archive mailboxes.

If you currently use messaging records management (MRM), this older feature will continue to work side-by-side with Microsoft 365 retention policies and retention labels. However, we recommend that going forward, you use Microsoft 365 retention policies and retention labels instead. They provide you with a single mechanism to centrally manage both retention and deletion of content across Microsoft 365.

In Exchange Online, you can use messaging records management (MRM) retention policies to manage email lifecycle. Retention policies are applied by creating retention tags, adding them to a retention policy, and applying the policy to mailbox users.

For additional management tasks related to retention policies, see Messaging Records Management Procedures.

What do you need to know before you begin?

Step 1: Create a retention tag

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Feature permissions in Exchange Online topic.

Use the Purview compliance portal to create a retention tag

  1. Sign in to the Microsoft Purview compliance portal and navigate to Solutions >Data lifecycle management >Exchange (legacy) >MRM Retention tags, and then select + New tag.
  2. On the Define how the tag will be applied page, select one of the following options, and then select Next:
  3. On the Define retention settings page title and options will vary depending on the type of tag you selected. Complete the following fields, and then select Next:

Important While mailboxes or items are subject to holds such as Microsoft 365 retention policies or retention labels, or litigation hold, they won't be permanently deleted and will continue to be returned in eDiscovery searches.

Use Exchange Online PowerShell to create a retention tag

Use the New-RetentionPolicyTag cmdlet to create a retention tag. Different options available in the cmdlet allow you to create different types of retention tags. Use the Type parameter to create a DPT (value of All), RPT (specify a default folder type, such as Inbox) or a personal tag (value of Personal).

The following example creates a DPT to delete all messages in the mailbox after 7 years (2,556 days):

New-RetentionPolicyTag -Name "DPT-Corp-Delete" -Type All -AgeLimitForRetention 2556 -RetentionAction DeleteAndAllowRecovery 

The following example creates a DPT to move all messages to the In-Place Archive in 2 years (730 days):

New-RetentionPolicyTag -Name "DPT-Corp-Move" -Type All -AgeLimitForRetention 730 -RetentionAction MoveToArchive 

The following example creates a DPT to delete voice mail messages after 20 days:

New-RetentionPolicyTag -Name "DPT-Corp-Voicemail" -Type All -MessageClass Voicemail -AgeLimitForRetention 20 -RetentionAction DeleteAndAllowRecovery 

The following example creates an RPT to permanently delete messages in the Junk EMail folder after 30 days:

New-RetentionPolicyTag -Name "RPT-Corp-JunkMail" -Type JunkEmail -AgeLimitForRetention 30 -RetentionAction PermanentlyDelete 

The following example creates a personal tag to never delete a message:

New-RetentionPolicyTag -Name "Never Delete" -Type Personal -RetentionAction DeleteAndAllowRecovery -RetentionEnabled $false 

Step 2: Create a retention policy

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Feature permissions in Exchange Online topic.

Use the Microsoft Purview compliance portal to create a retention policy

  1. Sign in to the Microsoft Purview compliance portal and navigate to Solutions >Data lifecycle management >Exchange (legacy) >MRM Retention policies, and then select New policy.
  2. On the Configure your policy page, enter a name for the retention policy, and then select + Add tag to select the tags you want to add to this retention policy. You can create a retention policy without adding any retention tags to it, but items in the mailbox to which the policy is applied won't be moved or deleted. You can also add and remove retention tags from a retention policy after it's created.
  3. On the Choose retention tags page, select the tags you want, and then select Add. A retention policy can contain the following tags:

Although you can add any number of personal tags to a retention policy, having many personal tags with different retention settings can confuse users. We recommend linking no more than ten personal tags to a retention policy.

You can create a retention policy without adding any retention tags to it, but items in the mailbox to which the policy is applied won't be moved or deleted. You can also add and remove retention tags from a retention policy after it's created.

Use Exchange Online PowerShell to create a retention policy

The following example creates the retention policy RetentionPolicy-Corp and uses the RetentionPolicyTagLinks parameter to associate five retention tags to the policy:

New-RetentionPolicy "RetentionPolicy-Corp" -RetentionPolicyTagLinks "DPT-Corp-Delete","DPT-Corp-Move","DPT-Corp-Voicemail","RPT-Corp-JunkMail","Never Delete" 

For detailed syntax and parameter information, see New-RetentionPolicy.

Step 3: Apply a retention policy to mailbox users

After you create a retention policy, you must apply it to mailbox users. You can apply different retention policies to different set of users. For detailed instructions, see Apply a retention policy to mailboxes.

How do you know this worked?

After you create retention tags, add them to a retention policy, and apply the policy to a mailbox user, the next time the MRM mailbox assistant processes the mailbox, messages are moved or deleted based on settings you configured in the retention tags.

To verify that you have applied the retention policy, do the following:

    Replace with the name, email address, or alias of the mailbox, and run the following command in Exchange Online PowerShell command to run the MRM assistant manually against a single mailbox:

Start-ManagedFolderAssistant -Identity "" 

Having problems? Ask for help in the Exchange forums. Visit the forums at Exchange Online or Exchange Online Protection.