You can use --filter
like this
az ad app list --filter "startswith(displayName,'MyCommonPattern')"
Above mentioned command may give you quite a bit of json in output.
You can boil it down to just the appIds or whatever you need using --query
like this
az ad app list --filter "startswith(displayName,'RohitCommonPattern')" --query '[].appId'
Sample output
[
"b5exxxc4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"f13xxxa5-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
]
I have shown this example using startswith
but you could use other operators as well like eq
, any
for collections, logical operators like and
, or
. Do look at the link related to Azure AD Graph API for more samples.
One more thing that I did try but isn't probably supported is contains
More information
--filter
accepts OData filter as per Microsoft Docs - az ad app list
- Azure AD Graph API would probably get used behind the scenes to work with application listing, so I guess you could read about filtering and examples from here. Supported Query Options - Azure AD Graph API
Here is a general specification, although not everything may be implemented behind the scenes.
NOTE: I have intentionally mentioned older Azure AD Graph API https://graph.windows.net
and not the newer Microsoft Graph API https://graph.microsoft.com
since Application related APIs are still in beta for Microsoft Graph API.