liveBook · Manning

##ms_databasemanager##

As explained in 100 SQL Server Mistakes and How to Avoid Them

##MS_DatabaseManager## is a SQL Server 2022 fixed server role that grants permissions for creating and deleting databases.

Mistake: accepting a vendor’s demand for sysadmin access. A backup tool may need the MS_DatabaseManager fixed server role plus db_backupoperator in databases it backs up—not unrestricted access to every instance. section 14.1

Introduced in SQL Server 2022, MS_DatabaseManager grants permission to create and delete databases. Granting less privilege limits the damage from a compromised account and reduces untracked changes that can harm performance or stability. section 14.1

A safer backup configuration

For a backup account, evaluate whether MS_DatabaseManager and db_backupoperator meet the requirement before considering sysadmin. On earlier SQL Server versions, db_creator can be used instead. section 14.1

Apply the least-privilege checklist:

  • Reject blanket sysadmin requests when a fixed server or database role fits. section 14.1
  • Create a custom role when no built-in role supplies the required permissions. section 14.1
Listing 14.1 Creating a custom server role
CREATE SERVER ROLE AvailabilityGroupsFailover ;
GO

ALTER SERVER ROLE AvailabilityGroupsFailover ADD MEMBER [NT 
AUTHORITY\SYSTEM] ;

GRANT ALTER ANY AVAILABILITY GROUP TO AvailabilityGroupsFailover ;

GRANT CONNECT SQL TO AvailabilityGroupsFailover ;

GRANT CREATE AVAILABILITY GROUP TO AvailabilityGroupsFailover ;

GRANT VIEW SERVER STATE TO AvailabilityGroupsFailover ;

Use a custom server role to grant narrowly defined permissions when built-in roles do not fit. section 14.1

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Defines the role and contrasts it with sysadmin, db_creator, and custom roles without detailing membership commands.
Examples
Uses a backup-tool account and a custom availability-groups server-role listing to illustrate constrained access.
What you can do after
Operate/configure by selecting MS_DatabaseManager or a narrower custom role instead of granting unnecessary sysadmin access.
How it connects
Connects database creation with sysadmin, db_creator, db_backupoperator, fixed roles, and custom server roles.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.