1

I'm setting up an Azure VM as a warm backup server for disaster recovery and I'd like to power up and down the VM from the production server automatically a few times a day so some data can be synced. I'm having no problem finding information on how to do it via Azure Automation in questions such as Azure : Script to start or shut down multiple VMs and Microsoft have examples of performing it using Powershell within the Azure platform but I can't find how to do it from a remote machine.

The reason I'd like to initiate it from the production server is that some data updates within SQL/Server should be pushed quickly to the VM so doing it on a strictly time-based schedule isn't ideal. Although maybe I'm thinking about this the wrong way around and instead they'd be a way to use Azure Automation to poll the production server in some way to see if the VM should be started?

1

Azure automation scripts run either on the Azure Automation servers in Azure, or on a local machine if you use a Hybrid worker. Using a Hybrid worker isn't going to solve your problem here, as you still have to call Azure automation to run the script, it just happens to run on the local machine.

For what you are trying to do you have a few options:

  1. Use Azure Automation, have hte production server call it to run the script. This can be done through a webhook that can trigger the automation script.
  2. Run the PowerShell script directly on your production server, you would not use Azure automation at all and just run some Azure PowerShell locally on the machine when required
  3. Still use Azure Automation but have it poll the production server for some indication that it needs to turn on the machine. For this, you would need a hybrid worker running on your network (as normally Azure Automation would have no access to your network). You would generally not want this hybrid worker on the prod server, as if it goes down there will be nothing to trigger the DR machine.

Using Azure Automation has the benefit of providing a central location to run your scripts and the ability to securely store credentials etc. to access Azure, but you would then need something to trigger that run book.

| improve this answer | |
  • Thanks Sam it was option 2 I was thinking initially would be the way to go but things like WinRM that I found appear to run within a VM so I couldn't seem to work out how it could be used to start a VM from a deallocated state? In case I wasn't 100% clear the external production server isn't an Azure machine, it's privately owned infrastructure. – PeterJ Apr 11 '18 at 10:35
  • No need to use WinRM, just use Azure PowerShell running on the prod machine to make the call to Azure to start the machine. You can download and install Azure Powershell here docs.microsoft.com/en-us/powershell/azure/… – Sam Cogan Apr 11 '18 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.