-
Notifications
You must be signed in to change notification settings - Fork 107
SPWebApplication
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name | Key | String | The name of the web application | |
WebAppUrl | Required | String | The URL 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 | |
Port | Write | String | The port to run the site on | |
HostHeader | Write | String | The host header to use for the web app | |
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) | |
UseServerNameIndication | Write | Boolean | Specifies that the Secure Sockets Layer (SSL) binding of this IIS website should use Server Name Indication (SNI) (SPSE only) | |
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) | |
Path | Write | String | The path on the local servers to host the IIS web site from | |
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 | |
UseSQLAuthentication | Write | Boolean | Should SQL Server authentication be used to connect to the database? | |
DatabaseCredentials | Write | PSCredential | If using SQL authentication, the SQL credentials to use to connect to the instance | |
AllowAnonymous | Write | Boolean | Should anonymous access be enabled for this web app | |
UseClassic | Write | Boolean | Create the web application with Classic authentication (only used during creation of a new web application) | |
SiteDataServers | Write | MSFT_SPWebAppSiteDataServers[] | Configure target URIs for the Search crawlers | |
Ensure | Write | String | Present if the web app should exist, absent if it should not |
Present , Absent
|
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 |
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.
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
}
}
}
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
}
}
}
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
}
}
}
- Home
- Getting Started
- Pre-requisites
- Installing the module
- Exporting SharePoint Configuration
- Creating Configuration Files
- Pre-created Examples
- Creating an Azure development environment
- Understanding Resources & Syntax
- Remote PowerShell Authentication
- Contributing to SharePointDsc
- Other useful modules for SharePoint DSC configurations