How to set up auto start-up and shutdown of VM’s using Start/Stop VMs during off-hours – V2

  1. Head over to this link https://github.com/microsoft/startstopv2-deployments/blob/main/README.md
  2. Once the github page opens up, click on Deploy to Azure.

  3. It would take you to the Azure Portal, sign in if prompted. (Make sure you are signed in with the account in which you are an owner to the subscription in which you want to deploy).
  4. Once you are in the portal, Click on create on Start/Stop VM’s during off hours -V2.

  5. Once you click on create, it would take you to the page where you can create this Azure Application.
  6. Specify the Subscription, and fill out the Instance details. Once you are done, click on review and create.

  7. Once you click on Create, it will start the deployment. Wait for the deployment to be done. Once it is complete, click on go to subscription.

  8. Then use the left navigation and go into resource groups, over there you would see the newly created resource group.

  9. Click on the newly created resource group. You would be able to see all the resources created within that group.

  10. Scroll down to find the Logic Apps. To set up auto start up and shut down, you would have to configure two Logic Apps, which would be the Scheduled Start and Scheduled Stop.

  11. First lets set up Auto Shutdown, open the Scheduled Stop Logic App. Then on the left navigation, open Logic App Designer. And then open Recurrence by clicking on it.

  12. Once you click on Recurrence, you would need to configure the times on which you want the VM to Stop or Shut down. If you want it to be everyday, leave the interval to 1. Now where it says at these hours, you can put in all the hours you want the VM to stop, and lastly set the minutes. It would also show you a preview of the settings you have set.

  13. Then close Recurrence by clicking on it and then move to Function-Try. And in Function-Try, click on Scheduled.

  14. In the request Body, modify the Subscription ID and Resource Group Name.


{

"Action": "stop",

"EnableClassic": false,

"RequestScopes": {

"Subscriptions": [

"/subscriptions/YOUR-SUBSCRIPTION-ID/"

],

"ResourceGroups": [

"/subscriptions/*YOUR-SUBSCRIPTION-ID*/resourceGroups/*NAME*/"


]


}

}




In the YOUR-SUBSCRIPTION-ID, you have to put in your Subscription ID

In the NAME, you have to put in the name of the Resource Group where the VM is stored.


15. Once you have modified the request body, Click on Save.

16. Once you have saved, go back to the overview page to enable this Logic App.

17. Now when the time that you have specified comes, this logic app will run a trigger and the VM in the resource account would be turned off.

You would have to repeat all the steps in Scheduled Start as well to configure the start-up, all the steps are same. Except in Function-Try, the request body would be as follows:


{

"Action": "start",

"EnableClassic": false,

"RequestScopes": {

"Subscriptions": [

"/subscriptions/YOUR-SUBSCRIPTION-ID/"

],

"ResourceGroups": [

"/subscriptions/*YOUR-SUBSCRIPTION-ID*/resourceGroups/*NAME*/"


]


}

}



18. Just the action in the body would be changed to start, rest all will remain the same. Once you have configured the Recurrence in the Scheduled Start, it will turn on the VM at the time you specified.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us