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; 23 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;