Monday, May 28, 2018

How to Start/Stop Azure VMs during off-hours

If you host your VM’s on Azure then you need to think about a ways that you can save something form the solutions that you have selected for yourself or the propose solution for the client.

Here I'm talking about large scale server list which is hosted in the Azure.

This solution provides a decentralized automation option for users who want to reduce their costs by using server less, low-cost resources. With this solution, you can:

  • Schedule VMs to start and stop.
  • Auto-stop VMs based on low CPU usage.
  • Schedule VMs to start and stop in ascending order by using Azure Tags (not supported for classic VMs).

Prerequisites,

* VMs need to be in the same Subscription.

* These regions only supported for the time Australia Southeast, Canada Central, Central India, East US, Japan East, Southeast Asia, UK South, and West Europe.

* If you want the email notification to be setup then select Yes to deploy the SendGrid.

          ** SendGrid is a third-party service. 

Limitations with SendGrid are:

  • A maximum of one SendGrid account per user per subscription.
  • A maximum of two SendGrid accounts per subscription.

To deploy the solution you can follow the below steps,

  1. In the Azure portal, click Create a resource.
  2. In the market place page , type the keyword start/Stop and search for “Start/Stop VMs during off-hours [Preview]” resource
  3. Click create.

image

4. then Need to ad the solution, First select the OMS Workspace. If you don't have one create a new OMS Workspace.

image

You can give a name for the Workspace and select the subscription if you have more,

Then Select the Resource Group and the Location(Available locations are Australia Southeast, Canada Central, Central India, East US, Japan East, Southeast Asia, UK South, and West Europe.)

image

5.  Add an Automation Account

Under the Add Solution page, select Automation account. If you are using a  new Log Analytics workspace, then you need create a new Automation account to be associated with it.

Select Create an Automation account, and on the Add Automation account page, provide the following:

Name : Name for the Automation account

All other options are automatically filled based on the Log Analytics Workspace selected. You can’t modify those options.


SNAGHTML5e0dfb22

6. Add a Parameter.

Here you can set the parameters.

Specify the Target ResourceGroup Names. These are resource group names that  contain VMs to be managed by this solution. You can enter more than one name and separate each by using a comma (values are not case-sensitive). Using a wildcard is supported if you want to target VMs in all resource groups in the subscription.


Specify the VM Exclude List (string). This is the name of one or more virtual machines from the target resource group. You can enter more than one name and separate each by using a comma (values are not case-sensitive). Using a wildcard is supported.


Select a Schedule. This is a recurring date and time for starting and stopping the VMs in the target resource groups. By default, the schedule is configured to the UTC time zone. Selecting a different region is not available. To configure the schedule to your specific time zone after configuring the solution, see Modifying the startup and shutdown schedule.
To receive Email notifications from SendGrid, accept the default value of Yes and provide a valid email address.


image

Once click create it will take more than 5 min to complete the task. then you can see the below mentioned dashboard and after few runs you will be able to see the summary of the job which you have created.

image

No comments: