Create claims based Web Application through PowerShell

If you want to create a new WebApplication for SharePoint 2013 through PowerShell and use claims based authentication, you need to first create a new authentication provider and then create the web application using this authentication provider.

Here is the script to do this:

PS C:> $ap = New-SPAuthenticationProvider
PS C:> New-SPWebApplication -ApplicationPool “Sharepoint – demo” -Name “demo” -ApplicationPoolAccount “demoad\appaccount” -databasename “SharePoint_Content_demo” -hostheader “demo” -port 80 -url http://demo -path C:\inetpub\wwwroot\wss\VirtualDirectories\demo” -AuthenticationProvider $ap

 

Please note: not all of the parameters of New-SPWebApplication I used are really necessary, but I like to name the application pool, database and directory myself.

Leave a Reply

Your email address will not be published. Required fields are marked *

*