i have this problem where i am completly stuck.
i need to create a proxy account to run a powershell and it seems like all created but it fails with the following message and i can't find an answer.
Executed as user: domain\sqldbpurge. The process could not be created for step 1 of job 0xA344D33E0C443347ABD25298474E653E (reason: A required privilege is not held by the client). The step failed.
At this point i have no idea what i am missing. Is this error from an operating system or this problem is coming from sql?
These are the steps i did:
1) Created domain\sqldbpurge account and added following permissions:
Log on as a service
Log on as a batch job
Replace a process-level token
Bypass traverse checking
Adjust memory quotas for a process
2) Creating a credential to be used by PowerShell proxy
--Drop the credential if it is already existing
IF EXISTS (SELECT 1 FROM sys.credentials WHERE name = N'PowerShellProxyCredentials')
DROP CREDENTIAL [PowerShellProxyCredentials]
CREATE CREDENTIAL [PowerShellProxyCredentials]
WITH IDENTITY = N'domain\sqldbpurge',
SECRET = N'password'
-- Drop the proxy if it's already existing
IF EXISTS (SELECT 1 FROM msdb.dbo.sysproxies WHERE name = N'PowerShellProxy')
EXEC dbo.sp_delete_proxy @proxy_name = N'PowerShellProxy'
-- Add the proxy
EXEC msdb.dbo.sp_add_proxy @proxy_name=N'PowerShellProxy',
@description=N'PowerShellProxy - Access to the PowerShell'
-- Grant proxy account to SQL Server Agent Sub-systems (In this case subsystem_id = 12 is PowerShell).
-- You can find the subsystem_id by running this (use msdb go EXEC sp_enum_sqlagent_subsystems)
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'PowerShellProxy', @subsystem_id=12
--View all the proxies granted to all the subsystems
-- Grant proxy access to security prin***ls
EXEC msdb.dbo.sp_grant_login_to_proxy @proxy_name=N'PowerShellProxy', @login_name=N'domain\sqldbpurge'
-- View all the logins/roles who have access to the proxies