Skip to content

SCAdaptiveScope

Parameters

Parameter Attribute DataType Description Allowed Values
Name Key String The name of the adaptive scope.
LocationType Required String The type of location the adaptive scope targets. It cannot be changed after the scope is created. User, Group, Site
FilterConditions Write String The filter conditions of the adaptive scope as a JSON string with a Conjunction and a list of Conditions. A condition either has a Name, an Operator and a Value or is a nested group with its own Conjunction and Conditions. Cannot be combined with RawQuery.
RawQuery Write String The advanced query of the adaptive scope. Cannot be combined with FilterConditions.
UseKql Write Boolean Specifies whether the RawQuery of a Site scope uses the Keyword Query Language. It cannot be changed after the scope is created.
AdministrativeUnit Write String The display name or id of the administrative unit the adaptive scope is restricted to.
Comment Write String The comment of the adaptive scope.
EnabledStates Write String[] The states of the users or groups the adaptive scope includes. Only supported by User and Group scopes. Active, Inactive, SoftDeleted
LinkedRecipientEnabledStates Write String[] The states of the OneDrive, group and channel sites the adaptive scope includes. Only supported by Site scopes. OneDrive_Active, OneDrive_Inactive, OneDrive_SoftDeleted, GroupSite_Active, GroupSite_Inactive, GroupSite_SoftDeleted, ChannelSite_Active, ChannelSite_SoftDeleted
Ensure Write String Specify if the adaptive scope should exist. Present, Absent
Credential Write PSCredential Credentials of the Global Admin
ApplicationId Write String Id of the Entra ID application to authenticate with.
TenantId Write String Id of the Entra ID tenant used for authentication.
CertificateThumbprint Write String Thumbprint of the Entra ID 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.
AccessTokens Write String[] Access token used for authentication.

Description

This resource configures an adaptive scope in Purview. Adaptive scopes target retention policies and other Purview policies at users, groups or sites through a query instead of a static list of locations.

Please note: RawQuery takes an advanced query instead and cannot be combined with FilterConditions and LocationType & UseKql cannot be changed once the adaptive scope exists.

Permissions

Graph

To authenticate with the Graph API, this resource requires the following permissions:

Delegated permissions

  • Read
  • AdministrativeUnit.Read.All

  • Update

  • AdministrativeUnit.Read.All

Application permissions

  • Read
  • AdministrativeUnit.Read.All

  • Update

  • AdministrativeUnit.Read.All

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
    {
        SCAdaptiveScope 'SCAdaptiveScope-Example'
        {
            AdministrativeUnit    = "Amsterdam Office";
            Comment               = "Members of the finance department in Zurich";
            EnabledStates         = @("Active", "Inactive");
            FilterConditions      = '{"Conditions":[{"Value":"Finance","Operator":"Equals","Name":"Department"},{"Value":"Zurich","Operator":"Equals","Name":"City"}],"Conjunction":"And"}';
            LocationType          = "User";
            Name                  = "Finance Zurich Users";
            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
    {
        SCAdaptiveScope 'SCAdaptiveScope-Example'
        {
            AdministrativeUnit    = "Amsterdam Office";
            Comment               = "Members of the finance department located in Zurich"; # Updated Property
            EnabledStates         = @("Active", "Inactive");
            FilterConditions      = '{"Conditions":[{"Value":"Finance","Operator":"Equals","Name":"Department"},{"Value":"Zurich","Operator":"Equals","Name":"City"}],"Conjunction":"And"}';
            LocationType          = "User";
            Name                  = "Finance Zurich Users";
            Ensure                = "Present";
            ApplicationId         = $ApplicationId;
            TenantId              = $TenantId;
            CertificateThumbprint = $CertificateThumbprint;
        }
    }
}

Example 3

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
    {
        SCAdaptiveScope 'SCAdaptiveScope-Example'
        {
            LocationType          = "User";
            Name                  = "Finance Zurich Users";
            Ensure                = "Absent";
            ApplicationId         = $ApplicationId;
            TenantId              = $TenantId;
            CertificateThumbprint = $CertificateThumbprint;
        }
    }
}