I have a stored procedure in Database 1
that updates couple of tables in Database 1
and Database 2
To avoid granting calling login/user permissions to do table updates, I try to use code signing
Created certificate in the master
database, and created login from this certificate
Then I've created users for this certificate-mapped login, in Database 1
and Database 2
, and granted them permissions to do table updates
When I tried to run below T-SQL:
use [Database 1]
add signature to MyProcedure
by certificate MyCertificate
It throws error:
Msg 15151, Level 16, State 1, Line 168 Cannot find the certificate 'MyCertificate', because it does not exist or you do not have permission.
Then I try
use [master]
add signature to [Database1].[dbo].MyProcedure
by certificate MyCertificate
I am in a sysadmin server role, but it throws:
Msg 15151, Level 16, State 1, Line 168 Cannot alter the object 'Database1.dbo.MyProcedure', because it does not exist or you do not have permission.
Question:
How can I properly add signature to my stored procedure in Database 1
, by certificate that is in the master
database ?