To run an SSIS package as a different user (e.g. domain\administrator), follow these steps:
USE [master]; CREATE CREDENTIAL [ssis_cred_admin] WITH IDENTITY = N'domain\administrator', SECRET = N'YourDomainPasswordHere';
USE [msdb]; EXEC sp_add_proxy @proxy_name = N'SSIS Proxy Admin', @credential_name = N'ssis_cred_admin';
EXEC sp_grant_proxy_to_subsystem @proxy_name = N'SSIS Proxy Admin', @subsystem_id = 11; -- SSIS
EXEC sp_grant_login_to_proxy @login_name = N'MySqlAgentJobLogin', @proxy_name = N'SSIS Proxy Admin';
Youβre not creating a new user β you're just wrapping sa in a credential and proxy. A credential is a way to associate a username and password with a proxy in SQL Server Agent. Youβre essentially telling SQL Server, βHereβs how to impersonate 'domain\administrator' when needed.β
β
OnError, OnWarning, OnPre/PostExecute, OnTaskFailedC:\SSISLogs\MyJobOutput.txt
dtexec /FILE "path_to_package.dtsx" /DECRYPT password /REPORTING E D I > "C:\SSISLogs\ssis_debug.txt"
| Flag | Meaning |
| ββ | βββββββ- |
| N | Errors only |
| E | Errors + events |
| D | All events |
| I | SQL statements |
| P | Progress |
| V | Version info |
| C | Custom events |
β
β
NT SERVICE\SQLSERVERAGENT does not have access to 'My_Database'
β The job step is likely not using the proxy correctly.
CmdExec job step and dtexec for clearer logs.whoami inside SSIS Script Task to verify run context.β
DROP CREDENTIAL [ssis_cred_admin]; EXEC sp_delete_proxy @proxy_name = N'SSIS Proxy Admin';