title: Create SQL Server Login for IIS APPPOOL - IIS and SQL Server on different machines
body: <p>I've searched thoroughly- <em>apologies in advance if I am missing an obvious answer.</em>
  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.
  <a href="https://stackoverflow.com/questions/1933134/add-iis-7-apppool-identities-as-sql-server-logons">Add IIS 7 AppPool Identities as SQL Server Logons</a></p>
  
  <p>Microsoft link below does not provide specific syntax for creating a SQL Server Windows Login:
  <a href="http://www.iis.net/learn/manage/configuring-security/application-pool-identities" rel="nofollow noreferrer">http://www.iis.net/learn/manage/configuring-security/application-pool-identities</a></p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>The step that fails is creating a SQL Server Windows login.  </p>
  
  <p>We've followed the following steps per the first link:</p>
  
  <ol>
  <li><p>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)</p></li>
  <li><p>Right click logins and select "New Login"</p></li>
  <li><p>In the Login name field, type <code>IIS APPPOOL\YourAppPoolName</code> - do not click search</p></li>
  <li><p>Fill whatever other values you like (i.e., authentication type, default database, etc.)</p></li>
  <li><p>Click OK</p></li>
  </ol>
  
  <p>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?</p>
  
  <p>I have tried: "<code>mydomain\machine1$\IIS APPPOOL\MyAppPoolName</code>" many times without success.<br>
  Error message is: "<code>Windows NT User or group IIS APPPOOL\MyAppPoolName can not be found</code>"</p>
  
  <p>I have used the network name of the webserver in place of machine1 (along with the actual app pool name, and domain name).</p>
  
  <p>Thanks in advance for your help.</p>
  
  <p>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 :)</p>