Lägg till 'Renew-WAPApplications.ps1'

master
Peter Wickenberg 2 years ago
parent fcf1a22d40
commit f9e89cd908

@ -0,0 +1,19 @@
# 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())"
Loading…
Cancel
Save