How to filter results using the OData filter on matching substrings?
$ az ad app list --help
...
Arguments:
--filter : OData filter, e.g. --filter "displayname eq 'test' and
servicePrincipalType eq 'Application'".
As per this documentation, I should be doable using for example contains
function. I’m getting:
$ az ad app list --filter "contains(displayname, 'some-name')"
An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed.
2
Answers
I am not sure why you are getting this error but when I ran the following command:
I got the following error:
which makes sense considering you cannot use
contains
function withdisplayName
property. Functions supported fordisplayName
property are:eq
,ne
,not
,ge
,le
,in
,startsWith
, andeq
onnull
values.Reference: https://learn.microsoft.com/en-us/graph/api/resources/application?view=graph-rest-1.0#properties.
Maybe
az rest
with$search
could help. The following command returns the applications when display name contains worddemo
: