Forum Discussion
Can I use "not" filters in Azure Pricing API
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
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 :-)