Skip to content

Exception parsing MOF file '...\MSFT_AADCrossTenantAccessPolicyConfigurationPartner.Schema.mof':The given key was not present in the dictionary.. #6998

@Borgquite

Description

@Borgquite

Description of the issue

I recently upgraded my install of Microsoft365DSC from version 1.25.903.1 to 1.26.318.1.

I've got composite resources for our server roles, compiling using Windows PowerShell 5.1; one of the composite resources includes various instances of the following Microsoft365DSC resources:

  • AADGroup
  • AADAdministrativeUnit
  • EXODistributionGroup
  • EXOManagementRoleAssignment

I've put some sample configurations below to give you an idea of what's happening, although I can't reproduce this outside of the composite configuration.

When I update the Import-DscResource -ModuleName Microsoft365DSC -ModuleVersion 1.26.318.1 command in the composite resource to the latest version, and try to compile, compliation fails with the following error:

Exception parsing MOF file 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.26.318.1\DSCResources\MSFT_AADCrossTenantAccessPolicyConfigurationPartner\MSFT_AADCrossTenantAcce ssPolicyConfigurationPartner.Schema.mof':The given key was not present in the dictionary..                                                                                                 
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExceptionParsingMOFFile

If I put ModuleVersion back to 1.25.903.1, then the compilation process works perfectly.

Please note that I am not using MSFT_AADCrossTenantAccessPolicyConfigurationPartner in the configuration at all!

Any ideas? I'm stumped!

Microsoft 365 DSC Version

1.26.318.1

Which workloads are affected

other

The DSC configuration

# NB This does not replicate the issue but gives an idea of what the composite resource contains

Configuration Example
{
    Import-DscResource -ModuleName Microsoft365DSC -ModuleVersion 1.26.318.1

    node localhost
    {
        AADAdministrativeUnit 'TestUnit'
        {
            DisplayName                   = 'Test-Unit'
            Description                   = 'Test-Unit1'
            MembershipRule                = "(user.country -eq `"Canada`")"
            MembershipRuleProcessingState = 'On'
            MembershipType                = 'Dynamic'
            ScopedRoleMembers             = @(
                MSFT_MicrosoftGraphScopedRoleMembership
                {
                    RoleName       = 'User Administrator'
                    RoleMemberInfo = MSFT_MicrosoftGraphMember
                    {
                        Identity = "joe.bloggs@contoso.com"
                        Type     = "User"
                    }
                }
                MSFT_MicrosoftGraphScopedRoleMembership
                {
                    RoleName       = 'User Administrator'
                    RoleMemberInfo = MSFT_MicrosoftGraphMember
                    {
                        Identity = "jane.doe@contoso.com"
                        Type     = "User"
                    }
                }
            )
            ApplicationId                 = $Microsoft365DSCApplicationId
            CertificateThumbprint         = $Microsoft365DSCCertificateThumbprint
            TenantId                      = $Microsoft365DSCOrganization
        }
        AADGroup 'TestM365DynamicGroup'
        {
            DisplayName = "TestM365DynamicGroup"
            MailNickname = "TestM365DynamicGroup"
            GroupTypes = @("Unified", "DynamicMembership")
            MembershipRule = "(user.userPrincipalName -eq `"joe.bloggs@contoso.com`")"
            MembershipRuleProcessingState = "On"
            SecurityEnabled = $false
            MailEnabled = $true
            IsAssignableToRole = $true
            Visibility = "Private"
            ApplicationId = $Microsoft365DSCApplicationId
            CertificateThumbprint = $Microsoft365DSCCertificateThumbprint
            TenantId = $Microsoft365DSCOrganization
        }
        EXOGroupSettings 'TestM365DynamicGroup'
        {
            DisplayName = "TestM365DynamicGroup"
            AutoSubscribeNewMembers = $true
            WelcomeMessageEnabled = $false
            ApplicationId = $Microsoft365DSCApplicationId
            CertificateThumbprint = $Microsoft365DSCCertificateThumbprint
            TenantId = $Microsoft365DSCOrganization
            DependsOn = "[AADGroup]TestM365DynamicGroup"
        }
        EXODistributionGroup 'TestDG'
        {
            Identity                           = "TestDG"
            Alias                              = "TestDG";
            Name                               = "TestDG";
            PrimarySmtpAddress                 = "TestDG@contoso.com
            Type = "Security"
            HiddenFromAddressListsEnabled = $true
            ApplicationId                      = $Microsoft365DSCApplicationId
            CertificateThumbprint              = $Microsoft365DSCCertificateThumbprint
            TenantId                           = $Microsoft365DSCOrganization
        }
        EXOManagementRoleAssignment "EXOManagementRoleAssignment"
        {
            Name = "EXO $DomainNameRoot $($tmpExoRole.RoleName) Role"
            Role = "Mail Recipients"
            SecurityGroup = "TestDG"
            ApplicationId = $Microsoft365DSCApplicationId
            CertificateThumbprint = $Microsoft365DSCCertificateThumbprint
            TenantId = $Microsoft365DSCOrganization
        }
    }
}

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

Example -ConfigurationData $cd

Verbose logs showing the problem

Exception parsing MOF file 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.26.318.1\DSCResources\MSFT_AADCrossTenantAccessPolicyConfigurationPartner\MSFT_AADCrossTenantAcce ssPolicyConfigurationPartner.Schema.mof':The given key was not present in the dictionary..                                                                                                 
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExceptionParsingMOFFile

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB, en-US}

Key   : PSVersion
Value : 5.1.26100.7920
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.26100.7920
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions