SQL SERVER – Change Password at the First Login

MUST_CHANGE requires a SQL-authenticated login to change password at its first connection. Policy options and the client workflow must support it.

A temporary key awaits a first-use exchange beside a closed cabinet and fitting tools.

-- Administrative template only. Supply a securely generated temporary secret.
-- CREATE LOGIN [YourLogin]
-- WITH PASSWORD=N'<secure temporary secret>' MUST_CHANGE,
--      CHECK_POLICY=ON, CHECK_EXPIRATION=ON;

MUST_CHANGE requires both CHECK_POLICY and CHECK_EXPIRATION to be ON. My old example explicitly set only expiration. Showing both clarifies the requirement. The template avoids the previously published example password.

Generate and deliver the temporary secret securely. The client must support the password-change response. An unattended service connection can fail instead of displaying a prompt. Windows-authenticated identities use their Windows password process.

This commented template does not create an account. Confirm authentication, permissions and onboarding requirements. Verify first-use and subsequent connections in a controlled test.

Reference: First-login password policy requirements.

Related reading

A temporary password is not complete onboarding, it is a secret within a supported first-use identity workflow.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

, SQL Scripts, SQL Server, SQL Server Security
Previous Post
SQL SERVER – AdHoc Queries and Optimize for Adhoc Workloads
Next Post
Line Endings: CHAR(13), CHAR(10) and Files From Other Systems

Related Posts

1 Comment. Leave new

  • Hi Pinal,
    That’s for the post.
    I’m trying to think how this would fit in with SQL Servers at work. We use AD for authentication for user accounts which tend to be admins and server authentication for systems.
    What would be a good use case?
    I like your posts as it makes me think about areas of the SQL I haven’t thought about.
    Regards,
    David Tovee

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.