Description
Azure keeps subscription Activity Log events, including resource creation, updates and deletion, for 90 days. To retain them longer, export the required categories through subscription diagnostic settings.
Potential impact
If the exported records expire too soon, a later investigation or audit may be missing the change that matters.
Remediation
Choose a period that meets investigation, contractual and regulatory needs within your storage budget. A year is one example. Set Log Analytics retention or a Storage lifecycle policy, then check that investigators can retrieve both recent changes and older records for the required period.
Examples
The examples use legacy Log Profiles. Their scheduled retirement date was September 30, 2026. Both tasks assume an actual resource group, storage account and credentials with the required permissions.
Before
- name: 로그 프로필 생성
azure_rm_monitorlogprofile:
name: myProfile
location: eastus
locations:
- eastus
- westus
categories:
- Write
- Action
retention_policy:
enabled: false
storage_account:
resource_group: myResourceGroup
name: myStorageAccount
enabled: false turns off the profile’s expiration policy. Azure continues collecting Activity Log events.
After
- name: 로그 프로필 생성
azure_rm_monitorlogprofile:
name: myProfile
location: eastus
locations:
- eastus
- westus
categories:
- Write
- Action
retention_policy:
enabled: true
days: 380
storage_account:
resource_group: myResourceGroup
name: myStorageAccount
This policy sets a 380-day expiration. In the legacy format, days: 0 specifies indefinite retention, though separate deletion policies can still remove records.