6
votes

We are creating a multi-tenant application and hosting it on Window Azure IaaS platform. We want to provision and configure all our virtual machines remotely using PowerShell. We don't want to RDP into VMs for any configuration.

Does Azure VMs support start up tasks to execute power shell scripts similar to Web-Role and Worker-Role?

If no, then are there any alternatives available (tools like PsExec) which can help in executing start-up scripts?

1

1 Answers

10
votes

Your VM's are just virtualized Windows/Linux machines and this support start-up tasks as per usual.

For Windows VM's, you'll need to:

  1. Download the base Azure Windows Server guest VM.
  2. Customize the machine's startup process to execute a startup script.
  3. Push your customized VM back up into Azure.
  4. Configure Azure to start your customized VM.

Note: You can also access PowerShell on a remote VM using PowerShell remoting in a similar manner to how one uses SSH to access the console of a remote [LI|U]N[U|I]X box/VM.

FWIW, Git is a great tool to use to pull down and execute a VM config script: Your on-VM startup script can use Chocolatey to install the latest version of GIT (if it's not already installed) and then use Git to pull down the latest version of your startup script from GitHub/similar and execute it. This way you don't need to continually rebuild VM images every time your scripts change.