5 Automatically scale Azure DTUs on a schedule Shared by Thomas Stephens, Northview Church 2 years ago Operations Intermediate I have been wanting to automate scaling our Azure DTUs up and down for some time now. We use the Standard tier s4. We began to have trouble with some jobs at night. Our DTUs are usually pegged at 100% from 2am to 3:30am when big jobs are running. This hadn't been a problem b/c we don't see much traffic during those hours. But it was causing some jobs to not complete on occasion. We also some some high usage during check-in on the weekend. The goal was to scale up every night for Rock jobs and then scale back down after. Then again on Sunday mornings during check-in.In the past it was doable but a little confusing in my opinion. I found something recently that made it much easier and user friendly.https://www.powershellgallery.com/packages/azure-sql-dtu-scale/1.0The above link goes to a pre-written script that has parameters for Resource Group, SQL Server Name, Database Name, Scale Edition (think Standard), and Scale Tier (s2, s4, s6, etc). It is very easy to setup a schedule and fill out the parameters to use for that schedule.In order to install this script in your Azure account, visit the link above and click on the "Azure Automation" tab and then "Deploy To Azure Automation". you may need to create an Azure Automation Account , but that should be straight forward. I already had one created at the time I installed the above script.One other requirement is your Automation Account have a valid "Run As Account" setup. This is very easy to do. Go to the Automation Account. In the menu there will be an option for "Run As Account". I created both an Azure Run As Account and a Azure Classic Run As Account. I am not sure which one is needed for this to work, I just created both.Next we need to Publish the "Runbook" (the auto scale script). Go to your "azure-sql-dtu-scale" (this is the name it gave when I installed it). When you are on the "Overview" tab, you will see an "Edit" menu option along the top, click it. On the next screen, click the runbook in the left hand side and then Publish along the top.Now you should have everything you need installed and setup. All that is left is to create your schedules. Go to your "azure-sql-dtu-scale". Click Schedules. Click Add Schedule. I first did a test schedule. One that would run in about 15 minutes to make sure everything works before I setup my nightly and Sunday schedules. First you setup your schedule and then it will ask you for the 5 parameters I mentioned above. I recommend testing both the increase and decrease and make sure they work before setting up your daily/weekly schedules.