DSCResources/DSC_WebApplication/en-US/about_WebApplication.help.txt

.NAME
    WebApplication
 
.DESCRIPTION
    The WebApplication DSC resource is used to...
 
    ## Requirements
 
    * Target machine must be running Windows Server 2012 R2 or later.
 
    ## Known issues
 
    All issues are not listed here, see https://github.com/dsccommunity/WebAdministration/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+WebApplication.
 
.PARAMETER Website
    Key - String
    Name of website with which web application is associated
 
.PARAMETER Name
    Key - String
    Name of web application
 
.PARAMETER WebAppPool
    Required - String
    Web application pool for the web application
 
.PARAMETER PhysicalPath
    Required - String
    Physical path for the web application directory
 
.PARAMETER Ensure
    Write - String
    Allowed values: Present, Absent
    Whether web application should be present or absent
 
.PARAMETER SslFlags
    Write - StringArray
    Allowed values: , Ssl, SslNegotiateCert, SslRequireCert, Ssl128
    SSLFlags for the application
 
.PARAMETER AuthenticationInfo
    Write - Instance
    Hashtable containing authentication information (Anonymous, Basic, Digest, Windows)
 
.PARAMETER PreloadEnabled
    Write - Boolean
    Allows a Application to automatically start without a request
 
.PARAMETER ServiceAutoStartEnabled
    Write - Boolean
    Enables Autostart on an Application.
 
.PARAMETER ServiceAutoStartProvider
    Write - String
    Adds a AutostartProvider
 
.PARAMETER ApplicationType
    Write - String
    Adds a AutostartProvider ApplicationType
 
.PARAMETER EnabledProtocols
    Write - StringArray
    Allowed values: http, https, net.tcp, net.msmq, net.pipe
    Adds EnabledProtocols on an Application
 
.EXAMPLE 1
 
Create a new web application on the Default Web Site
This example shows how to use the WebApplication DSC resource to create a new web application.
 
Configuration Sample_WebApplication_NewWebApplication
{
    param
    (
        # Target nodes to apply the configuration
        [String[]] $NodeName = 'localhost',
 
        # Destination path for Website content
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [String] $DestinationPath
    )
 
    # Import the module that defines custom resources
    Import-DscResource -Module PSDesiredStateConfiguration
    Import-DscResource -Module WebAdministrationDsc
 
    Node $NodeName
    {
        # Install the IIS role
        WindowsFeature IIS
        {
            Ensure = 'Present'
            Name = 'Web-Server'
        }
 
        # Install the ASP .NET 4.5 role
        WindowsFeature AspNet45
        {
            Ensure = 'Present'
            Name = 'Web-Asp-Net45'
        }
 
        # Start the Default Web Site
        WebSite DefaultSite
        {
            Ensure = 'Present'
            Name = 'Default Web Site'
            State = 'Started'
            PhysicalPath = 'C:\inetpub\wwwroot'
            DependsOn = '[WindowsFeature]IIS'
        }
 
        # Create a new application pool for the application
        WebAppPool SampleAppPool
        {
            Ensure = 'Present'
            Name = 'SampleAppPool'
        }
 
        # Clone the wwwroot folder to the destination
        File WebContent
        {
            Ensure = 'Present'
            SourcePath = 'C:\inetpub\wwwroot'
            DestinationPath = $DestinationPath
            Recurse = $true
            Type = 'Directory'
            DependsOn = '[WindowsFeature]IIS'
        }
 
        # Create a new web application with Windows Authentication
        WebApplication SampleApplication
        {
            Ensure = 'Present'
            Name = 'SampleApplication'
            WebAppPool = 'SampleAppPool'
            Website = 'Default Web Site'
            PreloadEnabled = $true
            ServiceAutoStartEnabled = $true
            AuthenticationInfo = DSC_WebApplicationAuthenticationInformation
            {
                Anonymous = $false
                Basic = $false
                Digest = $false
                Windows = $true
            }
            SslFlags = ''
            PhysicalPath = $DestinationPath
            DependsOn = '[WebSite]DefaultSite','[WebAppPool]SampleAppPool'
        }
    }
}
 
 
.EXAMPLE 2
 
This shows an example for all possible settings for the WebApplication resource
 
configuration Sample_WebApplication
{
 
    param
    (
        # Target nodes to apply the configuration
        [String[]] $NodeName = 'localhost',
 
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [String] $PhysicalPath
    )
 
    Import-DscResource -ModuleName WebAdministrationDsc
 
    node $NodeName
    {
        WebApplication WebApplication
        {
            Website = 'Website'
            Ensure = 'Present'
            Name = 'WebApplication'
            PhysicalPath = $PhysicalPath
            WebAppPool = 'DefaultAppPool'
            ApplicationType = 'ApplicationType'
            AuthenticationInfo = `
                DSC_WebApplicationAuthenticationInformation
            {
                Anonymous = $true
                Basic = $false
                Digest = $false
                Windows = $false
            }
            PreloadEnabled = $true
            ServiceAutoStartEnabled = $true
            ServiceAutoStartProvider = 'ServiceAutoStartProvider'
            SslFlags = @('Ssl')
            EnabledProtocols = @('http', 'net.tcp')
        }
    }
}