Skip to content

What happened to OData query arguments in the 1.0.1 release??? #409

Closed

Description

@KirkMunro

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.

cc: Darrel (@darrelmiller)

Activity

  1. darrelmiller commented on Sep 30, 2020

    @darrelmiller
    Contributor

    Hey Kirk Munro (@KirkMunro) Thanks for reporting this. A couple of us have tried it and we are not able to repro the error.

    DEBUG: URLCreated: https://graph.microsoft.com/beta/users?$top=100&$filter=AccountEnabled eq true&Expand=Manager
    DEBUG: RequestCreated: https://graph.microsoft.com/beta/users?$top=100&$filter=AccountEnabled eq true&Expand=Manager
    DEBUG: HeaderParametersAdded: https://graph.microsoft.com/beta/users?$top=100&$filter=AccountEnabled eq true&Expand=Manager
    DEBUG: GET /beta/users?$top=100&$filter=AccountEnabled%20eq%20true&Expand=Manager HTTP/1.1
    HTTP: graph.microsoft.com
    
    
    DEBUG: BeforeCall:
    DEBUG: ResponseCreated:
    DEBUG: BeforeResponseDispatch:
    
    DEBUG: HTTP/1.1 200 OK
    
  2. peombwa commented on Sep 30, 2020

    @peombwa
    Member

    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

  3. tyteen4a03 commented on Oct 4, 2020

    @tyteen4a03

    Any ETA for this? I can't use PS7 because I need ExchangeOnline.

  4. KirkMunro commented on Oct 15, 2020

    @KirkMunro
    Author

    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 -All as well. Is there an ETA for this fix? PowerShell 7 is not an answer for everyone.

  5. KirkMunro commented on Oct 22, 2020

    @KirkMunro
    Author

    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?

  6. peombwa commented on Oct 27, 2020

    @peombwa
    Member

    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.Graph to update.

  7. KirkMunro commented on Oct 27, 2020

    @KirkMunro
    Author

    Thanks Peter Ombwa (@peombwa), I have confirmed this resolves this issue.

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions