Skip to content

Where to find OData supported query operators in --filter parameter #14277

Description

@Gismork

Hi,

In several Azure CLI commands, you can use a --filter parameter to use OData syntax to filter your query.
It's seems that all OData operators aren't supported.

You can do:
az ad app list --filter "displayName eq 'myAppRegistrationDisplayNameHere'"

Or:
az ad app list --filter "startswith(displayName,'myAppRegistration')"

But you can't use endswith;
az ad app list --filter "endswith(displayName,'appRegistrationEnd')"
You get an error: Unsupported Query

I didn't find any documentation listing this information.
Is there a documentation somewhere that list all supported OData operators when using Azure CLI --filter parameter ?

Thank you

PS: Using Azure CLI 2.8.0


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. ghost added
    needs-triageThis is a new issue that needs to be triaged to the appropriate team.
    on Jul 8, 2020
  2. ghost added
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Jul 8, 2020
  3. ghost removed on Jul 8, 2020
  4. ghost removed
    needs-triageThis is a new issue that needs to be triaged to the appropriate team.
    on Jul 8, 2020
  5. added
    Graph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad
    and removed
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Jul 8, 2020
  6. added this to the S173 milestone on Jul 8, 2020
  7. yonzhan commented on Jul 8, 2020

    @yonzhan
    Collaborator

    add to S173

  8. 14 remaining items

  9. added this to the S179 milestone on Nov 14, 2020
  10. removed this from the S180 milestone on Dec 25, 2020
  11. bb-froggy commented on Feb 16, 2023

    @bb-froggy

    The
    az ad app list --filter "startswith(displayName,'myAppRegistration')"
    from the issue description does not work anymore, it says "Invalid filter clause". This is now the same as endswith.

  12. Gismork commented on Feb 16, 2023

    @Gismork
    Author

    There was an underlying API change in Azure CLI version 2.37.0:

    The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration

    I updated my CLI version (I was still in version 2.36.0). Now with version 2.45.0 I also have the error "Invalid filter clause" with the command az ad app list --filter "startswith(displayName,'myAppRegistration')"

    Startswith seems supported by Microsoft Graph API (doc). I don't know how Azure CLI will handle the syntax.

  13. bb-froggy commented on Feb 16, 2023

    @bb-froggy

    I tried this PowerShell code and it works:
    Get-MgApplication -Filter "startswith(displayName, 'myAppRegistration')" -CountVariable CountVar -Top 10 -Sort "displayName" -ConsistencyLevel eventual
    I have read in the Graph API reference where I also got this code from that filters and orderby in conjunction with app registrations work only when you also have the CountVariable and the ConsistencyLevel eventual.

  14. charlesgardyn commented on Jan 11, 2024

    @charlesgardyn

    Will endswith be supported in bash?

  15. hkelley commented on Jun 14, 2025

    @hkelley

    Similar question about Powershell and Az.Resources 7.9.0

    Only a basic eq works:

    Get-AzResource -ResourceGroupName $rgname -ODataQuery "`$filter=resourceType eq 'Microsoft.Network/networkInterfaces'"
    

    These two fail, though with different exceptions (I get a Details elemen

    Get-AzResource -ResourceGroupName $rgname -ODataQuery "`$filter=startswith(resourceType,'Microsoft.Network/networkInterfaces')"
              
    Get-AzResource: Invalid $filter 'startswith(resourceType,'Microsoft.Network/networkInterfaces')' specified in the query string. 
    Details: 'Unsupported filter function found:'startswith'. Property name:'resourcetype'. Supported functions: '''''
    StatusCode: 400
    ReasonPhrase: Bad Request
    
    Get-AzResource -ResourceGroupName $rgname -ODataQuery "`$filter=contains(resourceType,'Microsoft.Network/networkInterfaces')"
    Get-AzResource: Invalid $filter 'contains(resourceType,'Microsoft.Network/networkInterfaces')' specified in the query string.
    StatusCode: 400
    ReasonPhrase: Bad Request
    
  16. added this to the Backlog milestone on Jun 14, 2025
  17. MaddyMicrosoft commented on Sep 16, 2026

    @MaddyMicrosoft
    Member

    Update on current CLI (2.87.0):

    startswith works again. The 2023 "Invalid filter clause" regression is resolved.
    endswith needs Microsoft Graph advanced query (the ConsistencyLevel: eventual header plus $count=true), which az ad list commands don't send. It now fails with a clear error saying exactly that, instead of the old cryptic one.
    Workaround today, using your existing az login:

    az rest --method get --url "https://graph.microsoft.com/v1.0/applications?$filter=endswith(displayName,'a')&$count=true" --headers "ConsistencyLevel=eventual"

    Operator support per resource: https://learn.microsoft.com/en-us/graph/aad-advanced-queries

    Closing as the questions here are addressed. Native advanced-query support in az ad --filter would be a separate enhancement, feel free to open a focused issue if that would help.

  18. MaddyMicrosoft commented on Sep 16, 2026

    @MaddyMicrosoft
    Member

    hkelley that one is a different stack. Get-AzResource -ODataQuery goes through Azure Resource Manager (the /resources endpoint), not Microsoft Graph, so the ConsistencyLevel: eventual advanced-query approach above does not apply here.
    ARM's resource $filter supports only a limited set of operators (as your error shows), which is separate from the az ad / Graph behavior in this issue.
    Could you open a fresh issue in the Azure PowerShell repo (https://github.com/Azure/azure-powershell) if you still need help.

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

Metadata

Metadata

Labels

Graph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az adOutput QueryJMESPath query issues for Azure CLI outputService AttentionThis issue is responsible by Azure service team.act-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions