Home > database >  How can I change the password policy of MS SQL Server inside docker?
How can I change the password policy of MS SQL Server inside docker?

Time:08-12

I'm stuck at simplifying the required password for MS SQL Server docker.

It requires:

  1. Uppercase
  2. Lowercase
  3. Number
  4. Symbol

I want to only provide lowercase letters for my development environment.

How can I configure that?

CodePudding user response:

You can edit the SA_PASSWORD in the docker-compose.ymlfile. It will be something like this: environment: - SA_PASSWORD=PasSw0rd

CodePudding user response:

From Quickstart: Run SQL Server Linux container images with Docker:

docker run ... -e "MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>"  ...

Your password should follow the SQL Server default password policy, otherwise the container can't set up SQL Server and will stop working. By default, the password must be at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols.

And from Password Policy:

The security policy might be set in Windows, or might be received from the domain.

In this case, you can swap in "Docker" for either "Windows" or "the domain." And I don't believe Docker exposes a way to disable the strong password policy; I haven't come across a method to do this yet. This has come up before.

You can get SQL Server to create a login other than SA to have a weak password using CHECK_POLICY=OFF, but I don't know if Docker will let them authenticate. This certainly isn't something you can do to sa specifically; as noted, SQL Server will stop working (or at least will fail to start next time).

So my advice:

Just use a strong password

Come up with one that is memorable enough for all the things that are internal / local and aren't vulnerable. I'm happy to share mine (which I came up with when I first started using Azure SQL Edge on my M1):

3dg3Y0urB3ts

That uses upper, lower, and numbers. If you want to avoid upper case then you can use the three other sets (lower, numbers, and symbols):

sw0rdf!sh!es

  • Related