ps/Modules/Alkami.PowerShell.SDK/Public/Invoke-DatabaseConfigurationAlkamiTenantTask.ps1

28 lines
926 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Invoke-DatabaseConfigurationAlkamiTenantTask {
[CmdletBinding()]
param (
[string[]]$TenantGuid
)
$logLead = Get-LogLeadName
$connectionString = Get-MasterConnectionString
# Get tenants for adding service accounts
$fullTenants = (Get-FullTenantListFromServer $connectionString)
$tenants = $fullTenants
Write-Host "$logLead : get tenants"
if (-not (Test-IsCollectionNullOrEmpty -Collection $TenantGuid)) {
Write-Host "$logLead : filter tenants because tenants were passed in"
$tenants = $fullTenants.Where({ $_.BankGuid.ToString() -in $TenantGuid })
}
# Add the service accounts
foreach ($tenant in $tenants) {
Write-Host "Adding local service accounts for `[$($tenant.Name) $($tenant.Signature)`]"
Add-LocalServiceAccountsToAlkamiDatabase -ConnectionString $tenant.ConnectionString -DatabaseName $tenant.Catalog
}
}