Skip to content

SCRetentionCompliancePolicy

Parameters

Parameter Attribute DataType Description Allowed Values
Name Key String The Name parameter specifies the unique name of the retention policy.
Ensure Write String Specify if this policy should exist or not. Present, Absent
AdaptiveScopeLocation Write String[] The AdaptiveScopeLocation parameter specifies the names of the adaptive scopes the policy applies to. An adaptive policy cannot use any other location, and a policy cannot switch between adaptive and static locations.
Applications Write String[] The Applications parameter specifies the workloads the policy applies to, in the format <LocationType>:<Workload>, for example User:Exchange. Adaptive scopes of the User or Group location type require it.
Comment Write String The Comment parameter specifies an optional comment.
Enabled Write Boolean Determines if the policy is enabled or not.
ExchangeLocation Write String[] The ExchangeLocation parameter specifies the mailboxes to include.
ExchangeLocationException Write String[] This parameter specifies the mailboxes to remove from the list of excluded mailboxes when you use the value All for the ExchangeLocation parameter
ModernGroupLocation Write String[] The ModernGroupLocation parameter specifies the Office 365 groups to include in the policy.
ModernGroupLocationException Write String[] The ModernGroupLocationException parameter specifies the Office 365 groups to exclude when you're using the value All for the ModernGroupLocation parameter.
OneDriveLocation Write String[] The OneDriveLocation parameter specifies the OneDrive for Business sites to include. You identify the site by its URL value, or you can use the value All to include all sites.
OneDriveLocationException Write String[] This parameter specifies the OneDrive for Business sites to exclude when you use the value All for the OneDriveLocation parameter. You identify the site by its URL value.
PublicFolderLocation Write String[] The PublicFolderLocation parameter specifies that you want to include all public folders in the retention policy. You use the value All for this parameter.
RestrictiveRetention Write Boolean The RestrictiveRetention parameter specifies whether Preservation Lock is enabled for the policy.
SharePointLocation Write String[] The SharePointLocation parameter specifies the SharePoint Online sites to include. You identify the site by its URL value, or you can use the value All to include all sites.
SharePointLocationException Write String[] This parameter specifies the SharePoint Online sites to exclude when you use the value All for the SharePointLocation parameter. You identify the site by its URL value.
SkypeLocation Write String[] The SkypeLocation parameter specifies the Skype for Business Online users to include in the policy.
SkypeLocationException Write String[] This parameter is reserved for internal Microsoft use.
TeamsChannelLocation Write String[] The TeamsChannelLocation parameter specifies the Teams Channel to include in the policy.
TeamsChannelLocationException Write String[] This parameter specifies the SharePoint Online sites to exclude when you use the value All for the TeamsChannelLocation parameter. You identify the site by its URL value.
TeamsChatLocation Write String[] The TeamsChatLocation parameter specifies the Teams Chat to include in the policy.
TeamsChatLocationException Write String[] This parameter specifies the SharePoint Online sites to exclude when you use the value All for the TeamsChatLocation parameter. You identify the site by its URL value.
Credential Write PSCredential Credentials of the Exchange Global Admin
ApplicationId Write String Id of the Azure Active Directory application to authenticate with.
TenantId Write String Id of the Azure Active Directory tenant used for authentication.
CertificateThumbprint Write String Thumbprint of the Azure Active Directory application's authentication certificate to use for authentication.
CertificatePassword Write PSCredential Username can be made up to anything but password will be used for CertificatePassword
CertificatePath Write String Path to certificate used in service principal usually a PFX file.
ManagedIdentity Write Boolean Managed ID being used for authentication.
AccessTokens Write String[] Access token used for authentication.

Description

This resource configures a Retention Compliance Policy in Purview.

A policy targets either static locations or adaptive scopes (AdaptiveScopeLocation), but never both. It cannot be switched from one to the other location type once created.

Permissions

Purview

To authenticate with Microsoft Purview, this resource requires the following permissions:

Roles

  • Read
  • View-Only Retention Management
  • Update
  • Retention Management

Role Groups

  • Read
  • Global Reader
  • Update
  • Records Management

Office 365 Exchange Online

To authenticate with the Office 365 Exchange Online API, this resource requires the following permissions:

Delegated permissions

  • Read
  • None

  • Update

  • None

Application permissions

  • Read
  • Exchange.ManageAsApp

  • Update

  • Exchange.ManageAsApp

Examples

Example 1

This example is used to test new resources and showcase the usage of new resources being worked on. It is not meant to use as a production baseline.

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String]
        $ApplicationId,

        [Parameter()]
        [System.String]
        $TenantId,

        [Parameter()]
        [System.String]
        $CertificateThumbprint
    )

    Import-DscResource -ModuleName Microsoft365DSC

    Node localhost
    {
        SCRetentionCompliancePolicy 'SCRetentionCompliancePolicy-Example'
        {
            Name                         = "Finance Records Retention"
            Comment                      = "Keeps finance records available for the seven year statutory period"
            Enabled                      = $true
            ExchangeLocation             = @("All")
            ExchangeLocationException    = @("meetingroom.oslo@contoso.com")
            ModernGroupLocation          = @("All")
            ModernGroupLocationException = @("socialclub@contoso.com")
            OneDriveLocation             = @("All")
            OneDriveLocationException    = @("https://contoso-my.sharepoint.com/personal/lee_gu_contoso_com")
            PublicFolderLocation         = @("All")
            RestrictiveRetention         = $false
            SharePointLocation           = @("All")
            SharePointLocationException  = @("https://contoso.sharepoint.com/sites/pressroom")
            SkypeLocation                = @("adele.vance@contoso.com")
            Ensure                       = "Present"
            ApplicationId                = $ApplicationId
            TenantId                     = $TenantId
            CertificateThumbprint        = $CertificateThumbprint
        }
    }
}

Example 2

This example is used to test new resources and showcase the usage of new resources being worked on. It is not meant to use as a production baseline.

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String]
        $ApplicationId,

        [Parameter()]
        [System.String]
        $TenantId,

        [Parameter()]
        [System.String]
        $CertificateThumbprint
    )

    Import-DscResource -ModuleName Microsoft365DSC

    Node localhost
    {
        SCRetentionCompliancePolicy 'SCRetentionCompliancePolicy-Example'
        {
            Name                  = "Finance Mailbox Retention";
            AdaptiveScopeLocation = @("Finance Zurich Users");
            Applications          = @("User:Exchange,OneDriveForBusiness");
            Comment               = "Keeps the mailboxes and OneDrive content of the finance department";
            Enabled               = $true;
            Ensure                = "Present";
            ApplicationId         = $ApplicationId;
            TenantId              = $TenantId;
            CertificateThumbprint = $CertificateThumbprint;
        }
    }
}