Search code examples
encryptionssissftpsql-agent

SSIS step to PGP file fails in agent


I have created a txt file from our source databases to be sent externally via SFTP, so needs to be encrypted. I have 2 script tasks using C# in the SSIS package that encrypts and SFTP's; the first step uses Gpg4win to encrypt the file and the second step picks up the encrypted file and using WinSCP sends the file via SFTP to our external partner. This package runs fine within Visual Studio, once deployed to the catalog and I schedule the job it succeeds although the file does not encrypt or SFTP. The Owner of the job in the agent has full permissions of the folder where the file is. Has anyone else come across something similar to this?


Solution

  • The Owner of the job in the agent has full permissions of the folder where the file is.

    The Owner of a SQL Job is not the account used to 'run' the job. You need to set the 'Run As' property. And to do that you need to set up a Sql Server Agent Proxy (and probably a Credential too).

    See: https://learn.microsoft.com/en-us/sql/ssms/agent/create-a-sql-server-agent-proxy