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