You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
1019 B
PowerShell
19 lines
1019 B
PowerShell
1 year ago
|
# Created by Peter Wickenberg
|
||
|
# Date 2022-08-01
|
||
|
# Version 1.0
|
||
|
|
||
|
# Store {CertCommonName} as fqdn variable
|
||
|
$fqdn = $args[0]
|
||
|
write-host CertCommonName is $fqdn
|
||
|
# Get WAP Application and store as variable
|
||
|
$app = Get-WebApplicationProxyApplication | Where-Object {$_.ExternalUrl -Match "https://" + "$fqdn"}
|
||
|
write-host WAP Application is $app.Name and it has ID $app.ID
|
||
|
|
||
|
# Set Let's encrypt certificate for WAP Application
|
||
|
write-host Changing to the latest certificate
|
||
|
Set-WebApplicationProxyApplication `
|
||
|
-ID $app.ID `
|
||
|
-BackendServerUrl "$($app.backendserverurl)"`
|
||
|
-ExternalCertificateThumbprint $((get-childitem Cert:\LocalMachine\My\ | `select subject,thumbprint,@{ Label = 'IssuedBy' ;Expression = { $_.GetNameInfo( 'SimpleName', $true ) } } | ? {($_.IssuedBy -like "R3*") -and ($_.Subject -like "CN=$fqdn")} | select -First 1).Thumbprint)`
|
||
|
-ExternalUrl "$($app.externalURL)"`
|
||
|
-Name "$($app.name.substring(0,1).toupper()+$app.name.substring(1).tolower())"
|