The only way with Azure to run a command remotely on a Virtual Machine is to use the Custom Script Extension. You will need to include any monitoring & reporting within the script.
This question is really more of a question for the OS that you are going to run the script on, and you might have more success doing this outside of the custom script extension by going to the VM directly.
As an example, here is a Linux custom script extension in the python SDK. Depending upon the level of monitoring / reporting needed, it might be best to do this on the VM directly, or create a callback for when the command finishes.