UnifiedAuditLogRetentionPolicy
Applies to : Security & Compliance
This cmdlet is available only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell.
Use the Set-UnifiedAuditLogRetentionPolicy cmdlet to modify audit log retention policies in the Microsoft Defender portal or the Microsoft Purview compliance portal.
For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.
Audit log retention policies are used to specify a retention duration for audit logs for that are generated by admin and user activity. An audit log retention policy can specify the retention duration based on the type of audited activities, the Microsoft 365 service that activities are performed in, or the users who performed the activities. For more information, see Manage audit log retention policies.
To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see Permissions in the Microsoft Defender portal or Permissions in the Microsoft Purview compliance portal.
Available cmdlets
Parameters
| Name | Type | Default value | Accepted values |
|---|---|---|---|
| Priority | Int32 | ||
| RetentionDuration | UnifiedAuditLogRetentionDuration | ThreeMonths, SixMonths, NineMonths, TwelveMonths, TenYears | |
| Operations | MultiValuedProperty | ||
| RecordTypes | MultiValuedProperty | ||
| UserIds | MultiValuedProperty |
Examples
Example 1
Set-UnifiedAuditLogRetentionPolicy -Identity "eDiscovery audit retention" -RecordTypes Discovery,AeD -UserIds [email protected] -RetentionDuration SixMonths -Priority 100 This example adds the AeD (for eDiscovery Premium events) record type to the policy. It also configures that the policy is applied only to the audit logs for activities performed only by the user [email protected].
Example 2
Set-UnifiedAuditLogRetentionPolicy -Name "SearchQueryPerformed by app@sharepoint" -Operations SearchQueryPerformed,FileAccessed -UserIds $null -RetentionDuration SixMonths -Priority 10000 This example modifies an audit log retention policy and changes to retention duration to six months, adds an additional activity to the Operations parameter, and removes all values from the UserId property so the policy applies to all users.