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

AADGroup: Problem with -Filters in Export. #5609

Open
salbeck-sit opened this issue Jan 8, 2025 · 3 comments
Open

AADGroup: Problem with -Filters in Export. #5609

salbeck-sit opened this issue Jan 8, 2025 · 3 comments

Comments

@salbeck-sit
Copy link
Contributor

Description of the issue

I'm trying to run an export of resource AADGroup with -Filters @{AADGroup = "NOT groupTypes/any(s:s eq 'Unified')"} in order to ignore M365-groups since I want to extract only security-groups that must be present
This filter - the presence of NOT - requires parameters -Consistencylevel Eventual -CountVariable to be present in the call to Get-MgGroup
However, the logic in the resource will include these parameters only if the filter includes tests for null or endswith (line 1283)

I've tried adding '-or $Filter -like "not"' and then the export works as expected.

I'm raising the issue because the -Filter parameter is used in multiple resources and a similar update could be required more or less all over the place.
Ideally, create a separate function called by Export-TargetResource everywhere that adds extra parameters regardless of resource. Then rules for when to append extra parameters can be confined to a single function.
Hopefully someone has the skills to do a 'general update' in either way without incurring instant arthritis.

Microsoft 365 DSC Version

DEV

Which workloads are affected

Azure Active Directory (Entra ID)

The DSC configuration

(export)

Verbose logs showing the problem

Environment Information + PowerShell Version

Windows PS 5.1
@ricmestre
Copy link
Contributor

The proper way to fix this is for someone to go through [0] and "filter" the filter for the ones that each resource supports.

[0] https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http#support-for-filter-by-properties-of-microsoft-entra-id-directory-objects

@salbeck-sit
Copy link
Contributor Author

There are 135 resources that support -Filter in Export-TargetResource. I know I could update AADGroup and leave it at that but I'm trying to 'see the big picture'.

@salbeck-sit
Copy link
Contributor Author

At least get it updated in DRG to catch future resources ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants