Execute CmdExec / sp_cmdExec by non-SysAdmin

In SQL Server 2000, a single configuration was available for the SQL Server Agent Proxy account.  With SQL Server 2005, now 11 different proxies are available for each of the SQL Server Agent subsystems.  This offers a great deal of flexibility and greater security for each of these subsystems for logins and roles that do not have administrative rights to SQL Server, but need to manage SQL Server Jobs.

In order to setup the SQL Server Agent Proxy, it depends on an existing credential at the SQL Server level that maps to a Windows domain login in SQL Server.  By default SQL Server does not ship with any predefined credentials, so to set one up in Management Studio for the purposes of SQL Server Agent Proxies, navigate to the root folder| Security folder | Credentials folder | right click on the Credentials folder | select the New Credential option and then enter the name, identity (Windows domain login in SQL Server) and password.

Once the credential is setup, then the SQL Server Agent Proxy must be setup.  This can be achieved by the following steps:

1. In Management Studio, navigate to the Proxies folder and right click to select the New Proxy option.

sqlserveragentproxies.gif

2. General Tab - Specify the following items:
• Proxy name - ProxyCmdExec
• Credential name
• Description
• Subsystem
o Selecting the appropriate subsystem will be important because this proxy name is only available for the selected subsystem.

sqlserveragent_newproxy.gif

3. Principals Tab - From the drop down list, select the Principal type (SQL Login, MSDB role, Server role) and the associated login or role for the Proxy.

Add principle

4. Principal Tab - This will reflect the selections from step 3.

Add principle

5. References Tab - Initially, this tab will not have any data until the Proxy account is specified for specific Job Steps.  Once the proxy account is used in 1 or more Job Steps, this interface can become very handy to see where the Proxy account is used across all Job Steps on a single SQL Server instance.

Add principle

6. Job Step - To specify a Proxy account for a Job Step, simply change the ‘Run as’ parameter to the new Proxy account i.e. ProxyCmdExec as opposed to the ‘SQL  Agent Service Account’ default value.

Add principle

This article was found on http://www.mssqltips.com

Leave a Reply

You must be logged in to post a comment.