How to add the ApplicationPoolIdentity to a SQL Server Login
The ApplicationPoolIdentity is a virtual account in Windows that is dynamically generated when the application pools is created and takes on the name of the application pool in this manner: IIS Apppool\<name of application pool> . For instance, the application pool MyApp would have a virtual account created under the name IIS Apppool\MyApp when instantiated. Read here for more information about the ApplicationPoolIdentity and here for Windows virtual accounts.
Since Windows is creating a dynamic virtual account for the application pool, there is not set identity or Windows user account to assign to a SQL login for data access. This makes it difficult to assign the application pool to the SQL login. This blog post shows how to add a SQL login for local and a remote SQL Server to allow the applications hosted in an application pool to access the SQL Server.
Side note: The IIS authentication method, anonymous or Windows, will not make a difference on the access to the SQL Server. The security principle used to connect to the SQL Server is the one setup in the application pool configuration Identity.
![]()
On a local SQL Server, the login request will appear as the IIS application pool identity. For instance, if the application pool is called AuthTest, the login will appear as IIS Apppool\AuthTest.
On a remote SQL Server, the login request will appears as the machine name since the built in account is attempting to access SQL. For example, the server IIS01 will appear as domain\IIS01$ in a SQL trace.
To validate the connection to SQL, run a SQL trace with the Audit Login Failed and User Error Message events enabled and this will show the account attempting to access SQL. Or, check the SQL log files.
To Add the Account to SQL:
The steps are the same to add the login to SQL for a local or remote SQL Server. However, the identities are different depending on the server if SQL Server is installed locally or on a remote server.
For a local SQL Server:
- Open SQL Server Management Studio (SSMS) and connect to the SQL Server.
- Open the Security folder at the server level and not the security folder for the database.
- Right click on the logins and select New Login.
- For the login, type IIS APPPOOL\AppPoolName and DO NOT CLICK SEARCH and select OK (If a search is executed, it will resolve to an account with ServerName\AppPool Name and SQL will be unable to resolve the account’s SID since it is virtual)
- Select the defaults for the account and select OK to close dialog
The same can be accomplished using T-SQL:
CREATE LOGIN [IIS APPPOOL\AuthTest] FROM WINDOWS;
CREATE USER AuthTest FOR LOGIN [IIS APPPOOL\AuthTest];
For a remote SQL Server:
- Open SQL Server Management Studio (SSMS) and connect to the SQL Server.
- Open the Security folder at the server level and not the security folder for the database.
- Right click on the logins and select New Login.
- For the login, type Domain\ServerName$ and DO NOT CLICK SEARCH
- Select OK
- Select the defaults for the account and select OK to close dialog
Using T-SQL:
CREATE LOGIN [computername$] FROM WINDOWS;
web.config SET integrated security=SSPI;
How to add the ApplicationPoolIdentity to a SQL Server Login的更多相关文章
- Ubuntu 下安装 SQL Server 2016初探
安装步骤参官方 https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-ubuntu 执行命令如下: .Enter supe ...
- Sql Server来龙去脉系列之四 数据库和文件
在讨论数据库之前我们先要明白一个问题:什么是数据库? 数据库是若干对象的集合,这些对象用来控制和维护数据.一个经典的数据库实例仅仅包含少量的数据库,但用户一般也不会在一个实例上创建太多 ...
- linux+asp.net core+nginx+sql server
Linux Disibutaion:Ubuntu 16.04.1 LTS Web Server:Nginx.Kestrel 安装.net core sudo sh -c 'echo "deb ...
- Ubuntu上配置SQL Server Always On Availability Group(Configure Always On Availability Group for SQL Server on Ubuntu)
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
- Configure Always On Availability Group for SQL Server on RHEL——Red Hat Enterprise Linux上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Red Hat Enterprise Linux上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的 ...
- Ubuntu 安装 SQL Server
SQL Server现在可以在Linux上运行了!正如微软CEO Satya Nadella说的,"Microsoft Loves Linux",既Windows 10内置的Lin ...
- vs2012中使用localdb实例还原一个sql server 2008r2版本的数据库
use localdb sometime is easy than sql server ,and always use visual studio make you stupid. vs2012中还 ...
- SQL Server遗失管理权限账号密码怎么办?
假如一个SQL Server实例只允许"SQL身份认证"模式登录数据库,而糟糕的是你忘记了sa的密码(sa出于安全考虑应该被禁用,这里仅仅为了描述问题)或其它具有sysadmin角 ...
- Configure Always On Availability Group for SQL Server on Ubuntu——Ubuntu上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
随机推荐
- C#中Invoke的用法2
在用.NET Framework框架的WinForm构建GUI程序界面时,如果要在控件的事件响应函数中改变控件的状态,例如:某个按钮上的文本原先叫“打开”,单击之后按钮上的文本显示“关闭”,初学者往往 ...
- 基于spring-mybatis-data-common基架快速搭建web应用
spring-mybatis-data-common做了哪些操作 1.日志依据层级归类输出,支持扩展 2.spring-mybatis持久层基础接口集成,支持扩展 3.常用业务接口定义,支持扩展. 只 ...
- fft ocean注解
针对这两篇教程: http://www.keithlantz.net/2011/10/ocean-simulation-part-one-using-the-discrete-fourier-tran ...
- Features Download Pricing Mind Maps Blog XMind的快捷键
XMind提供很多快捷键.使用XMind时,在操作的过程中结合快捷键,双手同时操作,将给你带来很大的便利.例如下面一些常用的快捷键: 编辑主题:F2 添加标签:F3 创建一个新的空白工作簿:Ctrl+ ...
- 升级python(linux)
查看系统当前python版本 2: [root@wangyuelou ~]# python Python 2.4.3 (#1, May 5 2011, 16:39:10) [GCC ...
- python打开文件的N种姿势
# python打开文件的N种姿势 print('[1]使用open()函数+简单for循环') f1 = open('python.txt') for line in f1: print(line. ...
- select理解
https://www.cnblogs.com/skyfsm/p/7079458.html
- AllPay(欧付宝)支付接口集成
AllPay,http://www.allpay.com.tw/,欧付宝是台湾知名的第三方支付公司,拥有丰富的支付模式(支持和支付宝.财付通),只需要一次对接,各种支付模式均可使用. 接口编写SDK: ...
- 教你一招:win10下JDK的安装与环境变量配置
1.到官网下载最新版本的JDK http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.安装JDK,同安装其他软件一样 ...
- js调用winform程序(带参数)
我们会发现,我们点击迅雷下载的时候 网页可以调用应用程序,而且连接会传入迅雷,这个是怎么做到的呢? 原理: 先注册表中添加软件的具体信息,然后通过 href 可以直接调用 1.写入注册表信息,注册, ...