Skip to content

Commit

Permalink
POL-727 Azure Savings Plan Utilization v0.1.0 (#1917)
Browse files Browse the repository at this point in the history
* task: pushing initial MVP for Azure SP utilization report

* task: pushing initial MVP for Azure SP utilization report

* update draft policy template to use "List Savings Plans by Billing Account" API as opposed to "List Savings Plans by Billing Benefit" API, add additional fields to incident, enhance detail summary in incident, minor changes to make policy template more consistent with RI counterpart

* add changelog file

* added readme

* minor changes to parameter descriptions in policy template

* renamed `Escalation` section to `Escalations`

* added permission to master permissions list

* minor change to `PolicyActions` in policy readme

* update README and policy template description to implement suggestions from PR review

* update `service` and `policy_set` in policy template metadata info block

* updated label in `param_email` parameter

* implement suggested change to README

* update pt version to `0.1.0`

* added reference in policy incident title to policy template name

* reflected the addition of Flexera credential to readme

* updated policy permissions list to include new flexera credential

* Update README.md

Updated Input Parameters to match parameters in policy template

* Update azure_savings_plan_utilization.pt

For `param_utilization_threshold` parameter - removed `(%)` from `description` and added it to `label`

* Update README.md

Implemented same change in readme

---------

Co-authored-by: Nia Velinor-Fraser <NVelinorFraser@flexera.com>
Co-authored-by: nia-vf1 <92175447+nia-vf1@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 27, 2024
1 parent eafc0ad commit 65a94ff
Show file tree
Hide file tree
Showing 6 changed files with 611 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cost/azure/savings_plan/utilization/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v0.1.0

- Initial release
44 changes: 44 additions & 0 deletions cost/azure/savings_plan/utilization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Azure Savings Plan Utilization

## What It Does

This Policy Template leverages the Azure Billing API ([Savings Plans By Savings Plan Order](https://learn.microsoft.com/en-us/rest/api/billing/savings-plans/list-by-savings-plan-order?view=rest-billing-2024-04-01&tabs=HTTP)) to report on Savings Plan utilization. It will notify only if utilization of a Savings Plan falls below the value specified in the `Maximum Savings Plan Utilization Threshold` field. It examines the Savings Plan utilization for the prior 1 day, 7 days or 30 days in making this determination.

## Input Parameters

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

- *Email Addresses* - Email addresses of the recipients you wish to notify when new incidents are created.
- *Azure Endpoint* - The endpoint to send Azure API requests to. Recommended to leave this at default unless using this policy with Azure China.
- *Look Back Period* - Number of days of prior Azure Savings Plan usage to analyze.
- *Maximum Savings Plan Utilization Threshold (%)* - Show Savings Plans with utilization below this value.

## Policy Actions

The following policy actions are taken on any resources found to be out of compliance.

- Sends an email report

## Prerequisites

This Policy Template uses [Credentials](https://docs.flexera.com/flexera/EN/Automation/ManagingCredentialsExternal.htm) for authenticating to datasources -- in order to apply this policy you must have a Credential registered in the system that is compatible with this policy. If there are no Credentials listed when you apply the policy, please contact your Flexera Org Admin and ask them to register a Credential that is compatible with this policy. The information below should be consulted when creating the credential(s).

### Credential configuration

For administrators [creating and managing credentials](https://docs.flexera.com/flexera/EN/Automation/ManagingCredentialsExternal.htm) to use with this policy, the following information is needed:

- [**Azure Resource Manager Credential**](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm#automationadmin_109256743_1124668) (*provider=azure_rm*) which has the following permissions:
- `Microsoft.Billing/billingAccounts/read`

- [**Flexera Credential**](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) (*provider=flexera*) which has the following roles:
- `billing_center_viewer`

The [Provider-Specific Credentials](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) page in the docs has detailed instructions for setting up Credentials for the most common providers.

## Supported Clouds

- Azure

## Cost

This Policy Template does not incur any cloud costs.
Loading

0 comments on commit 65a94ff

Please sign in to comment.