Reputation: 198
I am trying to GET filtered responses from Azure RM using the REST API . The Type filter is working , But When I try to get with Location filter , it always imposes as a wrong query filter .
For example , I need to get Virtual Networks from Location 'ukwest' I am giving the following REST API link , it never works .
https://management.azure.com/subscriptions/subscription_ID/providers/Microsoft.Network/virtualnetworks?$filter=location%20eq%20'ukwest'&api-version=2017-06-01
But according to this type filter works , Azure REST API - query parameters for getting all the virtual machine
I did not find any document Related to this in Azure , It would be nice if I get some spark here.
Upvotes: 2
Views: 2170
Reputation: 136366
Looking at the REST API documentation for listing all Virtual Networks in an Azure Subscription here
, I believe that $filter
criteria is not supported.
What you would need to do is use Resource Manager API
to get all resources and filter that by resource type and location (as mentioned in the answer you linked). So your request URL would be:
https://management.azure.com/subscriptions/{subscription-id}/resources?$filter=resourceType%20eq%20'Microsoft.Network/virtualnetworks'%20and%20location eq%20'ukwest'&api-version={api-version}
Do give it a try.
Upvotes: 1