145

Is there any way to stop a SQL Azure DB so that it doesn't charge anything towards our account? I don't want to delete it, just while in testing and it's not being used than we set it to "stopped" like we can do with websites, cloud services, and VMs.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Matt
  • 3,305
  • 11
  • 54
  • 98

12 Answers12

170

As of July 4th, 2023, The answer is No.

They won't allow it. So the billing will continue for your Azure Database starting the day you create it. There really is no way to pause / stop billing for your Azure SQL Database.

Official Source: feedback.azure.com Please add ability to temporarily turn off/on SQL Azure server to pause billing

Microsoft's official answer appears to be "Yes, you can export your database. Delete the Azure SQL database and that will pause billing. Then when you need it you can create a new database and import your previously expored DB."

I don't believe this is acceptable as an answer for "Allow me to temporarily turn off SQL Server to save on my billing"

enter image description here

Shiva
  • 20,575
  • 14
  • 82
  • 112
  • As of today, it appears that the best solution is to "pause" the VM that SQL Server is installed on, right? – JoshYates1980 May 25 '18 at 16:12
  • 12
    No. What if you are just renting a SQL Server instance, and not an entire VM? You can't "Pause" a SQL Server. That's what the connect ticket and this question is for. – Shiva May 25 '18 at 18:40
  • 9
    Thanks for updating your answer every couple of days! – Zenuka Dec 19 '18 at 09:26
  • 7
    It is a shame. Thanks for your awnser, direct and clear. – Striter Alfa Jan 26 '19 at 01:59
  • 2
    Probably worth updating this as of May 2019 you now have an option for this using the 'serverless' tier of Azure SQL DB. Details here: https://learn.microsoft.com/en-au/azure/sql-database/sql-database-serverless#what-is-the-serverless-compute-tier – Simon W Jun 07 '19 at 07:00
  • @SimonW Per your link, they only let you stop the DB, and still charge for disk space. From the Pricing section => `Only storage is billed while the database is paused.` Whereas OP wants it to not charge for anything if DB is not in use... – Shiva Jun 09 '19 at 23:56
  • 1
    Fair enough, but zero cost isn't going to happen. When you stop a VM in Azure you are still paying for storage for the VM disks, and there is no zero cost stop function for Azure App Service (including Websites) as the underlying App Service Plan continues to bill you. – Simon W Jun 17 '19 at 13:10
  • 3
    Serverless exists as an option. When you pause a vm hosting Sql server you still pay for disk space. This matches what serverless does in sql azure. – Conor Cunningham MSFT Nov 28 '19 at 01:42
  • Corrected, explicitly mentioning Azure SQL Serverless – mauridb Nov 16 '20 at 17:16
28

This is not an option today - the only choice you have is to reduce the size of the Azure SQL Database which will reduce the cost from the next hour of service. If you really don't want to pay for the DB you could backup the DB to blob storage, delete the database and then restore when required. You could orchestrate this using PowerShell or similar.

Update May 2019: There is a new Azure SQL Database "Serverless" tier coming that might meet some of the requirements around reducing costs by not billing when not in use. Official documentation is available to read.

Simon W
  • 5,481
  • 3
  • 24
  • 35
  • 4
    It looks that it is still accurate as of today. I don't see the option anywhere and Google confirms the same. – leeman24 Feb 13 '17 at 23:25
13

The Azure SQL Database team is happy to announce that there is now an option that may address your request. We just announced a "serverless" option for Azure SQL DB that will pause your database when it is not in use. You can read more about the feature here: SQL Database Serverless

