Only the attributes listed here are supported for dynamic membership rules: https://learn.microsoft.com/en-us/azure/active-directory/users-groups-roles/groups-dynamic-membership#rules-for-devices
You cannot just use other "random" attributes, even if they seem to fit your scenario.