Skip to content

AADGroup

Parameters

Parameter Attribute DataType Description Allowed Values
DisplayName Key String DisplayName of the Azure Active Directory Group
MailNickname Key String Specifies a mail nickname for the group.
Description Write String Specifies a description for the group.
Id Write String Specifies an ID for the group.
Owners Write String[] User Service Principal values for the group's owners.
Members Write String[] User Service Principal values for the group's members.
GroupAsMembers Write String[] Displayname values for the groups member of the group.
MemberOf Write String[] DisplayName values for the groups that this group is a member of.
GroupLifecyclePolicySelectedEnabled Write Boolean Specifies if the current group is part of a selected Group Lifecycle Policy configuration. Only applicable for Microsoft 365 Groups.
GroupTypes Write String[] Specifies the type of the group. To create a security group, leave empty. To create a dynamic membership security group, specify DynamicMembership. To create a Microsoft 365 (aka Unified) group, specify Unified. To create a Microsoft 365 dynamic membership group, specify both Unified and DynamicMembership.
MembershipRule Write String Specifies the membership rule for a dynamic group.
MembershipRuleProcessingState Write String Specifies the rule processing state. The acceptable values for this parameter are: On. Process the group rule or Paused. Stop processing the group rule. On, Paused
SecurityEnabled Required Boolean Specifies whether the group is security enabled. For security groups, this value must be $True.
MailEnabled Required Boolean Specifies whether this group is mail enabled. Currently, you cannot create mail enabled groups in Microsoft Graph, instead the EXODistributionGroup resource can be used.
IsAssignableToRole Write Boolean Specifies whether this group can be assigned a role. Only available when creating a group and can't be modified after group is created.
AssignedToRole Write String[] DisplayName values for the roles that the group is assigned to.
Visibility Write String This parameter determines the visibility of the group's content and members list. Public, Private, HiddenMembership
Theme Write String Specifies a Microsoft 365 group's color theme. Possible values are Teal, Purple, Green, Blue, Pink, Orange or Red. Returned by default. Teal, Purple, Green, Blue, Pink, Orange, Red
AssignedLicenses Write MSFT_AADGroupLicense[] List of Licenses assigned to the group.
WritebackConfiguration Write MSFT_MicrosoftGraphGroupWritebackConfiguration Specifies whether or not a group is configured to write back group object properties to on-premises Active Directory. These properties are used when group writeback is configured in the Microsoft Entra Connect sync client.
Ensure Write String Specify if the Azure AD Group should exist or not. Present, Absent
Credential Write PSCredential Credentials for the Microsoft Graph delegated permissions.
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.
ApplicationSecret Write PSCredential Secret of the Azure Active Directory application to authenticate with.
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.

Embedded Instances

MSFT_AADGroupLicense

Parameters

Parameter Attribute DataType Description Allowed Values
DisabledPlans Write String[] A collection of the unique identifiers for plans that have been disabled.
SkuId Required String The unique identifier for the SKU.

MSFT_MicrosoftGraphGroupWritebackConfiguration

Parameters

Parameter Attribute DataType Description Allowed Values
IsEnabled Write Boolean Indicates whether writeback of cloud groups to on-premise Active Directory is enabled. Default value is true for Microsoft 365 groups and false for security groups.
OnPremisesGroupType Write String Indicates the target on-premises group type the cloud object is written back as. Nullable. The possible values are: universalDistributionGroup, universalSecurityGroup, universalMailEnabledSecurityGroup.If the cloud group is a unified (Microsoft 365) group, this property can be one of the following: universalDistributionGroup, universalSecurityGroup, universalMailEnabledSecurityGroup. Microsoft Entra security groups can be written back as universalSecurityGroup. If isEnabled or the NewUnifiedGroupWritebackDefault group setting is true but this property isn't explicitly configured: Microsoft 365 groups are written back as universalDistributionGroup by defaultSecurity groups are written back as universalSecurityGroup by default universalDistributionGroup, universalSecurityGroup, universalMailEnabledSecurityGroup

