52 lines
2.3 KiB
PowerShell
52 lines
2.3 KiB
PowerShell
function Set-SDKTenant {
|
|
<#
|
|
.SYNOPSIS
|
|
Add a list of tenants to your local environment.
|
|
|
|
.DESCRIPTION
|
|
Create a new tenant instances on your machine by connecting to a remote tenant database and configuring their websites on your local machine.
|
|
|
|
.PARAMETER Tenant
|
|
An array of tenant identifiers to bring into your environment.
|
|
|
|
.EXAMPLE
|
|
Get-SDKTenant -ServerName "remote_db" -MasterDatabaseName "AlkamiMaster_Dev1" | Where-Object { $_.Name -eq "Altura" } | ForEach-Object { Set-SDKTenant $_ }
|
|
|
|
.NOTES
|
|
General notes
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNull()]
|
|
[object]$Tenant
|
|
)
|
|
|
|
$cert = (Get-ChildItem cert:\LocalMachine\My | Where-Object { $_.Subject -like "*``*.dev.alkamitech.com*" } -ErrorAction Ignore);
|
|
if ($null -eq $cert) {
|
|
throw "could not find the dev.alkamitech.com cert! Please install the Alkami developer certificates!"
|
|
}
|
|
|
|
Import-TenantsToServer -ConnectionString (Get-MasterConnectionString) -Tenants $Tenant
|
|
|
|
# Set all the client sigs
|
|
$tenantSignatures = $Tenant.Signature -split ','
|
|
foreach ($signature in $tenantSignatures) {
|
|
Update-HostsFileEntry -IpAddress '127.0.0.1' -Hostname $signature
|
|
if (!(Get-WebBinding -Name "WebClient" -Protocol https -Port 443 -IPAddress * -HostHeader $signature)) {
|
|
WebAdministration\New-WebBinding -Name "WebClient" -Protocol https -Port 443 -IPAddress * -HostHeader $signature -SslFlags 1 | Out-Null
|
|
(Get-WebBinding -Name "WebClient" -Protocol https -Port 443 -IPAddress * -HostHeader $signature).AddSslCertificate($cert.Thumbprint, "my");
|
|
}
|
|
}
|
|
|
|
# Set all the admin sigs
|
|
$tenantAdminSignatures = $Tenant.AdminSignature -split ','
|
|
foreach ($signature in $tenantAdminSignatures) {
|
|
Update-HostsFileEntry -IpAddress '127.0.0.1' -Hostname $signature
|
|
if (!(Get-WebBinding -Name "WebClientAdmin" -Protocol https -Port 443 -IPAddress * -HostHeader $signature)) {
|
|
WebAdministration\New-WebBinding -Name "WebClientAdmin" -Protocol https -Port 443 -IPAddress * -HostHeader $signature -SslFlags 1 | Out-Null
|
|
(Get-WebBinding -Name "WebClientAdmin" -Protocol https -Port 443 -IPAddress * -HostHeader $signature).AddSslCertificate($cert.Thumbprint, "my");
|
|
}
|
|
}
|
|
}
|