On a SQL 2014 SP 1 instance a SQL Agent job I'm using xp_cmdshell to return a list of files from a network share. This has recently stopped working and returns "Access is denied."
The command is EXEC master..xp_cmdshell 'DIR "\\backups\marshall\master" /A:-D /S /B'
The command will work for a local folder.EXEC master..xp_cmdshell 'DIR "C:\Temp" /A:-D /S /B'
Running EXEC master..xp_cmdshell 'whoami'
returns the Windows account that is used for the SQL Engine and SQL Agent. This account has Full Control for the backup folder. I've deleted and re-added permissions for this account. I can manually add and delete files from this folder.
I will be changing the process to no longer use xp_cmdshell, but can't do that today. Any ideas on what is going wrong?
Best Answer
Create a proxy account to run xp_cmdshell and give the proxy access to your share.
Link