Last active
July 13, 2018 09:32
-
-
Save yuriyostapenko/b06001b9b455d6b8914499c43ea4ca4c to your computer and use it in GitHub Desktop.
Create IIS Website with http/https bindings with xWebsite using Invoke-DscResource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: <tbd> | |
tasks: | |
- name: Configure https binding | |
win_dsc: | |
resource_name: xWebsite | |
Name: "ws2" | |
Ensure: Present | |
BindingInfo: | |
- Protocol: http | |
Port: 81 | |
- Protocol: https | |
Port: 4431 | |
CertificateStoreName: My | |
CertificateThumbprint: 99978a65f4b8d974d0a8f4eb451f145da412c39b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisite, don't do it every time :) | |
#Install-Module xWebAdministration | |
$Params = @{ | |
Module = 'xWebAdministration'; | |
Name = 'xWebsite'; | |
Property = @{ | |
Name = 'ws2'; | |
BindingInfo = [CimInstance[]]@( | |
New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{ | |
Protocol = "http" | |
Port = 801 | |
}; | |
New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{ | |
Protocol = "https" | |
Port = 4431 | |
CertificateThumbprint = "99978a65f4b8d974d0a8f4eb451f145da412c39b" | |
CertificateStoreName = "My" | |
} | |
) | |
Ensure = 'Present' | |
} | |
Verbose = $true | |
} | |
$TestResult = Invoke-DscResource @Params -Method Test | |
if (-not $testResult.InDesiredState) { | |
Invoke-DscResource -Method Set @Params | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment