Problem
Ideally your SQL instance would be configured to only allow for Windows Authentication. There may be times when mixed mode authentication is necessary at which point you will should configure a method to rotate the ‘sa’ password on a regular basis. You want the new password to be random and secure from others. Not only do you not want anyone else to know the password, you don’t even want to know it yourself.
Solution
SQL Server has an undocumented system stored procedure named sp_SetAutoSAPasswordAndDisable. This procedure will do exactly as the name suggests: it will reset the password and then disable the 'sa' login.
The procedure takes no parameters, so the syntax for usage is as follows:
After completion you should see the standard message:
Command(s) completed successfully.
The actual code is as follows:
When you execute this stored procedure the password for the ‘sa’ login will be reset to a random GUID, and then be disabled. Auditors love this aspect because not only is the password secure, but so is the account itself.
If you need to roll your own solution to rotate the password for the ‘sa’ login, then the sp_SetAutoSAPasswordAndDisable stored procedure may be exactly what you are looking for.
Source Collected from MSQLTIPS.COM
No comments :
Post a Comment