Get-UnifiedAuditLogRetentionPolicy

This cmdlet is available only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell.

Use the Get-UnifiedAuditLogRetentionPolicy cmdlet to view the properties of the 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.

Syntax

Get-UnifiedAuditLogRetentionPolicy
   [-Operation <String>]
   [-RecordType <AuditRecordType>]
   [-RetentionDuration <UnifiedAuditLogRetentionDuration>]
   [-UserId <String>]
   [<CommonParameters>]

Description

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.

Examples

Example 1

Get-UnifiedAuditLogRetentionPolicy | Sort-Object -Property Priority | Format-List Priority,Name,Description,RecordTypes,Operations,UserIds,RetentionDuration

This example lists the configurable properties for all audit log retention policies in your organization. The command also lists the policies in order of highest to lowest priority.

Example 2

Get-UnifiedAuditLogRetentionPolicy -RecordType ExchangeItem | Format-List Name,Description,RecordTypes,Operations,UserIds,RetentionDuration,Priority

This example lists the configurable properties for all audit log retention policies that apply to audit records the record type of ExchangeItem.

Parameters

-Operation

The Operations parameter filters the results by the operations that are specified in the policy. For a list of the available values for this parameter, see Audited activities.

You can enter multiple values separated by commas. If the values contain spaces or otherwise require quotation marks, use the following syntax: "Value1","Value2",..."ValueN".

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-RecordType

The RecordType parameter filters the results by the record types that are defined in the policy. For details about the available values, see AuditLogRecordType.

Type:AuditRecordType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-RetentionDuration

The RetentionDuration parameter filters the policy results by the retention duration specified in the policy. Valid values are:

  • ThreeMonths
  • SixMonths
  • NineMonths
  • TwelveMonths
  • TenYears
Type:UnifiedAuditLogRetentionDuration
Accepted values:ThreeMonths, SixMonths, NineMonths, TwelveMonths, TenYears
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-UserId

The UserIds parameter filters the policy results by the ID of the users who are specified in the policy.

You can enter multiple values separated by commas. If the values contain spaces or otherwise require quotation marks, use the following syntax: "Value1","Value2",..."ValueN".

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance