Skip to content

Commit d49d464

Browse files
added content from KB how to solve issues with Permissions
1 parent 3dd1bdc commit d49d464

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

docs/relational-databases/security/using-service-sids-to-grant-permissions-to-services-in-sql-server.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,32 @@ GRANT VIEW SERVER STATE TO [NT SERVICE\ClusSvc]
9797
GO
9898
```
9999

100+
> [!NOTE]
101+
> Removing the service SID logins or removing them from the sysadmin server role can cause problems for various components of SQL Server that connect to the SQL Server Database Engine. Some problems include the following:
102+
> - SQL Server Agent cannot start or connect to a SQL Server service
103+
> - SQL Server Setup programs encounter the problem that is mentioned in the following Microsoft Knowledge Base article:
104+
> https://support.microsoft.com/en-us/help/955813/you-may-be-unable-to-restart-the-sql-server-agent-service-after-you-re
105+
>
106+
> For a default instance of SQL Server, you can correct this situation by adding the service SID using the following Transact-SQL commands:
107+
> CREATE LOGIN [NT SERVICE\MSSQLSERVER] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
108+
> GO
109+
> ALTER ROLE sysadmin ADD MEMBER [NT SERVICE\MSSQLSERVER]
110+
> GO
111+
> CREATE LOGIN [NT SERVICE\SQLSERVERAGENT] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
112+
> GO
113+
> ALTER ROLE sysadmin ADD MEMBER [NT SERVICE\SQLSERVERAGENT]
114+
> GO
115+
> For a named instance of SQL Server, use the following Transact-SQL commands:
116+
> CREATE LOGIN [NT SERVICE\MSSQL$SQL2019] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
117+
> GO
118+
> ALTER ROLE sysadmin ADD MEMBER [NT SERVICE\MSSQL$SQL2019]
119+
> GO
120+
> CREATE LOGIN [NT SERVICE\SQLAgent$SQL2019] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
121+
> GO
122+
> ALTER ROLE sysadmin ADD MEMBER [NT SERVICE\SQLAgent$SQL2019]
123+
> GO
124+
> Note In this example, SQL2019 is the instance name of the SQL Server.
125+
100126
## Next steps
101127

102128
For more information about the service sid structure, read [SERVICE_SID_INFO structure](/windows/win32/api/winsvc/ns-winsvc-service_sid_info).
@@ -106,3 +132,5 @@ Read about additional options that are available when [creating a login](/sql/t-
106132
To use Role-Based Security with Service SIDs, read about [creating roles](/sql/t-sql/statements/create-role-transact-sql) in SQL Server.
107133

108134
Read about different ways to [grant permissions](/sql/t-sql/statements/grant-transact-sql) to Service SIDs in SQL Server.
135+
136+

0 commit comments

Comments
 (0)