We moved our application over from 2008R2.... set up the sysadmin Active Directory group.. but the below code no longer works.
I even commented out the sp_delete_job and had it do a simple select..
ALTER PROCEDURE [dbo].[DeleteJob]
WITH EXECUTE AS 'Domain\DB' --This needs to be uncommented and a proper sysadmin user added that is a dbo in msdb.
select * from msdb.dbo.sysjobs
---- exec msdb.dbo.sp_delete_job @job_name = @name
What I get is :
Msg 229, Level 14, State 5, Procedure DeleteJob, Line 166
The SELECT permission was denied on the object 'sysjobs', database 'msdb', schema 'dbo'.
However when I go into msdb and run the select.. it works... and I am part of Domain\DB