Description

This resource configures an Entra Security group, or a Microsoft 365 group, with either assigned or dynamic membership. IMPORTANT: It does not support mail enabled security groups or mail enabled groups that are not unified or dynamic groups. Instead the EXODistributionGroup resource can be used. To configure the mail related attributes of a Microsoft 365 (Unified) group after it is created, the EXOGroupSettings resource can be used.

If using with AADUser, be aware that if AADUser->MemberOf is being specified and the referenced group is configured with AADGroup->Member then a conflict may arise if the two don't match. It is usually best to choose only one of them. See AADUser

Permissions

Graph

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

Delegated permissions

  • Read
  • Application.Read.All, Device.Read.All, Directory.Read.All, Group.Read.All, ReportSettings.Read.All

  • Update

  • Application.Read.All, Device.Read.All, Directory.ReadWrite.All, Group.ReadWrite.All, Organization.Read.All, RoleManagement.ReadWrite.Directory, User.Read.All, ReportSettings.ReadWrite.All

Application permissions

  • Read
  • Application.Read.All, Device.Read.All, Directory.Read.All, Group.Read.All, ReportSettings.Read.All

  • Update

  • Application.Read.All, Device.Read.All, Directory.ReadWrite.All, Group.ReadWrite.All, Organization.Read.All, RoleManagement.ReadWrite.Directory, User.Read.All, ReportSettings.ReadWrite.All

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
    {
        AADGroup 'AADGroup-Example'
        {
            DisplayName                         = "Marketing Team"
            Description                         = "Collaboration group for the marketing department"
            SecurityEnabled                     = $True
            MailEnabled                         = $True
            GroupTypes                          = @("Unified")
            MailNickname                        = "MarketingTeam"
            Members                             = @("admin@$TenantId", "AdeleV@$TenantId")
            Visibility                          = "Private"
            Theme                               = "Blue"
            Owners                              = @("admin@$TenantId", "AdeleV@$TenantId")
            AssignedLicenses                    = @(
                MSFT_AADGroupLicense {
                    SkuId = 'AAD_PREMIUM_P2'
                }
            )
            WritebackConfiguration              = MSFT_MicrosoftGraphGroupWritebackConfiguration{
                IsEnabled           = $true
                OnPremisesGroupType = "universalDistributionGroup"
            }
            AssignedToRole                      = @()
            IsAssignableToRole                  = $false
            GroupLifecyclePolicySelectedEnabled = $false
            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
    {
        AADGroup 'AADGroup-Example'
        {
            DisplayName                         = "Marketing Team"
            Description                         = "Collaboration group for the marketing and communications departments" # Updated Property
            SecurityEnabled                     = $True
            MailEnabled                         = $True
            GroupTypes                          = @("Unified")
            MailNickname                        = "MarketingTeam"
            Members                             = @("AdeleV@$TenantId") # Updated Property
            Visibility                          = "Private"
            Theme                               = "Blue"
            Owners                              = @("admin@$TenantId", "AdeleV@$TenantId")
            AssignedLicenses                    = @(
                MSFT_AADGroupLicense {
                    SkuId = 'AAD_PREMIUM_P2'
                }
            )
            WritebackConfiguration              = MSFT_MicrosoftGraphGroupWritebackConfiguration{
                IsEnabled           = $true
                OnPremisesGroupType = "universalDistributionGroup"
            }
            AssignedToRole                      = @()
            IsAssignableToRole                  = $false
            GroupLifecyclePolicySelectedEnabled = $false
            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
    {
        AADGroup 'AADGroup-Example'
        {
            MailNickname          = "MarketingTeam"
            SecurityEnabled       = $True
            MailEnabled           = $True
            DisplayName           = "Marketing Team"
            Ensure                = "Absent"
            ApplicationId         = $ApplicationId
            TenantId              = $TenantId
            CertificateThumbprint = $CertificateThumbprint
        }
    }
}