Forum Discussion
Can I use "not" filters in Azure Pricing API
Jan Bakker Unfortunately, the VM Instance size isn't called "Spot", it's called something like "D2s Spot"- so the ne test doesn't pick that up as it's doing an exact match.
I am taking the storage data from the pricing api , but i need to exclude the "Azure Netapp files" from my query , please help.
Thanks in advance.
Regards Vincent S
- ChrisBradshawJan 21, 2022Iron Contributor
vincentss A different problem here, but can that just be accomplished by adding
$filter=productName ne 'Azure NetApp Files'
to your query? For example
https://prices.azure.com/api/retail/prices?$filter=productName%20ne%20%27Azure%20NetApp%20Files%27- SNANov 11, 2024Copper Contributor
ChrisBradshaw - looking at the date when this question was asked, I am not sure if you have already found the solution to this already. However, this is something that I had to do as well and I was looking at ways to do this using REST API, for example, what if I want to fetch all Virtual Machines that are not having 'Spot' in the skuName, as there is no type called "Spot Consumption" or as such. I happened to come across this discussion while I was looking for an answer.
Further, I just tried to do this and turned out to be very simple.
https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&$filter=location eq 'EU West' and currencyCode eq 'USD' and serviceName eq 'Virtual Machines' and type eq 'Consumption' and contains(skuName, 'Spot') eq false
The above query works like a charm to filter out the Virtual Machines that contains 'Spot' in the skuName.
Hope this is what you were looking for and if you've already found this answer, let this answer help those who are still in search of it :-)