Table of Contents

Set Integrated Windows Authentication for IIS Website

Summary: How to set Integrated Windows Authentication for an IIS Website
Date: Around 2017
Refactor: 1 March 2025: Checked links and formatting.

We have a webapp running on IIS that is using SQL authentication for accessing it's database. We want to change this to Integrated Windows Authentication.

Create a Service Account and Assign Permissions

When working with Integrated Windows Authentication we want to create a service account that is excluded from your normal password policy:

Assign Database Permission

Usually when working with Integrated Windows Authentication the vendor of your application will know exactly which permissions to assign to the service account used to access the database. In case you don't have this information or you're still testing the whole setup you could usually assign db_owner role to the user.

To do so, in SQL Management Studio follow these steps (notice, that these steps might change per SQL server version) :

Local Admin Permissions

It should normally not be required to add the serviceaccount to the local admin group on the IIS server, but I've had cases in which this was required, so in case you're testing and get error you might want to try this:

In Server Manager, follow these steps:

Change Connection Strings

The connection strings are setup in the web.config file of the webapp on IIS. So in the IIS server, follow these steps to change the config:

In the file the connection strings are usually located at the top, and for DB Connections they ususally look like this:

<add name="DBConnection" connectionString="Data Source=WSQL-P01.getshifting.com\SQL01;Initial Catalog=Shifthub;Persist Security Info=True;User=shifthub;Password=EasyPass01!"/>

Notice that the password for the sql user shifthub is in plain text and visible to anyone with read access. Change the connection string in: <add name=“DBConnection” connectionString=“Server=WSQL-P01.getshifting.com\SQL01;Database=Shifthub;User Id=sa_appname;Trusted_Connection=True”/>

Save the file when you're done.

Setup Integrated Windows Authentication

You have a few configuration steps to take in IIS Manager to set this up completely. In IIS Manager, follow these steps:

Set the Website to Windows Authentication

Set the IIS Server to Windows Authentication

Configure the Application Pool to use the Service Account

Restart the Website

Test Configuration

You can test the configuration in IIS Manager:

Now a test for the authentication (service account credentials) and authorization (file access) will be done.

Useful Links