You can login to the VMs SSH for Linux, RDP for Windows, and run the commands you shared, or you can use the Windows or Linux Run Command feature to execute the install commands without logging in.
I am including the Linux Run Command instructions below:
Go to a VM in the Azure portal and select Run command in the left menu, under Operations. You see a list of the available commands to run on the VM.
Choose a command to run. Some of the commands might have optional or required input parameters. For those commands, the parameters are presented as text fields for you to provide the input values. For each command, you can view the script that's being run by expanding View script. RunShellScript is different from the other commands, because it allows you to provide your own custom script.
Note
The built-in commands are not editable.
After you choose the command, select Run to run the script. After the script finishes, it returns the output and any errors in the output window. The following screenshot shows an example output from running the ifconfig command.
If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.
If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.
Thank you for helping to improve Microsoft Q&A!