Hi,
I think the problem is that the portal creates the rule for Log Alert v1 and the template uses Log Alert v2. My suggestion is to look at the doc samples and try to create the alert directly from code without creating something first in portal and than exporting it as ARM Template otherwise you will get undesired results. Also I would advise you to look at the main components of Log alert as for me having order by and take in query for alert does not make sense at all.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.