Search code examples
sql-serverentity-frameworksql-server-2008ef-code-firstentity-framework-migrations

Entity framework code first migrations, sql user permissions?


What is the minimal permission needed on a sql server user/login for it to be able to run entity framework code first database migrations?

I naively would have thought that a user with the roles db_datareader, db_datawriter, Grant Alter on the Schema and Grant Create Table would be permissive enough.


Solution

  • On-Prem: SQL server with AD/sql login

    you need the following permissions on the database.

    [db_datareader]
    [db_datawriter]
    [db_ddladmin]
    

    For full control over database use

    [db_owner]
    

    Azure Could: Azure SQL with ADD (Edit)

    Please add [dbmanager] to master and user database.