Migrate from diagnostic settings storage retention to Azure Storage lifecycle management

The Diagnostic Settings Storage Retention feature is being deprecated. To configure retention for logs and metrics use Azure Storage Lifecycle Management.

This guide walks you through migrating from using Azure diagnostic settings storage retention to using Azure Storage lifecycle management for retention.

Important

Deprecation Timeline.

  • March 31, 2023 – The Diagnostic Settings Storage Retention feature will no longer be available to configure new retention rules for log data. If you have configured retention settings, you'll still be able to see and change them.
  • September 30, 2023 – You will no longer be able to use the API or Azure portal to configure retention setting unless you're changing them to 0. Existing retention rules will still be respected.
  • September 30, 2025 – All retention functionality for the Diagnostic Settings Storage Retention feature will be disabled across all environments.

Prerequisites

An existing diagnostic setting logging to a storage account.

Migration Procedures

To migrate your diagnostics settings retention rules, follow the steps below:

  1. Go to the Diagnostic Settings page for your logging resource and locate the diagnostic setting you wish to migrate

  2. Set the retention for your logged categories to 0

  3. Select Save A screenshot showing a diagnostics setting page.

  4. Navigate to the storage account you're logging to

  5. Under Data management, select Lifecycle Management to view or change lifecycle management policies

  6. Select List View, and select Add a rule A screenshot showing the lifecycle management screen for a storage account.

  7. Enter a Rule name

  8. Under Rule Scope, select Limit blobs with filters

  9. Under Blob Type, select Append Blobs and Base blobs under Blob subtype.

  10. Select Next A screenshot showing the details tab for adding a lifecycle rule.

  11. Set your retention time, then select Next A screenshot showing the Base blobs tab for adding a lifecycle rule.

  12. On the Filters tab, under Blob prefix set path or prefix to the container or logs you want the retention rule to apply to.
    For example, for all Function App logs, you could use the container insights-logs-functionapplogs to set the retention for all Function App logs. To set the rule for a specific subscription, resource group, and function app name, use insights-logs-functionapplogs/resourceId=/SUBSCRIPTIONS/<your subscription Id>/RESOURCEGROUPS/<your resource group>/PROVIDERS/MICROSOFT.WEB/SITES/<your function app name>.

  13. Select Add to save the rule. A screenshot showing the filters tab for adding a lifecycle rule.

Next steps

Configure a lifecycle management policy.