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

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

Closed
KirkMunro opened this issue Sep 30, 2020 · 7 comments · Fixed by #410
Closed

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

KirkMunro opened this issue Sep 30, 2020 · 7 comments · Fixed by #410
Assignees
Labels

Comments

@KirkMunro
Copy link

KirkMunro commented Sep 30, 2020

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: @darrelmiller

@ghost ghost added the ToTriage label Sep 30, 2020
@darrelmiller
Copy link
Contributor

Hey @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

@peombwa
Copy link
Member

peombwa commented Sep 30, 2020

@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
Copy link

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

@ddyett ddyett linked a pull request Oct 5, 2020 that will close this issue
@KirkMunro
Copy link
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.

@KirkMunro
Copy link
Author

@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
Copy link
Member

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

@KirkMunro
Copy link
Author

Thanks @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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants