Adding multiple bindings with xWebAdministration

I’m having trouble figuring out the syntax to add multiple bindings…

    xWebsite CSLWebsite
    {
        Name = $name
        Ensure = $ensure
        PhysicalPath = $DestinationPath
        ApplicationPool = $Name
        State = 'Started'
        BindingInfo = MSFT_xWebBindingInformation
                    {
                        Port = '80'
                        IPAddress = '*'
                        HostName = $hostheader.ToLower()
                        Protocol = 'HTTP'
                    }
        DependsOn = "[File]WebSitePath"
}

It doesn’t look like there is anyway to add the SSL flags to the binding either…

Ping @StevenMurawski on Twitter if this doesn’t help, but…

First, check out the community version of this module in our DSC Hub (in the Git repo). I know it accepts a thumbprint for a certificate, for example. And I think you have to create multiple configuration items for each binding. The “c” versions are usually less buggy and more-featured than the “x” versions; the guys have been enhancing the “x” versions as they use them in production.

The below worked for me:

$sitename = "MainWebSite" 
xWebsite MainHTTPWebsite  
{  
    Ensure          = "Present"  
    Name            = $sitename
    ApplicationPool = "MainAppPool" 
    State           = "Started"  
    PhysicalPath    = "C:\path\to\files"  
    BindingInfo     = @(
                        @(MSFT_xWebBindingInformation   
                            {  
                                Protocol              = "HTTP"
                                Port                  =  80 
                                HostName              = "www.domain.tld"
                            }
                        );
                        @(MSFT_xWebBindingInformation
                            {
                                Protocol              = "HTTPS"
                                Port                  = 443
                                HostName              = "www.domain.tld"
                            }
                        )
                      )
    #DependsOn       = "[File]copyWebFiles"  
}  

Did you ever find out about the Sslflags option?

Looking at my script right now, and I don’t see anything in there.

Honestly, I can’t remember why I was needing to do that in the first place…

There’s no way to pass in an SslFlags value with Microsoft’s original “x” version of the resource, but we have a cWebAdministration version up on the PowerShell.org GitHub site, and you could add it to that. (Should be pretty straightforward to add an extra property to the DSC resource and pass it along to the underlying IIS commands.)

I ended up doing this with a script.

        Script setSSLflags
        {
            SetScript = {
                Set-WebBinding -Name $websitename -BindingInformation $bindinginformation -PropertyName sslFlags -Value 3
            }
            TestScript = {
                [bool][[get-webbinding -name $websitename | where {$_.bindingInformation -like "*443:*"}].sslFlags -eq 3]
            }
            GetScript = {
                $webbindingresult = [get-webbinding -name $websitename | where {$_.bindingInformation -like "*443:*"}].sslFlags
                Return @{
                    Result = "sslFlags = $webbindingresult"
                }
            }
            DependsOn = "[xWebsite]yourwebsite"
        }