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 Linux VM.
We'll see a few more options here then we saw in the Linux VM. Let's choose "RunPowerShellScript".
This is quite useful if you need to run a script or a line of code against one machine to ensure something exists or you know you need to install something one time. I wouldn't recommend using this for something like running a script on 5 different machines. This is more for one-off checks/installs.
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 Linux VM.
We'll see a few more options here then we saw in the Linux VM. Let's choose "RunPowerShellScript".
This is quite useful if you need to run a script or a line of code against one machine to ensure something exists or you know you need to install something one time. I wouldn't recommend using this for something like running a script on 5 different machines. This is more for one-off checks/installs.
Comments
Post a Comment