SPWebApplication - dsccommunity/SharePointDsc GitHub Wiki
Parameters
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name | Key | String | The name of the web application | |
ApplicationPool | Required | String | The name of the application pool to run this site in | |
ApplicationPoolAccount | Required | String | The name of the managed account to run the app pool with | |
WebAppUrl | Required | String | The URL of the web application | |
AllowAnonymous | Write | Boolean | Should anonymous access be enabled for this web app | |
AllowLegacyEncryption | Write | Boolean | Specifies that older SSL and TLS protocol versions and cipher suites are allowed to be used with this IIS website (SPSE only and requires Windows Server 2022) | |
CertificateThumbprint | Write | String | Specifies the certificate thumbprint of the SSL certificate to be used. Make sure the certificate is added to Certificate Management (SPSE only) | |
DatabaseCredentials | Write | PSCredential | If using SQL authentication, the SQL credentials to use to connect to the instance | |
DatabaseName | Write | String | The name of the first content database to be created with this web app | |
DatabaseServer | Write | String | The name of the database server to host the default content DB | |
Ensure | Write | String | Present if the web app should exist, absent if it should not | Present , Absent |
HostHeader | Write | String | The host header to use for the web app | |
Path | Write | String | The path on the local servers to host the IIS web site from | |
Port | Write | String | The port to run the site on | |
SiteDataServers | Write | MSFT_SPWebAppSiteDataServers[] | Configure target URIs for the Search crawlers | |
UseClassic | Write | Boolean | Create the web application with Classic authentication (only used during creation of a new web application) | |
UseServerNameIndication | Write | Boolean | Specifies that the Secure Sockets Layer (SSL) binding of this IIS website should use Server Name Indication (SNI) (SPSE only) | |
UseSQLAuthentication | Write | Boolean | Should SQL Server authentication be used to connect to the database? |
MSFT_SPWebAppSiteDataServers
Parameters
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Zone | Required | String | Specifies the zone for which the URI has to be configured | Default , Intranet , Internet , Extranet , Custom |
Uri | Write | StringArray[] | The URI to be used by the Search crawlers |
Description
Type: Distributed Requires CredSSP: No
This resource is responsible for creating a web application within the local SharePoint farm. The resource will provision the web application with all of the current settings, and then ensure that it stays part of the correct application pool beyond that (additional checking and setting of properties)
The default value for the Ensure parameter is Present. When not specifying this parameter, the web application is provisioned.
NOTE: When using Host Header Site Collections, do not use the HostHeader parameter in SPWebApplication. This will set the specified host header on your IIS site and prevent the site from listening for the URL of the Host Header Site Collection. If you want to change the IIS website binding settings, please use the xWebsite resource in the xWebAdministration module.
Examples
Example 1
This example shows how to create a new web application in the local farm
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPWebApplication HostNameSiteCollectionWebApp
{
Name = "SharePoint Sites"
ApplicationPool = "SharePoint Sites"
ApplicationPoolAccount = "CONTOSO\svcSPWebApp"
AllowAnonymous = $false
DatabaseName = "SP_Content_01"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
WebAppUrl = "http://example.contoso.local"
Port = 80
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
Example 2
This example shows how to configure Site Data Servers for a new web application in the local farm
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPWebApplication HostNameSiteCollectionWebApp
{
Name = "SharePoint Sites"
WebAppUrl = "http://example.contoso.local"
ApplicationPool = "SharePoint Sites"
ApplicationPoolAccount = "CONTOSO\svcSPWebApp"
Port = 80
DatabaseName = "SP_Content_01"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
AllowAnonymous = $false
SiteDataServers = @(
MSFT_SPWebAppSiteDataServers {
Zone = "Default"
Uri = "http://spbackend"
}
MSFT_SPWebAppSiteDataServers {
Zone = "Intranet"
Uri = "http://spbackend2"
}
)
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
Example 3
This example shows how to configure SharePoint Subscription Edition Certificate Management settings for a new web application in the local farm
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPWebApplication HTTPSWebApp
{
Name = "SharePoint Sites"
WebAppUrl = "http://example.contoso.local"
ApplicationPool = "SharePoint Sites"
ApplicationPoolAccount = "CONTOSO\svcSPWebApp"
Port = 80
DatabaseName = "SP_Content_01"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
AllowAnonymous = $false
AllowLegacyEncryption = $true
CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D'
UseServerNameIndication = $false
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}