How to Create and Extend the Commerce Application in SharePoint 2010
This topic provides guidance on how to use Microsoft Windows PowerShell to create a commerce Web application in Microsoft SharePoint 2010. The Web application is the container for the site collection required to implement a SharePoint 2010 commerce site.
In addition to creating the Web application in IIS, the sample script also extends the Web application inside SharePoint 2010 into two zones: a business user zone using Windows authentication, and a shopper zone using forms-based authentication (FBA).
Prerequisites
See Using Windows PowerShell for SharePoint 2010 Commerce Deployment for a list of variables and sample values that are used in sample scripts provided in this topic.
You have configured a SharePoint 2010 managed account to be assigned to application pool. This account must have sufficient privileges to access the SQL Server database. For information on required privileges, see What Are the Required Accounts and Groups?
To create a Web application using Windows PowerShell
Following is a sample Windows PowerShell script that creates a Web application in SharePoint 2010. The script retrieves a previously configured SharePoint Managed Account.
.\"1-env.ps1"
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
# Create Web Application
Write-Host "Creating the Web Application " $WebSiteUrl
$appPoolAccount = Get-SPManagedAccount $ManagedAccount
if($WebAppPort -eq "80")
{
$wa = New-SPWebApplication -Name $WebAppName -ApplicationPool $WebAppPoolName -ApplicationPoolAccount $appPoolAccount -Port $WebAppPort –URL $WebSiteUrl -AllowAnonymousAccess
}
else
{
$wa = New-SPWebApplication -Name $WebAppName -ApplicationPool $WebAppPoolName -ApplicationPoolAccount $appPoolAccount –URL $WebSiteUrl -AllowAnonymousAccess
}
$wa.Provision()
Write-Host "Creating the Extended zone Web Application " $WebSiteUrlExtended
if($WebAppPortExtended -eq "80")
{
$ewa = New-SPWebApplicationExtension -Identity $wa -Name $WebAppExtendedName -Zone $ExtendedZoneType -Port $WebAppPortExtended -URL $WebSiteUrlExtended -AllowAnonymousAccess
}
else
{
$ewa = New-SPWebApplicationExtension -Identity $wa -Name $WebAppExtendedName -Zone $ExtendedZoneType -URL $WebSiteUrlExtended -AllowAnonymousAccess
}
See Also
Other Resources
Using Windows PowerShell for SharePoint 2010 Commerce Deployment
Walkthrough: Deploying SharePoint 2010 Commerce Solution in a Two-Tier Topology
Walkthrough: Deploying a SharePoint 2010 Commerce Solution in a Three-Tier Topology