Поділитися через


Customize what happens at the end of the retention period

Microsoft 365 licensing guidance for security & compliance.

When you configure a retention label to retain items for a specific period, you specify what action to take at the end of that retention period. You can choose from the built-in actions of permanently deleting the item, relabeling the item, deactivating the label, and starting a disposition review.

However, if you choose the option to run a Power Automate flow, this label configuration supports custom actions such as:

  • Send an email notification to a records manager, or to the person who created or last modified a document
  • Move a document item to a SharePoint location where you centrally store records

You can also select the Microsoft 365 compliance label-specific actions of relabel the item or permanently delete it:

Configuring a Power Automate flow for when an item reaches the end of its retention period.

For example, a flow can move the item, relabel it, and then send an email notification.

Note

You can also use the relabel action to remove the existing retention label when you select this action but don't specify a replacement label (leave the label name blank). If the existing retention label marked the item as a record, the record must be locked for the label to be removed.

The actions also allow integration with other apps and services. For example, you have another solution that starts your own customized disposition review process when an email notification is received, or your flow adds a new entry into a table and this change automatically starts an existing records management procedure.

It's outside the scope of this article to document all the ways in which you can configure a flow and integrate with other solutions. However, to learn more about Microsoft Power Automate, see Get started with Power Automate and Overview of cloud flows. In this article we'll cover:

Tip

If you're not an E5 customer, use the 90-day Microsoft Purview solutions trial to explore how additional Purview capabilities can help your organization manage data security and compliance needs. Start now at the Microsoft Purview compliance portal trials hub. Learn details about signing up and trial terms.

Overview of using retention labels with a Power Automate flow

The following processes show the high-level overview of how retention labels work with a Power Automate flow:

Process overview of how retention labels work with a Power Automate flow.

In Power Automate, you create an automated cloud flow from blank that uses the trigger When an item reaches the end of its retention period. Then, add one or more steps and specify the operations that run your choice of actions.

Next, in the Microsoft Purview portal or the Microsoft Purview compliance portal, create a new retention label with the following configuration:

  • Retain the item for a specified period of time
  • At the end of the retention period, run the flow that you just created

Apply the label using either of the following methods:

When the retention period expires, your configured flow runs.

Note

In a Power Automate flow, you can also select the action Apply a retention label on the item. This action is independent from this scenario that applies actions at the end of the retention period. Instead, it's the equivalent to manually applying a retention label. The label is applied immediately.

Add resilience to your flow

Although optional, we recommend you always add the Trigger a new instance of the flow if an item can't be located action before Relabel an item at the end of retention and Deletes an item at the end of retention.

This additional action is required for files that have been moved or renamed after an instance of the flow has been triggered but your specified compliance actions haven't completed. Without it, a renamed or moved file would result in the flow failing because it can't find the file.

Although renaming and moving files after an instance of the flow is triggered are an unusual occurrence, adding this recommended action improves the reliability of the compliance actions succeeding because the current path and name of the file is retrieved automatically just before the selected actions run.

Limitations for this scenario

  • You must create a new retention label to run a flow at the end of the retention period. You can't edit an existing retention label for this configuration.

  • By default, the account that creates the Power Automate flow must be the same account that creates the retention label. If you share the flow in Power Automate, the people you share it with can also select the flow when they create a retention label.

  • If you select the relabel action in the flow, the retention label that you select as the replacement can't be configured to mark the item as a regulatory record. It can be configured to mark the item as a record, or not mark the item as a record.

  • If your chosen flow uses an environment type other than Default, you must use PowerShell to create the retention label, and use the FlowId parameter.

Power Automate dependency

Power Automate is a workflow service that automates actions across applications and services. Specific to running a Power Automate flow at the end of the retention period:

  • You must have a Power Automate plan that includes premium connectors, separate from your Microsoft 365 compliance plan.
  • The Power Automate flow must be an automated cloud flow that is created from blank, and configured to use the trigger When an item reaches the end of its retention period.

For more information about how to use and configure the dependent automated cloud flows, see the Microsoft Power Automate Documentation.

How to configure a retention label to run a Power Automate flow

  1. In the Microsoft Purview portal or the Microsoft Purview compliance portal, create a new retention label with your preferred name and settings. For more information, see Use file plan to create and manage retention labels.

  2. Specific to this scenario:

    1. On the Define label settings page, select Retain items indefinitely or for a specific period and specify the retention period.

    2. On the Choose what happens after the retention period page, select Run a Power Automate flow, and then Select a flow:

      Configuring a retention label to run a Power Automate flow after the retention period expires.

    3. From the Select a Power Automate flow flyout pane, you'll see any automated cloud flows that you created (or somebody has shared with you) and that have the When an item reaches the end of its retention period trigger.

      Select the flow you want, and complete the configuration to create the retention label.

A retention label can be configured for only one Power Automate flow, but the same flow can be used by more than one retention label.

When the flow is triggered

Just as it can take up to 7 days to automatically apply a retention label or display it so you can apply it, so you should allow up to 7 days after the expiration period expires before the Power Automate flow is triggered. The initiation of the flow can then take a few hours.

For the Microsoft 365 compliance actions of delete and relabel, then allow up to 7 days for these actions to complete. Specific for Exchange and the Microsoft 365 compliance actions of delete, allow up to 14 days.

Both the flow itself and the Microsoft 365 compliance actions in the flow are queued so that if there are any network or service delays, the flow and actions are automatically retried.

The principles of retention still apply to retention labels that are configured to run a flow at the end of the retention period, in that an item is always retained for the longest period if there is a conflict with one or more retention policies. However, the flow is always triggered at the end of the label's retention period.

Next steps

To help you track the retention labels with this configuration:

To confirm there weren't any failures or errors with your flow, go to the Power Automate dashboard, select My flows, and then select your flow to review the 28-day run history.