Cannot find an asymmetric key - because it does not exist or you do not have permission

I am trying to run DLL.Net through SQL using the CLR - I am doing this unsuccessfully.

I follow the instructions here

So, I do the following:

CREATE ASYMMETRIC KEY AKEY_SqlClr FROM EXECUTABLE FILE = 'C:\dlls\mySqlClr.dll' 

Which works fine and creates the key, I'm trying to do the following:

 CREATE LOGIN SQLCLR_AsymKeyLogin FROM ASYMMETRIC KEY AKEY_SqlClr 

And I get the error message:

The asymmetric key "AKEY_SqlClr" cannot be found because it does not exist or you do not have permission.

How was I not entitled to it? I have confirmed that I have CREATE LOGIN permissions. Any ideas?

+7
source share
1 answer

Logins are server principles, and therefore they cannot be created from keys stored in user databases. You must create a key from the assembly in the master database:

 use master; CREATE ASYMMETRIC KEY AKEY_SqlClr FROM EXECUTABLE FILE = 'C:\dlls\mySqlClr.dll'; CREATE LOGIN SQLCLR_AsymKeyLogin FROM ASYMMETRIC KEY AKEY_SqlClr; 
+9
source

All Articles