Create SQL Server Login for IIS APPPOOL – IIS and SQL Server on different machines

I’ve searched thoroughly- apologies in advance if I am missing an obvious answer.
Followed the recommendations at link below and the solution did not work. The solution also does not indicate whether it applies to a production webserver running IIS and SQL Server on separate computers.
Add IIS 7 AppPool Identities as SQL Server Logons

Microsoft link below does not provide specific syntax for creating a SQL Server Windows Login:
http://www.iis.net/learn/manage/configuring-security/application-pool-identities

Our goal is to securely deploy a ASP.NET 4.0 web application to the public on a Server 2008 R2 computer running IIS 7.5 in our production environment. As per best practices, we have SQL Server 2008 running on a separate computer in the same domain. We want to use SQL Sever Windows Authentication without impersonation to allow the ASP.NET application on the IIS box and SQL Server to communicate. Currently a SQL Server login connection string allows the .NET app to connect to SQL Server but we want to upgrade the connection string to be a Windows SQL Server login to be more secure.

On IIS 7.5 we’ve configured an Application Pool for the website.
Under Application Pool advanced setting, Built-In Account have tried using both ApplicationPoolIdentity and Network service without success. Best practice is said to be to use ApplicationPoolIdentity for tighter security.

The step that fails is creating a SQL Server Windows login.

We’ve followed the following steps per the first link:

  1. In SQL Server Management Studio, look for the Security folder (the security folder at the same level as the Databases, Server Objects, etc. folders…not the security folder within each individual database)
  2. Right click logins and select “New Login”
  3. In the Login name field, type IIS APPPOOLYourAppPoolName – do not click search
  4. Fill whatever other values you like (i.e., authentication type, default database, etc.)
  5. Click OK

Can you please tell me with IIS 7.5 and SQL Server being on separate boxes, what syntax I need to use to create the SQL Server Window Login?

I have tried: “mydomainmachine1$IIS APPPOOLMyAppPoolName” many times without success.
Error message is: “Windows NT User or group IIS APPPOOLMyAppPoolName can not be found

I have used the network name of the webserver in place of machine1 (along with the actual app pool name, and domain name).

Thanks in advance for your help.

PS It would be great if Microsoft provided a step by step tutorial on how to accomplish this common and what should be easy task. Your answers here on StackOverFlow will help many people 🙂

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

One solution to your problem would be to set up a separate (not built-in) account for the application pool. You could give that account minimal rights and also give the access to SQL Server.

This way you could use a domain account which is easy to set up but still control security tightly.

Method 2

I know this question is old, but since I suffered till I got it work, I’d like to share my experience to answer this question.

The steps you have followed worked with me, except :

3- The account you need to add to sql server logins is mydomainmachine1$ not mydomainmachine1$IIS APPPOOLMyAppPoolName

4- leave every thing in general settings page as defaults (actually, you need to make sure you are using windows authentication).

Then Go to User Mappings | select the database you want your application to access | grant it whatever permissions you want. For example, give it db_datareader & db_datawriter permissions.

5- Click OK to save.

But be ware that all applications using virtual accounts from same machine will be able to access this database.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x