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

Export-M365DSCConfiguration: Resources that support filtering fail if endsWith is used in the filter #3518

Closed
ricmestre opened this issue Jul 27, 2023 · 0 comments · Fixed by #3519 or #3568

Comments

@ricmestre
Copy link
Contributor

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

While experimenting with filtering it seems that if filter contains endsWith it fails, see below, this is because some parameters are not sent to Graph.

Verbose logs showing the problem

[2023/07/27 02:25:19]
{InvalidOperation}
System.Exception: [Request_UnsupportedQuery] : Operator 'endsWith' is not supported because the 'ConsistencyLevel:eventual' header is missing. Refer to https://aka.ms/graph-docs/advanced-queries for more information

"Error during Export:"
at Get-MgGroup, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Groups\2.1.0\exports\ProxyCmdletDefinitions.ps1: line 42527
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.719.1\DSCResources\MSFT_AADGroup\MSFT_AADGroup.psm1: line 1041
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.719.1\modules\M365DSCReverse.psm1: line 615
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.719.1\modules\M365DSCUtil.psm1: line 1310
at , : line 1
REDACTED@REDACTED.onmicrosoft.com
TenantId: REDACTED.onmicrosoft.com

Suggested solution to the issue

Add ConsistencyLevel = 'eventual' and CountVariable = 'count' as parameters to the export of each resource if filter contains endsWith.

There are some resources that support filtering, nevertheless the ones that seem to benefit the most from having endsWith would be AADUser, AADGroup and O365Group.

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

N/A

The operating system the target node is running

OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}

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

1.23.719.1

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