Sql-server – Authentication between IIS & SQL Server for Load Balanced App

authenticationiisiis-7.5sql serverwindows-server-2008

I'm looking to use this connection string however I'm not sure how to set this up:

Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase; Trusted_Connection=yes;

Previously our SQLNCLI10 connection string used a Uid & Pwd. We've now moved servers and have set up Active Directory, looking for some help as to how to configure security between IIS & MSSQL.

In IIS 7.5, there is an option to specify a user account in the Basic Settings of a web site or just use Pass-through authentication. I presume if pass through is set, it uses the account set up for the Application Pool?

By default the app pool is running as ApplicationPoolIdentity. Only websites in this app pool should have access to this database. Also there are multiple web servers using a shared config, each connecting to the same database server (or servers as they are mirrored using MSSQL Database Mirroring)

Currently when the script is run, this is the error message (MSSQL is on a different server in the same domain): Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

What identity should I make the app pool, and how should I set this account up in MSSQL?

I hope that all makes sense and thanks again!

I have a feeling this page is relevant, although I don't really understand it: http://learn.iis.net/page.aspx/624/application-pool-identities/

Best Answer

Create an account for sql to use, either a windows or sql account, and specify that in the connection string. For security purposes, you should also encrypt the web.config after doing this using the command:

%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -prov "RsaProtectedConfigurationProvider" -pef connectionStrings "[PathToWeb.Config]"  

That account should have the required permissions to the database, such as db_DataReader and db_DataWriter.