Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXODistributionGroup: 'Type' attribute is incorrectly retrieved meaning resource never tests as True #2709

Closed
Borgquite opened this issue Dec 21, 2022 · 1 comment · Fixed by #2738 or #2745
Labels
Bug Something isn't working Exchange Online V1.22.1214.1 Version 1.22.1214.1

Comments

@Borgquite
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

Trying to use the 'EXODistributionGroup' module to create a mail-enabled security group.

Test-TargetResource always returns False which results in DSC attempting to (incorrectly) reconfigure the group.

There are also some errors regarding the 'OrganizationUnit' values differing despite the DSC configuration failing to request an update to these in any way.

Verbose logs showing the problem

VERBOSE: [COMPUTERNAME]: LCM: [ Start Resource ] [[EXODistributionGroup]MailEnabledSecurityGroup]
VERBOSE: [COMPUTERNAME]: LCM: [ Start Test ] [[EXODistributionGroup]MailEnabledSecurityGroup]
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Testing Distribution Group configuration for {Test-Gr
oup}
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Getting configuration of Distribution Group for Test-
Group
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Found Distribution Group Test-Group
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Get-TargetResource Result:
Alias=Test-Group; ApplicationId=; BccBlocked=False; BypassNestedModerationEnabled=False; CertificatePassword=$null; CertificatePath=; Certificate
Thumbprint=; Credential=; Description=$null; DisplayName=Test-Group; Ensure=Present; HiddenGroupMembershipEnabled=False; ManagedBy=user.name; Mana
gedidentity=False; MemberDepartRestriction=Closed; MemberJoinRestriction=Closed; Members=$null; ModeratedBy=; ModerationEnabled=False; Name=Test-Group;
Notes=$null; OrganizationalUnit=gbrp265a010.prod.outlook.com/Microsoft Exchange Hosted Organizations/tenantname.onmicrosoft.com; PrimarySmtpAddres
s=Test-Group@tenantname.onmicrosoft.com; RequireSenderAuthenticationEnabled=True; RoomList=$null; SendModerationNotifications=Always; TenantId=

; Type=$null
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Current Values: Alias=Test-Group; ApplicationId=;
BccBlocked=False; BypassNestedModerationEnabled=False; CertificatePassword=$null; CertificatePath=
; CertificateThumbprint=; Credential=; Descripti
on=$null; DisplayName=Test-Group; Ensure=Present; HiddenGroupMembershipEnabled=False; ManagedBy=user.name; Managedidentity=False; MemberDepartRestric
tion=Closed; MemberJoinRestriction=Closed; Members=$null; ModeratedBy=; ModerationEnabled=False; Name=Test-Group; Notes=$null; OrganizationalUnit=gbrp26
5a010.prod.outlook.com/Microsoft Exchange Hosted Organizations/tenantname.onmicrosoft.com; PrimarySmtpAddress=Test-Group@mafinternational.onmicros
oft.com; RequireSenderAuthenticationEnabled=True; RoomList=$null; SendModerationNotifications=Always; TenantId=
; Type=$null
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Target Values: Alias=Test-Group; Credential=; Ensu
re=Present; Name=Test-Group; Type=Security; Verbose=True
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Test-TargetResource returned False
VERBOSE: [COMPUTERNAME]: LCM: [ End Test ] [[EXODistributionGroup]MailEnabledSecurityGroup] in 12.4050 seconds.
VERBOSE: [COMPUTERNAME]: LCM: [ Start Set ] [[EXODistributionGroup]MailEnabledSecurityGroup]
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Setting Distribution Group configuration for {Test-Gr
oup}
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Getting configuration of Distribution Group for Test-
Group
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Found Distribution Group Test-Group
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Get-TargetResource Result:
Alias=Test-Group; ApplicationId=
; BccBlocked=False; BypassNestedModerationEnabled=False; CertificatePassword=$null; CertificatePath=; Certificate
Thumbprint=; Credential=
; Description=$null; DisplayName=Test-Group; Ensure=Present; HiddenGroupMembershipEnabled=False; ManagedBy=user.name; Mana
gedidentity=False; MemberDepartRestriction=Closed; MemberJoinRestriction=Closed; Members=$null; ModeratedBy=; ModerationEnabled=False; Name=Test-Group;
Notes=$null; OrganizationalUnit=gbrp265a010.prod.outlook.com/Microsoft Exchange Hosted Organizations/tenantname.onmicrosoft.com; PrimarySmtpAddres
s=Test-Group@tenantname.onmicrosoft.com; RequireSenderAuthenticationEnabled=True; RoomList=$null; SendModerationNotifications=Always; TenantId=***
; Type=$null
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] The Distribution Group {Test-Group} already exists. U
pdating settings
VERBOSE: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Setting Distribution Group {Test-Group} with values:
Alias=Test-Group; Name=Test-Group; Type=Security; Verbose=True
WARNING: [COMPUTERNAME]: [[EXODistributionGroup]MailEnabledSecurityGroup] Desired and current OrganizationalUnit values differ.
This property cannot be updated once the distribution group has been created. Delete and recreate the distribution group to update the value.
A parameter cannot be found that matches parameter name 'Type'.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : NamedParameterNotFound,Set-DistributionGroup
+ PSComputerName : localhost

VERBOSE: [COMPUTERNAME]: LCM: [ End Set ] [[EXODistributionGroup]MailEnabledSecurityGroup] in 0.7530 seconds.
The PowerShell DSC resource '[EXODistributionGroup]MailEnabledSecurityGroup' with SourceInfo 'C:\Users\user.name\Documents\MAFINT Azure AD
Automation\DscConfigurations\Example.ps1::16::9::EXODistributionGroup' threw one or more non-terminating errors while running the Set-TargetResource
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost

Suggested solution to the issue

It appears that the module presumes that the Group Type will be returned in a 'Type' variable from Get-DistributionGroup. However, this value ought to be determined from one of GroupType, RecipientType or RecipientTypeDetails instead.

It is not clear to me why the Set script is triggering for OrganizationalUnit.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

$credsCredential = Get-Credential

Configuration Example
{
    Import-DscResource -ModuleName Microsoft365DSC

    node localhost
    {
        EXODistributionGroup 'MailEnabledSecurityGroup'
        {
            Credential = $credsCredential;
            Name = "Test-Group";
            Alias = "Test-Group";
            Type = "Security";
            Ensure = "Present";
        }
    }
}

$cd = @{
    AllNodes = @(
        @{
            NodeName = 'localhost'
            PSDscAllowPlainTextPassword = $true
        }
    )
}

Example -ConfigurationData $cd

The operating system the target node is running

OsName : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage : en-GB
OsMuiLanguages : {en-GB, en-US}

Version of the DSC module that was used ('dev' if using current dev branch)

1.22.1214.1

@andikrueger andikrueger added Bug Something isn't working Exchange Online V1.22.1214.1 Version 1.22.1214.1 labels Dec 21, 2022
NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue Jan 3, 2023
@Borgquite
Copy link
Contributor Author

All appears to be working - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Exchange Online V1.22.1214.1 Version 1.22.1214.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants