Hi,
Thank you for posting the question to the Q&A forum.
Please check the below link: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command I think this is what you're looking for.
Also depends on the VM if it's Windows or Linux
- Windows: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command
- Linux: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/run-command
I hope the above information can help you.
If the ANSWER is helpful, please click "Accept Answer" and upvote it. Thanks