Running an ASP.NET Core application in Docker running as a user user

I have an ASP.NET Core application connecting to the database using Integrated Security=True in the connection string, so the credentials of the user running the application are used to connect to the database and therefore I do not need to add the User Id=username;Password=password username and password User Id=username;Password=password in the connection string.

How can I launch the Docker container from the above application using a user account in my domain. Is this even a thing I can do? If so, is this still the recommended approach? This seems possible using Windows containers , but what about Linux?

+5
source share
1 answer

As someone commented on your question, you cannot do this because two separate virtual machines are running on your network. In addition, the SQL Server image for dockers is based on Linux, so it will make it more complex. What I would do (and my alredy team does) should have a sa SQL account and:

1.- In docker-compose.yml:

  sqlserver: image: microsoft/mssql-server-linux:latest container_name: sqlserver volumes: - mssql-server-linux-data:/var/opt/mssql/data environment: - ACCEPT_EULA=Y - SA_PASSWORD=MySaPasswordIsHere ports: - "1433:1433" 

2.- And in my link line (s) it looks:

 "MyServiceThatUsesSqlServer": { "MyConnectionString": "Server=sqlserver;Database=MyDatabaseName;User Id=sa;Password=MySaPasswordIsHere;" }, 

I hope this helps you solve this problem.

PS: this explains a very recent possible approach to "Active Directory Authentication with SQL Server on Linux": https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-active-directory-authentication p >

+2
source

Source: https://habr.com/ru/post/1270005/


All Articles