Sql-server – CREATE DATABASE permission denied in database ‘master’ – using Web Deploy, EF Code First, Visual Studio

asp.netsql serversql-server-2008visual studio 2012webdeploy

Visual Studio 2012 Express, EF5, Code First Migrations, Web Publish.

I am doing a web publish from a Windows 8 Laptop to a Windows Server 2008 R2 web server using Web Deploy from Visual Studio 2012.

The files are uploaded fine. But I get this error:
CREATE DATABASE permission denied in database 'master'

When Code first tries to create the database.

The Web Publishing wizard uses a windows user to login – that user has db_owner permissions on the master database.

Exactly what do I need to do to grant CREATE DATABASE permissions? (or see which user tried to do it – the error doesn't report that for some reason?!).

Thanks.

Best Answer

I've just come across this problem and I resolved it following the instructions here. Effectively, the "IIS APPPool\DefaultAppPool" user must first be added. While adding it, ensure that as its "Server Roles" it is a "sysadmin".