I have Azure policy which refuses to evaluate expression of with error below. I assume the problem is that when you provide tag values in portal they passed as a string to ARM even though integer value is intended passed. Trying to figure out how do I enforce integer value for a tag a result
{
"field": "tags['Longevity']",
"less": 1
}
Error
"The policy assignment 'd9c1d0b06de841559a1cbafe' associated with the policy definition 'dee67dc2-7393-4c02-916f-92511146c970' could not be evaluated.
A 'less' or 'lessOrEquals' or 'greater' or 'greaterOrEquals' expression expects operands of same type for comparison. The supported types are string, integer, float, ISO 8601 datetime. Please either fix the
policy or remove the policy assignment to unblock. See https://aka.ms/policy-conditions for usage details."

I was also able to reproduce the error by providing below format (i.e., "less": 1) in the policy.
I see that the underlying system type of tags is "System.Collections.Generic.Dictionary`2+ValueCollection[System.String,System.String]" so yes, your assumption is correct i.e., when you provide tag values in portal they are passed as string to ARM even though integer value is intended passed.
I have tried below policy to enforce an integer (as string) for a tag value and I believe that it kind of worked (for positive numbers only) because if I have provided
So I believe that eventhough underlying system type of tags is String, numeric string comparison is being done in the backend if we provide "less" as condition
However, if interested, in this Uservoice or feedback forum, you may raise feature request to allow non-string type of tag values.