Public/Register-P1WebServices.ps1
function Register-P1WebServices { <# .Synopsis Register Web Application services based on security configuration (Authentication and SSL) .Description Register PlannerOne Web Application REST services with correct security configuration based on Authentication and SSL. Run Set-P1WebAuthentication and Set-P1WebSSL to change this parameters. .Parameter Tenant The target tenant. .Example # Register services Register-P1WebServices -Tenant Prod #> [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string] $Tenant ) Process { Write-Section "Registering Web services for current security" if (!(Test-Tenant $Tenant)) { Write-Warning "Tenant $Tenant does not exist." Write-Warning "Operation canceled." return; } $info = Get-P1Tenant $Tenant $host = $info.WebHost $port = $info.SitePort $app = $info.WebApplicationName Write-Output "Host: $host, Port: $port, Application name: $app" $site = Find-WebSite $port $siteName = $site.Name if ($site -eq $null) { Write-Warning "No site use binding $port configured for tenant Web Application $app of tenant $Tenant. Operation canceled." return } else { Write-Verbose "Site found" } $webApp = Get-WebApplication -Name $app -Site $siteName if ($webApp -eq $null) { Write-Warning "Cannot find Web Application $app for port $port" } else { Write-Warning "Web Application found" } $path = $webApp.PhysicalPath Write-Verbose "Physical path is $path" Apply-WebConfOnWebServices $path Write-OK "REST services registered with security for tenant $Tenant" } } |