'Access permission sp_configure and reconfigure statement?

I'm trying to enable xp_cmdshell on SQL Server by using this query:

sp_configure 'show advanced options', '1'
RECONFIGURE
GO
sp_configure 'xp_cmdshell', '1'
RECONFIGURE

But I'm getting error like this:

Msg 15247, Level 16, State 1, Procedure sp_configure, Line 105 [Batch Start Line 0]
User does not have permission to perform this action.
Msg 5812, Level 14, State 1, Line 3
You do not have permission to run the RECONFIGURE statement.
Msg 15123, Level 16, State 1, Procedure sp_configure, Line 62 [Batch Start Line 4]
The configuration option 'xp_cmdshell' does not exist, or it may be an advanced option.
Msg 5812, Level 14, State 1, Line 6
You do not have permission to run the RECONFIGURE statement.

Can anyone help me?



Solution 1:[1]

From the permissions hierarchy poster:

enter image description here

The execution of sp_configure and RECONFIGURE is granted by the ALTER SETTINGS permission. And from the docs:

The sysadmin and serveradmin fixed server roles implicitly hold this permission.

So, you need to GRANT this permission to your user or to make it member of sysadmin or serveradmin roles.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TylerH