Conor Cunningham MSFT
  • 4,151
  • 1
  • 15
  • 21
  • 2
    It does not seem that the "Auto Pause" feature works. I have a Serverless Database. The "Enable auto-pause" checkbox is set and the time period is set to 1 hour. I have just got back from the long holidays and noticed that SQL Database consumed the vCores seconds all these days. No requests were made, the app which uses this DB was not active. The chart on the Overview page shows a constant CPU usage ~ 0.007%. I have no idea how to prevent it from consuming CPU while it is idle. – Andrew Simontsev Jan 04 '20 at 05:31
  • After additional research and this thread: https://stackoverflow.com/questions/57909700/azure-sql-serverless-tier-never-shuts-down I have found out that the problem is on the application level. Sorry for a false alarm. – Andrew Simontsev Jan 04 '20 at 09:44
  • 5
    Be aware that the basic serverless option is more expensive (per second) than the comparable "provisioned" server, and *dramatically* more than the _Standard_ and _Basic_ options. For instance, the cheapest "serverless" option, were it to run full time, will cost $425/month. If you have a database that only needs to be online for a few minutes a month—as I do—that's fine. If you'd otherwise be using the comparable _General Purpose_ provisioned database, but expect it to run less than 90% of the time on average, that's also fine. In other scenarios, though, it can be quite expensive. – Jeremy Caney Aug 14 '20 at 23:29
  • 3
    So, for a development database, the _Basic_ database will cost you $5/month. With the serverless database, you get eight hours for the same price. If you're not actively developing against the database, and only need it on occasion for e.g. testing a hotfix as part of sustained maintenance, that's probably fine. But if you're actively developing against it, it's going to be **much** more expensive than a _Basic_ database, unless you'd otherwise need a lot of DTUs for your development database. – Jeremy Caney Aug 14 '20 at 23:36
10

The databases get backed up automatically just before a drop. so, you can just drop it when you dont need it and restore it when needed. Restores will take some time depending on the database size and how much log you generated, so it wont be fast for large databases.

Also, there is an expiration policy on how long the backups are retained (depends on the service tier) so just watch out for that.

https://msdn.microsoft.com/en-us/library/azure/jj650016.aspx

Hari Krishna S
  • 127
  • 1
  • 5
4

Agree with @Shiva answer. But if you are simply trying out SQL Server on an Azure VM, you would not want to incur charges by accidentally leaving it running over the weekend or weeks. One solution is to use Automatic Shutdown Feature.

enter image description here

Sami
  • 3,686
  • 4
  • 17
  • 28
3

This is now possible and the preview feature is public. Azure SQL Database serverless

https://learn.microsoft.com/en-us/azure/sql-database/sql-database-serverless

Pwd9000
  • 132
  • 8
  • The serverless option provides great flexibility and does not bill unless it is actually getting used. This is great for databases that get low usage over time. The startup time after it goes into standby is a factor to take into account however. For Developmental purposes, this is excellent however. – Greg Gum Feb 09 '20 at 19:01
2

Whereas, at this low scale (scale down requirement (pause) rather than scale up), SQL running within a VM might be a better answer for you...

simon
  • 21
  • 1
1

As is it is not supported however there are a few work arounds. It really depends upon how long you want to stop it and how immediately you want it and the size of the database. If it is for a couple hours then it may not worth it because the billing is hourly and you may have round off issues. If days then you can drop it and restore when needed. If weeks then exporting the database and importing when needed is another option. Also you may want to check backup strategy for the edition you choose before preferring export / restore. The other thing to note is the immediate need vs planned. If immediate, and the db is big then make sure the SLAs in place works for you

Sirisha Chamarthi
  • 1,283
  • 12
  • 16
1

You could export the database to Azure storage and Import it when you want to re-enable it, as suggested here:

Temporarily turn off on sql

noelicus
  • 14,468
  • 3
  • 92
  • 111
1

Elastic Pool
If you have more than one database you can use the Elastic Pool option to bring your total cost down.

Others also mention the option to Drop your database, and rely on restore. That will also work, if you do not leave it deleted for too long...

Henrik Staun Poulsen
  • 13,154
  • 4
  • 23
  • 26
1

Here's what I did with my Azure database (4/20/19)

I scaled the database DTUs as low as possible while still reserving up to 250GB, which turns out to be 10 DTUs with an estimated cost of 1.50 per DTU (estimated at $15 per month). To me, that's almost as good as turning it off and on. I can scale it up to 100 DTUs when I want to get more processing and scale it down when I don't. Even at 100 DTUs for a whole month, the cost was only $75.93 last month on my test database.

NOTE: I am NOT using a VM to run a database, just the standard SQL server you get when you create a database in Azure.

Daniel
  • 67
  • 2
1

Yes you can, with Azure Serverless SQL Database. While your compute resources will be suspended when the database is not in use, you'll definitely save the costs for compute resources, however the billing will continue for storage resources. You can set the inactive timeout for the database after which the compute resources will be suspended. This timeout can be as low as 1 hour.

Read this: https://azure.microsoft.com/en-in/updates/update-to-azure-sql-database-serverless-providing-even-greater-price-optimization/