SQL Azure Limit for SharePoint Autohosted App

To find the SQL Azure Edition and its maximum size in the SharePoint Online Autohosted app, firstly we need to get the connection string of the database used by the app by displaying it in an aspx page or more subtly returning it using Web API. Don’t forget that the connection string is defined in the AppSettings, snippet below shows how to get the value from the code.

public string GetConnectionString()
{
   return WebConfigurationManager.AppSettings["SqlAzureConnectionString"];
}

Normally you will get something like below.

Data Source=(a_server).database.windows.net;
Initial Catalog=db_(guid);
User ID=db_(guid_as_above)_dbo;
Password=(some_pwd)

Put this connection string to Visual Studio’s SQL explorer or SQL Management Studio. The User ID won’t have access to master db so that you need to connect directly to the database.
After it gets connected run this below scripts to get the SQL Edition and limit, thanks to¬†Azure How-to talk series’ post

SELECT DATABASEPROPERTYEX('database name', 'EDITION')
SELECT CONVERT(BIGINT,DATABASEPROPERTYEX ( 'database name' , 'MAXSIZEINBYTES'))/1024/1024/1024 AS 'MAXSIZE IN GB'

And the result is Azure Web Edition and Max limit is 1 GB, and unfortunately we can’t change this using ALTER DATABASE command as shown here as we don’t have access to master db. Below is the screen shot from VS 2013′s SQL Server Explorer:

Azure_SQL_Autohosted

P.S. please let me know if there is a way to change the limit :)

Comments are closed.