Hi,
You can't, you can get the token for the VM inside the VM and use that to authenticate and work with Azure services, but you can't use a Managed Identity to install applications on virtual machines; for that, you will need to leverage a local account.
If you use the Hybrid worker, in Azure Automation, it will run under a System account, otherwise you need to specify the credentials to an account.