How to start and stop VM using powershell from a web page?

Category: azure scripting and command line tools


devops_sl on Thu, 21 Jul 2016 07:57:04

Hi there

We have a requirement to start and stop VM [after 2 hours of usage] using powershell from a web page

I've used a powershell scripts to just start and stop VM in the azure portal. The idea is for the customers via website access the demo platform and it automatically turns off after 2 hours

Please let know me if its possible and if so how it can be done?




SadiqhAhmed-MSFT on Thu, 21 Jul 2016 16:20:54

Hi Sathish,

Thank you for reaching out to us!

You can use Azure Automation, provides an easy way to run PowerShell workflows in Azure and with the Azure AD integration, this is now easier than ever to use.

In this walkthrough a new Azure Automation account will be created, a securely stored Azure AD credential created, two runbooks (PowerShell workflows) authored to stop/start your VM, and then assigning a schedule to run them at required times.

More details on this page.

Also, check this link -

Hope that helps!

Best Regards

Sadiqh Ahmed

If this post was helpful to you, please upvote it and/or mark it as an answer so others can more easily find it in the future.

Disclaimer: This response contains a reference to a third party World Wide Web site.
Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.