For installing the Microsoft Management Agent (MMA) extension through Azure Policy, you can leverage the built-in Azure Policy definitions.
Here you can find a PowerShell and a Logic App playbook sample which will help you to automate the installation of the MMA.