Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (33 sloc) 3.3 KB

Azure Instances Utilization from Log Analytics

What it does

This Policy Template uses performance metrics from Log Analytics from the last 30 days to identify underutilized instances. This is meant to be run as a weekly policy.


  • Azure Service Principal (AKA Azure Active Directory Application) with the appropriate permissions to manage resources in the target subscription.
    • In addition, the Service Principal will need the Log Analytics Reader role on all Log Analytics Workspaces the VMs in the subscription are sending performance metrics to.
  • The following RightScale Credentials:
  • Virtual Machines with the Log Analytics/OMS Agent installed and sending performance metrics to a Azure Log Analytics workspace.


  1. Follow steps to Create an Azure Active Directory Application
  2. Grant the Azure AD Application access to the necessary subscription(s)
  3. Retrieve the Application ID & Authentication Key
  4. Create RightScale Credentials with values that match the Application ID (Credential name: AZURE_APPLICATION_ID) & Authentication Key (Credential name: AZURE_APPLICATION_KEY)
  5. Retrieve your Tenant ID

Functional Details

  • This policy identifies all instances reporting performance metrics to Log Analytics whose CPU or Memory utilization is below the thresholds set in the Average used memory percentage and Average used CPU percentage parameters.
  • The Exclusion Tag Key parameter is a string value. Supply the Tag Key only. Tag Values are not analyzed and therefore are not need. If the exclusion tag key is used on an Instance, that Instance is presumed to be exempt from this policy.
  • This policy sets the tag defined in the Action Tag Key:Value parameter on the underutilized instances that were identified.

Input Parameters

This policy has the following input parameters required when launching the policy.

  • Azure AD Tenant ID - the Azure AD Tenant ID used for the Azure API Authentication
  • Azure Subscription ID - the Azure Subscription ID used for the Azure API Authentication
  • Average used memory percentage - Utilization below this percentage will raise an incident to tag the instance. Providing -1 will turn off this metric for consideration.
  • Average used CPU percentage - Utilization below this percentage will raise an incident to tag the instance. Providing -1 will turn off this metric for consideration.
  • Exclusion Tag Key - An Azure-native instance tag to ignore instances that you don't want to consider for downsizing. Only supply the tag key
  • Action Tag Key:Value - The tag key:value pair to set on an instance that is underutilized.
  • Email addresses of the recipients you wish to notify - A list of email addresses to notify

Supported Clouds

  • Azure Resource Manager


This Policy Template does not incur any cloud costs.

You can’t perform that action at this time.