Azure database ‘xxx’ has reached its size quota

I keep bumping in to this issue so I thought I’d post my steps to resolution. When you create an Azure SQL database, it sets a size limit for the database. When the database fills up, you’ll get an error like this:

The database ‘XXX’ has reached its size quota. Partition or delete data, drop indexes, or consult the documentation for possible resolutions.

The fix requires 2 steps: First you need to increase the database size in the Azure portal but then secondly you need to alter your database in SQL.

  1. Login to the Azure Management Portal and go to your SQL Database.
  2. On the Dashboard tab, you should see that the size of your database is 100% of your total in the Usage Overview.
  3. Click on the Scale tab and change the Max Size and click Save.

 

That fixes the Azure max size limit, but now we need to update our SQL database itself.

  1. Fire up SQL Management Studio and connect to your Azure SQL Server.
  2. On your database, open a New Query.
  3. Run this query replacing YOURDATABASE with the name of your database in both locations.

SELECT DATABASEPROPERTYEX('[YOURDATABASE]', 'EDITION') as Edition, CONVERT(BIGINT,DATABASEPROPERTYEX ( '[YOURDATABASE]' , 'MAXSIZEINBYTES'))/1024/1024/1024 AS 'Max Size IN GB'

  1. This shows you your Azure Database Edition and your current Max Size.  Now go run this query on the MASTER database changing the Database Name, Edition and Maxsize values as needed.

ALTER DATABASE [YOURDATABASE] MODIFY (EDITION='Standard', MAXSIZE=40GB)

Hit refresh on your site and it should now come up without error.