Azure Auto-Scale Database

You have several options like Alberto mentioned you can use REST API and Of course azure run-books/webhooks to configure the alert rules.

Let me explain my process here.

  1. Deploy the azure run-books for the changing the performance tier in AzureAutomation -Try this
  2. Create some webhooks for triggering your run-books anytime -Webhooks for Azure runbook
  3. From your SQL DB, create an alert rule with the condition when DTU used greater than or equal to some value (say 1600) the call the corresponding webhook to change the tier dynamically.

enter image description here


You can test if resource consumption fits the resource limits as shown below:

SELECT
(COUNT(end_time) - SUM(CASE WHEN avg_cpu_percent > 80 THEN 1 ELSE 0 END) * ,(COUNT(end_time) - SUM(CASE WHEN avg_log_write_percent > 80 THEN 1 ELSE 0 END),
(COUNT(end_time) - SUM(CASE WHEN avg_data_io_percent > 80 THEN 1 ELSE 0 END FROM sys.dm_db_resource_stats

service level objective (SLO) of 99.9% <= go to next tier

If SLO of 99.9%, you can then scale up the tier from your application using REST API or T-SQL.

ALTER DATABASE [db1] MODIFY (EDITION = 'Premium', MAXSIZE = 1024 GB, SERVICE_OBJECTIVE = 'P15');