Create SharePoint web application (Central Admin & PowerShell)

In this SharePoint tutorial, we will discuss what is a SharePoint web application? How to create SharePoint web application from SharePoint central administration page and also how to create SharePoint web application using PowerShell.

We can use the same PowerShell script to create SharePoint web application in SharePoint 2013, SharePoint 2016, or SharePoint 2019.

What is a SharePoint web application

A SharePoint web application is a collection of one or more websites configured to map an HTTP request with a unique domain name. Each web application contains one or more site collections.

And each web application creates a content database and authentication method to connect to a database. The default website that is automatically created by IIS listens for incoming HTTP requests on port 80.

You can create additional IIS websites to provide additional HTTP entry points using different port numbers, different IP addresses, or different host headers.

When you create a web application in SharePoint Foundation, it creates an IIS website with a root folder containing a web. Configuration file at the following location:C:\inetpub\wwwroot\wss\VirtualDirectories. You can also find pool process for a web application once it is created from IIS manager.

Create SharePoint web application from Central Administration

Now, we will see how to create a web application in SharePoint 2013/2016 from central administration.

Step-1:
Open SharePoint 2016/2013 Central Administration and click on Application Management.

Create SharePoint web application
web application SharePoint

Step-2:
Click on Manage Web Applications and then click New.

create web application in sharepoint 2016
web application sharepoint 2016

Step-3:
Click Create a new IIS web site. Where we can find the following things:

On the Create New Web Application page, in the IIS Web Site section, you can configure the settings for a new Web application.

To choose to use an existing Web site, select Use an existing Web site, and then specify the Web site on which to install your new Web application by selecting it from the drop-down list.

To choose to create a new Web site, select Create a new IIS Web site, and then either accept the default name provided for you or type a new name for the Web site in the Description box.

In the Port box, type the port number that you want to use to access the Web application. If you are creating a new Web site, this field is populated with a suggested port number. If you are using an existing Web site, this field is populated with the current port number.

In the Host Header box, type the URL that you want to use to set the IIS host header binding. This is an optional field. Find more about the host header the following link.

In the Path box, type the path to the home directory on the server. If you are creating a new Web site, this field is populated with a suggested path. If you are using an existing Web site, this field is populated with the current path.

In the Allow Anonymous section, choose Yes or No. If you choose to allow anonymous access, this enables anonymous access to the Website by using the computer-specific anonymous access account (that is, IUSR_<computer name>).

In the Use Secure Sockets Layer (SSL) section, select Yes or No. If you choose to enable SSL for the Website, you must configure SSL by requesting and installing an SSL certificate.

sharepoint 2016 create web application
SharePoint 2016 create web application

Step-4:
In the Authentication Provider section, choose either Negotiate (Kerberos) or NTLM.

new-spwebapplication sharepoint 2016
new-spwebapplication SharePoint 2016

Step-5:
In the Application Pool section, choose whether to use an existing application pool or create a new application pool for this Web application. To use an existing application pool, select Use existing application pool. Next, select the application pool you want to use from the drop-down list.

To create a new application pool, select create a new application pool. In the Application pool name box, type the name of the new application pool, or keep the default name.

In the Select a security account for this application pool section, select Predefined to use an existing application pool security account and then select the security account from the drop-down menu.

Select Configurable to specify a new account to be used as a security account for an existing application pool. In the Username box, type the username of the account you want to use, and type the password for the account in the Password box.

In the Database Name and Authentication section, choose the database server, database name, and authentication method for your new Web application.

sharepoint 2016 web application
sharepoint 2016 web application

Step-6:
In server application connections we can see the default servers connections and settings associate with the applications provided. And helps you to choose the service applications that this Web application will be connected to.

how to create web application in sharepoint 2016 step by step
how to create web application in sharepoint 2016 step by step

Step-7:
Click on OK to create a new web application. Creating it will take some time where you need to be patient.

how to create web application in sharepoint 2013 step by step
create web application in sharepoint 2013 step by step

Sometimes you can incur a very long waiting time or Sometimes after the timeout as it will have created the database, the IIS website, but didn’t copy all contents into the Virtual Directory. We can go for PowerShell script.

Create a SharePoint web application using PowerShell

Now, we will see how to create a SharePoint web application using PowerShell.

By running the following PowerShell script, we can create a web application in SharePoint 2013/2016 or SharePoint 2019. You can run the PowerShell Script using Visual studio code or using windows powershell ise.

If you are new to SharePoint on-premises versions, then check out an article on How to use PowerShell in SharePoint Online/2016/2013.

SharePoint provides New-SPWebApplication PowerShell cmdlets that we can use to create a SharePoint web application in SharePoint on-premises versions.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "SP2016AppPool"
-ApplicationPoolAccount (Get-SPManagedAccount "TSINFO\Bijay") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

Below is the PowerShell command to create claim based authentication in SharePoint 2016/2013/2019.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$ap = New-SPAuthenticationProvider
New-SPWebApplication -Name "SP2016WebApp" -ApplicationPool "SP2016AppPoolAcc" -ApplicationPoolAccount (Get-SPManagedAccount "SPSky\Bijay") -URL "SP2016WebApp" -Port 3535 -AuthenticationProvider $ap

Once you run the code, you can see it will create the SharePoint web application like below:

PowerShell create web application in SharePoint 2016
PowerShell create web application in SharePoint 2016

Description:

There are some basic configure standard which we should follow to create web application
1. Add-PSSnapin “Microsoft.SharePoint.PowerShell”
SharePoint cmdlets are not available by default. This is because the ISE has not loaded up the SharePoint PowerShell Snap-ins.

2. New-SPWebApplication -Name “SharePoint 2016 Web App” :-
Here we have given a web application name as SharePoint 2016 Web App.

3. -Port 80
Port no 80

4. ApplicationPool “SP2016AppPool”
Here we have passed the application pool name which is SP2016AppPool

5. -ApplicationPoolAccount (Get-SPManagedAccount “TSINFO\Bijay”)
Here we provide managed account info which are active directory accounts whose credentials are managed by SharePoint.

These are the credentials passed as managed account info TSINFO\Bijay. Read an article on how to create and configure a managed account.

6. AuthenticationMethod NTLM
Authentication methods are used to drive uses while establishing a connection. Here NTLM AuthenticationMethod is used.

Database and application pool created after web application creation

As we know a database is created in a server as well as an application pool.
We can check the database behavior in the SQL server 2014 management studio and then click on the database. we can use search to get in SQL server 2014 management studio and get into the database and it is a big no to tamper data from the database directly.

In the following screenshot we can see there is no Database before any web application created only default database is created as SharePoint AdminContent database.

create new web application sharepoint 2013 powershell
create new web application SharePoint 2013 PowerShell

We can see the content database is created after a web application is being created

web application sharepoint 2013
web application sharepoint 2013

In the same way, can check application pool behavior in IIS Manager as a new application pool is being created when a web application gets created.

We run “inetmgr” command in a run window by pressing on windows+r

Here we can see an application pool is created and is been hosted in an IIS.

create new web application sharepoint 2016 powershell
create new web application SharePoint 2016 PowerShell

You may like following SharePoint tutorials:

Conclusion

In this tutorial, we learned what is a SharePoint web application? How to create a SharePoint web application from the SharePoint central admin in SharePoint 2013/2016? And also, we saw how to create a web application in SharePoint 2016 using PowerShell. The same PowerShell script we can use to create a web application in SharePoint 2013.

>