Our database has a named database role. Our service account is a member of this role. This makes our database creation scripts simpler.
However, I'd like this role to be able to create linked servers.
If I try the following:
USE OurDatabase
GO
GRANT ALTER ANY LINKED SERVER TO OurRole
GO
...it fails with Permissions at the server scope can only be granted when the current database is master
.
If I try the opposite:
USE [master]
GO
GRANT ALTER ANY LINKED SERVER TO OurRole
GO
...then it fails with Cannot find the login 'OurRole', because it does not exist or you do not have permission.
How do I grant linked server permissions to a database role in SQL Server?