I been trying to research this for hours and can't seem to find anything. Basically what I am trying to do is run a xp_cmdshell command as a currently signed in sysadmin user
To give some background, I have two accounts here
Now SQL_Service and app_service are both in the sysadmin role. SQL_Service is what SQL Server is running as.
The problem I'm encountering is that when I run xp_cmdshell, it executes as the sql_service user. What I need to do is run this as the app_service as the command I am executing has the folder permissions locked down to app_service user
Here is an example of the code that I have tried to make it run as app_service
Execute as login='DOMAIN\app_service' Exec xp_cmdshell 'whoami'
It keeps returning the sql_service user. From what I am researching, I believe that is intended by design. However, I am trying to run the cmd_shell as the domain\app_service user. This user is a local system admin and in the sysadmin server roles. And I'm running as this user in SQL Server Management Studio and the query is running as this user.
I keep seeing information around in regards to running non sysadmin users with xp_cmdshell. However, I'm not doing that. I'm simply just trying to run under a particular sysadmin user instead of xp_cmdshell running as the sql service username.