Review Azure Activity Log retention

Check the actual destination’s retention and deletion policies against the required investigation history.

Description

For long-term subscription Activity Log retention, export events through diagnostic settings and set the retention period at the destination, such as Log Analytics or Storage.

Potential impact

Losing older changes can leave gaps in an incident timeline or in records required for an audit.

Remediation

Choose the history your investigators and auditors need. Check the destination’s lifecycle and deletion policies for earlier expiration, then verify that investigators can retrieve records that far back.

Examples

These subscription-scope legacy Log Profiles compare retention for the Write category. Required regions and destinations are omitted. Disabling retentionPolicy leaves Activity Log collection running. In this format, days: 0 sets no expiration under that policy.

Before

bicep
resource activityLogProfile 'microsoft.insights/logprofiles@2016-03-01' = {
  name: 'activity-log-profile'
  location: 'eastus'
  properties: {
    categories: [
      'Write'
    ]
    retentionPolicy: {
      enabled: true
      days: 300
    }
  }
}

After

bicep
resource activityLogProfile 'microsoft.insights/logprofiles@2016-03-01' = {
  name: 'activity-log-profile'
  location: 'eastus'
  properties: {
    categories: [
      'Write'
    ]
    retentionPolicy: {
      enabled: true
      days: 365
    }
  }
}

Increasing retention from 300 to 365 days would meet a one-year target under this policy. Choose the period your organization requires.

References