I'm trying to filter the devices on my IoT Hub, I need to get only devices that starts with specific Mac Address.
This is the query I'm trying:
SELECT * FROM devices where starts_with(deviceId, 'D8B0')
But I'm getting
Internal Server Error
I also tried:
SELECT * FROM devices where index_of(deviceId, 'D8B0') = 0
With same results
I tried from the Query Explorer on the Azure Portal, Postman and .Net SDK
I'm afraid you cannot achieve what you're looking for using a query. As per the documentation, "when querying twins and jobs the only supported function is: IS_DEFINED(property)
"
You can however use the starts_with()
operator in your routing rule, so maybe that will do the trick for you. If not, you may want to add a specific tag to your device twins to indicate their 'type' as per your rule on MAC address prefix.