How to revert the MUST_CHANGE in ALTER LOGIN SQL Statement?

Let's say that someone executes the result from the select:

ALTER LOGIN [myLOGIN] WITH PASSWORD = 'myPassword' MUST_CHANGE, CHECK_POLICY = ON; 

How is the correct way to execute a new ALTER LOGIN statement, which removes the MUST_CHANGE policy? Is something like this ok or there is another better practice:

ALTER LOGIN [myLOGIN] WITH PASSWORD = 'myPassword' MUST_CHANGE, CHECK_POLICY = OFF; 
2

3 Answers

The correct way to disable MUST_CHANGE and CHECK_POLICY is with 2 separate statements.

ALTER LOGIN [myLOGIN] WITH PASSWORD = 'myPassword'; ALTER LOGIN [myLOGIN] WITH CHECK_POLICY = OFF; 

Following this sentense:

Set MUST_CHANGE for new logins. If MUST_CHANGE is specified, CHECK_EXPIRATION and CHECK_POLICY must be set to ON.

from PasswordPolicySQLServerLogin, the best practice should be like this:

ALTER LOGIN [myLOGIN] WITH PASSWORD = 'myPassword', CHECK_EXPIRATION = OFF; 

combining the answers above. i used.

ALTER LOGIN [myLogin] WITH PASSWORD = '******' MUST_CHANGE, CHECK_POLICY = ON, CHECK_EXPIRATION = ON; 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like