Skip to content

Commit 80a17ac

Browse files
committed
2 parents 32e24fb + 9911296 commit 80a17ac

1 file changed

Lines changed: 38 additions & 8 deletions

File tree

src/Outsystems.SetupTools/Functions/Set-OSServerConfig.ps1

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ function Set-OSServerConfig
4949
.PARAMETER UpgradeEnvironment
5050
If specified, the configuration tool will upgrade all applications in the environment to the new version
5151
52+
.PARAMETER IntegratedAuthPassword
53+
If specified, the configuration tool will upgrade the environment using integrated auth
54+
55+
.EXAMPLE
56+
Set-OSServerConfig -Apply -UpgradeEnvironment -IntegratedAuthPassword 'password'
57+
5258
.EXAMPLE
5359
Set-OSServerConfig -SettingSection 'CacheInvalidationConfiguration' -Setting 'ServiceUsername' -Value 'admin'
5460
@@ -138,8 +144,15 @@ function Set-OSServerConfig
138144
$UpgradeEnvironmentAttribCollection.Add($UpgradeEnvironmentAttrib)
139145
$UpgradeEnvironmentParam = New-Object System.Management.Automation.RuntimeDefinedParameter('UpgradeEnvironment', [switch], $UpgradeEnvironmentAttribCollection)
140146

147+
$IntegratedAuthPasswordAttrib = New-Object System.Management.Automation.ParameterAttribute
148+
$IntegratedAuthPasswordAttrib.ParameterSetName = 'ApplyConfig'
149+
$IntegratedAuthPasswordAttribCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
150+
$IntegratedAuthPasswordAttribCollection.Add($IntegratedAuthPasswordAttrib)
151+
$IntegratedAuthPasswordParam = New-Object System.Management.Automation.RuntimeDefinedParameter('IntegratedAuthPassword', [string], $IntegratedAuthPasswordAttribCollection)
152+
141153
$paramDictionary.Add('ConfigureCacheInvalidationService', $ConfigureCacheInvalidationServiceParam)
142154
$paramDictionary.Add('LogDBCredential', $LogDBCredentialParam)
155+
$paramDictionary.Add('IntegratedAuthPassword', $IntegratedAuthPasswordParam)
143156
$paramDictionary.Add('UpgradeEnvironment', $UpgradeEnvironmentParam)
144157
}
145158
}
@@ -189,6 +202,15 @@ function Set-OSServerConfig
189202

190203
return $null
191204
}
205+
206+
if (($PSBoundParameters.IntegratedAuthPassword.IsPresent) -and (-not $PSBoundParameters.UpgradeEnvironment.IsPresent))
207+
{
208+
$errorMessage = "SetupTools is currently only supporting integrated auth with upgrade environment option."
209+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 3 -Message $errorMessage
210+
WriteNonTerminalError -Message $errorMessage
211+
212+
return $null
213+
}
192214
#endregion
193215

194216
#region do things
@@ -298,12 +320,26 @@ function Set-OSServerConfig
298320
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Building configuration tool command line"
299321

300322
# Build the command line
301-
$configToolArguments = "/setupinstall "
323+
if ($PSBoundParameters.UpgradeEnvironment.IsPresent)
324+
{
325+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Upgrade of environment will be performed"
326+
$configToolArguments = "/UpgradeEnvironment"
327+
}
328+
else
329+
{
330+
$configToolArguments = "/setupinstall"
331+
}
302332

303-
if ($PlatformDBCredential)
333+
if ($PSBoundParameters.IntegratedAuthPassword.IsPresent)
334+
{
335+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Using supplied password for the Integrated Auth User"
336+
$configToolArguments += "$IntegratedAuthPassword "
337+
}
338+
elseif ($PlatformDBCredential)
304339
{
305340
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Using supplied admin credentials for the platform database"
306341
$dbUser = $PlatformDBCredential.UserName
342+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Using $dbUser for the platform database"
307343
$dbPass = $PlatformDBCredential.GetNetworkCredential().Password
308344
$configToolArguments += "$dbUser $dbPass "
309345
}
@@ -353,12 +389,6 @@ function Set-OSServerConfig
353389
$configToolArguments += "/createupgradecacheinvalidationservice "
354390
}
355391

356-
if ($PSBoundParameters.UpgradeEnvironment.IsPresent)
357-
{
358-
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Upgrade of environment will be performed"
359-
$configToolArguments += "/UpgradeEnvironment "
360-
}
361-
362392
if ($PSBoundParameters.InstallServiceCenter.IsPresent)
363393
{
364394
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Installation of Service Center will be performed"

0 commit comments

Comments
 (0)