flcdrg / au-packages

David's Chocolatey Automatic Packages
MIT License
18 stars 52 forks source link

[sql-server-2022] SQL 2022 dev cluster install fails when adding additional nodes #168

Open ccpDeNormalized opened 5 months ago

ccpDeNormalized commented 5 months ago

When adding a secondary node to a sql 2022 dev cluster choco install fails with:

Exit message: The setting 'SQLSYSADMINACCOUNTS' is not allowed when the value of setting 'ACTION' is 'AddNode'.

This is because choco defaults to adding SQLSYSADMINACCOUNTS as current user if it is not included in the config file. However, SQL server does not support this param when adding a cluster node.

"/SQLSYSADMINACCOUNTS: - A username or group to add to the SQL SysAdmin role - defaults to current user. This option is only set if configurationfile.ini does not contain 'SQLSYSADMINACCOUNTS=' at the start of a line.

The problem code is within chocolatelyinstall.ps1 - this should only add if not present and action <> addnode

if (!$pp['SQLSYSADMINACCOUNTS']) {

Test for presence of "^SQLSYSADMINACCOUNTS=" in the ini - add the default only if not present

if (-not ((Get-Content -Path $($pp['CONFIGURATIONFILE'])) -match "^SQLSYSADMINACCOUNTS=")) { $pp['SQLSYSADMINACCOUNTS'] = "$env:USERDOMAIN\$env:USERNAME" } }