Control: Long running SQL databases should have reserved capacity purchased for them
Description
Purchasing reserved capacity for long running SQL databases provides significant discounts.
Usage
Run the control in your terminal:
powerpipe control run azure_thrifty.control.sql_database_long_running_reserved_capacitySnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_thrifty.control.sql_database_long_running_reserved_capacity --shareSteampipe Tables
SQL
select  db.id as resource,  case    when date_part('day', now() - creation_date) > $1 then 'alarm'    when date_part('day', now() - creation_date) > $2 then 'info'    else 'ok'  end as status,  db.title || ' has been in use for ' || date_part('day', now() - creation_date) || ' day(s).'  as reason    , db.resource_group  , display_name as subscriptionfrom  azure_sql_database as db,  azure_subscription as subwhere  db.name != 'master'  and db.subscription_id = sub.subscription_id;
Params
| Args | Name | Default | Description | Variable | 
|---|---|---|---|---|
| $1 | sql_database_age_max_days |  | The maximum number of days databases are allowed to run. | |
| $2 | sql_database_age_warning_days |  | The number of days databases can be running before sending a warning. |