Access to the remote server is denied because the current security context is not trusted in SQL Server agent job

sql-server

Solution

If this is calling a linked server, this worked for me in a similar situation:

- Give ownership of the job to the linked server user (the one that you are using to connect to other server).

- In the job, inside each step, go to "Advanced" tab and verify that the "Run as user" field is blank.

- If the Stored Procedure the Job Runs is using "Execute as Owner", you may also get that error. Depending on how your permissions are set up, removing the "execute as owner" will resolve this issue.

Problem

I've a SQL Server Agent Job set up and this job calls a query. When I run the query in SQL Server Management Studio, it works just fine. But when I call it automatically through the job, it gives the following error. Access to the remote server is denied because the current security context is not trusted Please help me out

Original source