Sql-server – Specifying login creditials for remote SQL connection string in ASP.Net/Entity Framework Core

asp.net-coreentity-framework-coresql server

I am following https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db to learn how to use the new .Net Core and Entity Framework Core and I am trying to create the connection string to a remote SQL Server. I updated the server and database strings but it does not show how to specify the username and password. I have done some digging but every entity framework core example I find is for localDB only. How am I to properly specify the login credentials and what should Trusted_Connection be set to for a remote SQL Server 2016 server?

Best Answer

The connection strings in EF Core remain the same as in EF6 and when you use pure ADO.NET.

For user/password authentication it's Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;.

For a list of common connection strings for SQL Server (and others), look at https://www.connectionstrings.com/sql-server/.

Related Topic