Skip to main content

Posts

Showing posts from September, 2019

Executing commands and scripts on a VM within the Azure portal

At times you may need to run a script or a command to retrieve resources or create new resources. Rather than having to SSH or RDP into your server, you can easily run these commands or scripts right from the Azure Portal.

Pre-requisites;
1) An Azure account
2) A Linux VM, Windows VM, or preferably both.
3) Knowledge of Bash and PowerShell (I will explain the cmdlets and shell scripts that I'm running)

First thing you want to do is go to your Resource Group within Azure and head over to your VMs.


(For the Linux portion) Click on your Linux and in the left pane scroll down to "Run command".


Once you click on "Run command", you'll see two options. RunShellScript and ifconfig. Choose RunShellScript.



Once you're there, you can run whatever script or bash line you'd like.


Similarly, we can do the same on a Windows machine. If you set up a Windows Server, head over to your Windows Server and find the "Run command" option in the same place as the …