Skip to content

Conversation

@ajkenah
Copy link
Contributor

@ajkenah ajkenah commented Jan 9, 2026

Pull Request (PR) description

Updates the Get-TargetResource function for AADGroup to return a Schema accurate object that can be processed with the LCM.

This Pull Request (PR) fixes the following issues

FIXES #6796

Task list

  • Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
    Entry should say what was changed and how that affects users (if applicable), and
    reference the issue being resolved (if applicable).
  • Resource parameter descriptions added/updated in the schema.mof.
  • Resource documentation added/updated in README.md.
  • Resource settings.json file contains all required permissions.
  • Examples appropriately added/updated.
  • Unit tests added/updated.
  • New/changed code adheres to DSC Community Style Guidelines.

SkuId = $skuPartNumber.SkuPartNumber -replace [char]0xFEFF
}
$returnValue += $currentLicense
$returnValue += New-CimInstance -ClassName MSFT_AADGroupLicense -Namespace root/Microsoft/Windows/DesiredStateConfiguration -Property $currentLicense -ClientOnly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return of the Get-TargetResource should not return objects of types CIMInstance. What is the issue we're trying to fix with this change?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using Get-DscConfiguration via the LCM, double-nested properties are not serialized and omitted by the LCM if they are a hashtable. This is an issue when users are relying on the functionality. The same thing like here was already applied to the IntuneSettingCatalogCustomPolicy with #6780.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NikCharlebois.
Apologies for my late response, I was on holiday with my family.
As mentioned by Fabien, the LCM cannot convert nested hash tables into the required CIM object, causing it to error when using the Get-DscConfiguration on an imported MOF.

This is a known issue with the LCM, and the standard approach is to either use classes or create the correctly structured CIMInstance object before presenting it back to the LCM.

As the Graph API evolves, this issue will surely show up again with other resources, so it's probably worth considering at the project level, instead of just the resource level like I've done here.

Options include:

  1. Use classes.
  2. Require nested resources to be properly structured as a CIMInstance.
  3. Remove support for the LCM; or
  4. Leave it as is. Apparently, I seem to be the only one that uses the Get-DscConfiguration command anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-TargetResource fails for AADGroup resource

3 participants