Repository navigation
Closed
Labels
Description
This used to work, pre-RTM:
Get-MgUser -All -Filter 'AccountEnabled eq true' -Expand Manager
Now it fails with the following error:
Get-MgUser : Unrecognized query argument specified: '?$top'.
At line:1 char:1
+ Get-MgUser -All -Filter 'AccountEnabled eq true' -Expand Manager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ Top = 100, Sk...stem.String[] }:<>f__AnonymousType43`8) [Get-MgUser
_List1], RestException`1
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_List1
If I remove -All, it fails with this error:
Get-MgUser : Unrecognized query argument specified: '?$filter'.
At line:1 char:1
+ Get-MgUser -Filter 'AccountEnabled eq true' -Expand Manager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ Top = , Skip ...stem.String[] }:<>f__AnonymousType43`8) [Get-MgUser
_List1], RestException`1
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_List1
If I remove -Filter, it fails with this error:
Get-MgUser : Unrecognized query argument specified: '?$Select'.
At line:1 char:1
+ Get-MgUser -Property Manager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ Top = , Skip ...ndProperty = }:<>f__AnonymousType43`8) [Get-MgUser
_List1], RestException`1
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_List1
So all OData query arguments are broken since the 1.0.1 release.
Here is the output from the last command with debug turned on:
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletProcessRecordAsyncStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: https://graph.microsoft.com/v1.0/users?$filter=AccountEnabled eq true&Expand=Manager
DEBUG: RequestCreated: https://graph.microsoft.com/v1.0/users?$filter=AccountEnabled eq true&Expand=Manager
DEBUG: HeaderParametersAdded: https://graph.microsoft.com/v1.0/users?$filter=AccountEnabled eq true&Expand=Manager
DEBUG: BeforeCall:
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-MgUser : Unrecognized query argument specified: '?$filter'.
At line:1 char:32
+ ... 'Continue'; Get-MgUser -Filter 'AccountEnabled eq true' -Expand Manag ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ Top = , Skip ...stem.String[] }:<>f__AnonymousType43`8) [Get-MgUser
_List1], RestException`1
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_List1
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: CmdletEndProcessing:
Please issue a hotfix for this as soon as possible.
Also, I strongly recommend adopting Pester tests as part of your CI/CD pipeline so that these regressions don't happen, or augmenting your Pester tests if you already have a Pester test harness in place.
Activity
darrelmiller commentedon Sep 30, 2020
Hey Kirk Munro (@KirkMunro) Thanks for reporting this. A couple of us have tried it and we are not able to repro the error.
peombwa commentedon Sep 30, 2020
Kirk Munro (@KirkMunro), we've traced the issue to the underlaying .NET 4.x framework, and it only happens in PS 5.1 when targeting v1.0 profile. Consider using PS 7 as we work on getting a fix out via #410
This is related to #408
tyteen4a03 commentedon Oct 4, 2020
Any ETA for this? I can't use PS7 because I need ExchangeOnline.
KirkMunro commentedon Oct 15, 2020
I'm really surprised that it has taken more than 2 weeks for this significant issue to get fixed. I just learned that this issue breaks usage of
-Allas well. Is there an ETA for this fix? PowerShell 7 is not an answer for everyone.KirkMunro commentedon Oct 22, 2020
Darrel (@darrelmiller): I see the fix for this is already in a PR, associated with your 1.1.0 milestone that shows as only being 16% complete, with no due date. PowerShell 7 as a workaround for this problem only works if you're talking to someone who is using Graph from native PowerShell. I have a product, that currently is built on the Windows PowerShell SDK, and while we will support the PowerShell 7 SDK, we're not quite there yet, so there is no workaround for me. The end result is that you've GA'ed a broken release, which holds us back on 0.9.1. When can I expect to see this issue fixed in an update to the Microsoft.Graph module bundle in the Gallery?
peombwa commentedon Oct 27, 2020
Sorry about the delay. We were blocked by bad metadata that drives our generation process.
This bug has now been fixed in 1.1.0. Use
Update-Module Microsoft.Graphto update.KirkMunro commentedon Oct 27, 2020
Thanks Peter Ombwa (@peombwa), I have confirmed this resolves this issue.