I want to query all the virtual Machines in a subscription, but I want to be able to filter using a query param and not by code.
I am able to get all the virtual machines but I want to know if I can filter them and how.
I am not using the classic REST but ARM.
If this is the API you use:
then you can use filter like this:
Your request will look like this:
$filter
is optional and is used to filter results. Replace {filter} with one of the following values:Currently, you cannot use the tagname or tagvalue filters with other filters; such as, name, location, or resourceType.
To get all the Resources of type VM you can use a filter like this:
For more info:
https://msdn.microsoft.com/en-us/library/azure/dn790569.aspx
I would add one change on @Aram's answer. An example for a filter would have to include single quotes, like:
So possible filters would be: