A fixed server role is a predefined SQL Server server-level role with defined permissions. Treat membership as a security decision, not a convenience setting. section 14.1
Mistake: granting sysadmin because a task sounds administrative.
- The sysadmin fixed server role provides full access to the instance, allowing its members to do anything. section 14.1
- An application team may request sysadmin merely to create and delete databases on a nonproduction server. section 14.1
- A vendor account with sysadmin on every instance creates a major security hole: compromise could expose organizational data. section 14.1
- Apply least privilege: grant only the permissions required for the task, temporarily adding and then revoking extra access. 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 when a narrowly defined operational task needs server-level permissions without full sysadmin access. section 14.1
