Can I use AAD Managed Identities for IIS Application pool identities on Azure? - iis

I am hosting IIS on Azure Windows VM and need to configure Service account for IIS Application pool identity. What approach can I use for this? Is it possible to use AAD Managed identity or service principal for IIS Application pool identity?

According to microsoft docs :
The Windows operating system provides a feature called "virtual accounts" that allows IIS to create a unique identity for each of its application pools. For more information about virtual accounts, see Service Accounts Step-by-Step Guide.
If you are running IIS 7.5 on Windows Server 2008 R2, or a later version of IIS, you don't have to do anything to use the new identity. set ApplicationPoolIdentity by default. The IIS Admin Process (WAS) will create a virtual account with the name of the new application pool and run the application pool's worker processes under this account by default.
To use this virtual account when running IIS 7.0 on Windows Server 2008, you have to change the Identity property of an application pool that you create to ApplicationPoolIdentity.
Please check this reference: Application Pool Identities | Microsoft Docs
You must be a member of the Administrators group on the local computer to perform the following procedures.And for AAD make sure to do active directory sync to connect to local AD.
Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
Double-click , double-click Application Pools, right-click , and click Advanced Settings.
In the Identity box, click ApplicationPoolIdentity.
Under Application Pool Tasks, click Stop, and then click Start.
Reference : Service Accounts Step-by-Step Guide-o configure an IIS app
lication pool to use a virtual account | Microsoft Docs

Related

Azure web app key vault exception when recycled

We have several ASP.NET Core web apps that use the Azure Key Vault.
This works well through all manual restarts, but when the web app is recycled automatically by Azure it does not start successfully due to a "KeyVaultErrorException: Client address is not authorized and caller is not a trusted service".
Restarting manually then works correctly. We have appinitialization turned on.
I realize that multiple instances would mitigate this, but how can we have the app successfully restart when recycled by Azure?
Edit:
The key vault is setup using the "Add connected services" through Visual Studio 2019, via the Microsoft.AspNetCore.AzureKeyVault.HostingStartup package v2.0.4
Navigate to the keyvault in the portal -> Networking, make sure you select the Allow access from All networks.
Or if you select the Private endpoint and selected networks, try to add all the Additional Outbound IP Addresses to the firewall.

Issues in IIS Manager

I am using IIS Manager in window 10,
I need to host my ASP .NET web Form project in iis and access from other devices in same network.
i add new website and provide physical path.
the ip access from the computer but cannot able to access from other device in same network.
It Shows:
While Authentication file.
The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that \$ has Read access to the physical path. Then test these settings again.
As far as I know, this is IIS warning when you click test in the binding window.
By default, IIS will use identity to access the protected files.With psasthrough
authentication like impersonation, IIS will attempt to use the actual identity of the user when accessing protected resources.
If user doesn't auth, it will use application pool identity to access the resources.
In my opinion, it is just a warning not a error.

Configuring Integrated Security using IIS Application Pool Identity accounts for SQL Server 2008

I have the following configuration for a web site:
Two Web front-ends (e.g. machine names: WFE1 & WFE2) 1 SQ
One SQL Server Database cluster (e.g. machine name: DBCluster)
All machines are in the same domain (e.g. MyDomain) running Windows 2008 R2 Enterprise and SQL Server 2008 R2.
I am in the process of deploying a web application that uses the Application Pool Identity. I have named the pool MyWebApp, which translates to the name, [IIS APPPOOL\MyWebApp]. When I try adding this user to SQL Server I get an error:
Windows NT user or group 'IIS APPPOOL\MyWebApp' not found. Check the name again.
The script that I have used to create the account in SQL Server is:
CREATE LOGIN [IIS APPPOOL\MyWebApp]
FROM WINDOWS WITH DEFAULT_DATABASE=[MyDatabase], DEFAULT_LANGUAGE=[us_english]
GO
I imagine the problem is occuring because the IIS account is a local account which is not visible to the SQL Server box.
Can someone please shed some light on how this problem can be resolved? Is using a domain account my only option or can I still get the application pool accounts to work?
I imagine the problem is occuring because the IIS account is a local account which is not visible to the SQL Server box.
That's exactly the problem. The IIS AppPool account only exists on the web server. If you were able to add this account to SQL Server, you would be authorizing an IIS AppPool that is running on the same machine as SQL Server. (I suspect it might still fail.)
The most secure solution would probably be to do as you say - create an account on the domain, give that account appropriate permissions on the database, and run the AppPool using that account's credentials.
However, if you'd still like to do it, you need to authorize the computer that the AppPool is running on - ie, DOMAINNAME\ComputerName$ (note the $ at the end).
Take a look at this article for more information (specifically, the section titled Accessing the Network).
I think that's a bad idea, however, because it authorizes any program running as NetworkService to access the database - not just your web applications.

IIS site not using identity specified in app pool IIS 7 +

I have a web app from visual studio that is using local IIS server to run. It is an MVC 3 application. I setup the application pool in my IIS (win 7 pro) to use a service account for the application identity. When I browse the site I am getting permission errors for a function on the site which I would not get if it was using the service account. This has been tested by using same service account on a development server as the application pool identity. Application executes with no errors. Could there be something in my local security policy preventing the service account from being used?
Service account is also a member of IIS_IUSRS group.
This is a network service.

How to use domain windows user account as app pool identity

I will be using a domain windows account(maintained in Active Directory) as Application pool identity in my web server. So i want the account to be a member of IIS_WPG or IIS_IUSRS group.
My question is where to do it? in Active Directory or in the web server itself?
If i modify the Active Directory, so that the user is part of IIS_WPG/IIS_IUSRS, should be more than enough? or i should edit local users/group(in web server) to make sure i add the domain user to IIS_WPG or IIS_IUSRS group?
I'm not sure about adding via Active Directory as a blanket fix.
We used this method for IIS 6:
Add User to IIS_WPG group:
Go to Computer Management on the box hosting the site, Local Users and Groups > Groups, right-click IIS_WPG > Add to Group, then add the windows account, Apply, OK.
Then allow account to run as service:
Admin Tools > Local Security Policy > Local Policies > User Rights Assignment > Log on as a service Properties, Add user, Apply, OK
Set App Pool Identity:
IIS > App Pool Properties > Identity tab, set as configurable and input user, Apply, OK.
Then reboot box.
Good resource: Steps for setting up a custom identity of an IIS 6 application pool
In the identity tag and
use your windows domain and windows user name in the web.config file
In the IIS Server set the pool identity as ApplicationPool.
Disable anonymous authentication for the web application.
Enable Impersonation and
Windows Authenticaton.
for the web Application in the IIS Box
On Windows Server 2012 (in my case) one have to
add user to domain controller
set the Domain Account as custom apppool identity on the Webserver
set the option LoadUserProfile = True in the advanced properties of the Application Pool.
Right click on your Application Pool, in Process Model section, identity (first one) go in and select the second radio button which is Custom account and enter your desire account and password

Resources