Sample Header Ad - 728x90

SQL Server - Add signature to stored procedure by certificate does not work

0 votes
1 answer
1262 views
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 would like 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 ?
Asked by Aleksey Vitsko (6195 rep)
Mar 6, 2020, 12:51 PM
Last activity: Oct 12, 2023, 11:48 AM