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

AADAdministrativeUnit: Does not contain key property resulting in error during execution #2704

Closed
Borgquite opened this issue Dec 21, 2022 · 1 comment · Fixed by #2749 or #2765
Closed
Labels
Bug Something isn't working Entra ID

Comments

@Borgquite
Copy link
Contributor

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

Trying to use new AADAdministrativeUnit module fails when running Test-TargetResource (and possibly others too)

Verbose logs showing the problem

PS C:\Users\user.name\Desktop> Test-DscConfiguration -Path .\ -verbose
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className'
= MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COMPUTERNAME with user sid
SID.
VERBOSE: [MAFINTDC1]: LCM: [ Start Compare ]
VERBOSE: [MAFINTDC1]: LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned
False.
At least one key property must be defined in the instance document. Update the instance document and try again.
+ CategoryInfo : InvalidArgument: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 4
+ PSComputerName : localhost

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.948 seconds

Suggested solution to the issue

Checking under Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.schema.mof, unlike the other modules, there is no 'Key' entry entered.

Should this variable type be set for 'DisplayName'?

NB This error didn't occur on a Windows 11 Enterprise device but does on Windows Server 2012 R2 - but it does seem to be normal for MOF files to have a key.

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
    {
        AADAdministrativeUnit 'TestUnit'
        {
            Credential                    = $credsCredential;
            DisplayName                   = "Test-Unit";
            Ensure                        = "Present";
            MembershipRule                = "(user.country -eq `"Canada`")";
            MembershipRuleProcessingState = "On";
            MembershipType                = "Dynamic";
        }
    }
}

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

Example -ConfigurationData $cd

The operating system the target node is running

OsName : Microsoft Windows Server 2012 R2 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 9600.20666.amd64fre.winblue_ltsb_escrow.221017-1717
OsLanguage : en-US
OsMuiLanguages : {en-US}

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

1.22.1214.1

@Borgquite
Copy link
Contributor Author

Seems to be working in the latest version, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Entra ID
Projects
None yet
2 participants