How to use windows authentication with SQL server docker container

IProgrammer picture IProgrammer · Dec 30, 2016 · Viewed 11.4k times · Source

I have gone through all the examples I could find online for building docker container based applications. I would want to run two services running in two docker containers:

  1. A windows container running ASP.NET
  2. A windows container running SQL Server

Easy job and many examples. However, in all examples you need to use SQL authentication and to provide a hard-coded SA password as an environment variable when running the SQL server container. You also need to hard code the SA password into the connection string in the ASP.Net code (or also provide it in some other manner in a configuration file, etc.)

Bottom line in all examples the password is hard-coded somewhere.

In most applications we develop now, we actually use windows authentication instead or use a grouped managed service account instead. But as far as I know, you cannot add a windows container to a domain, thus the SQL server is not part of the windows domain so I don't see a way to use windows authentication here.

So does any one have an alternative to hard-coding passwords this way ?

Answer

G. Gomes picture G. Gomes · Jan 19, 2017

I'm dealing exactly with the same problem. Here is the most complete procedure that I found. The trick is to use gMSA.

But, as JanneRantala says at the end, I'm having the same problem when trying to add a new User in the Database :

Msg 15401, Level 16, State 1, Line 3 Windows NT user or group 'YOUR_DOMAIN\gmsa$' not found. Check the name again.