Details of the scenario you tried and the problem that is occurring
I'm using the SqlSetup DSC resource to install a multi-node SQL cluster. The primary node uses the InstallFailoverClusterAction parameter, while the secondary nodes use the AddNodeAction.
This works fine on an initial install.
However, subsequent runs of the same code on the primary node fails.
The SqlSetup resource runs through its Test function and then reports that the FailoverClusterIPAddress 'is not in the desired state for this cluster.' Of course, it then starts the Set function. IMHO, it shouldn't. Even if SQL is now active on another node in the cluster, the Test should still return that everything is in the desired state.
The SQLSetup resource proceeds to execute the Set function, but then that fails because Set also runs a Test and they don't agree.
Note: My code also includes a DSC Script that adds the IPs on the secondary nodes assigned for the SQL cluster as dependencies on the SQL Network cluster resource.
e.g.:
FWIW, subsequent runs on the secondary nodes (AddNode action) works just fine.
Verbose logs showing the problem
FailoverClusterIPAddress is not in the 'desired state':
VERBOSE: [AUE1SQL001D]: [[SqlSetup]InstallPrimaryInstance] Clustered install, checking
parameters.
VERBOSE: [AUE1SQL001D]: [[SqlSetup]InstallPrimaryInstance] FailoverClusterIPAddress
'172.31.100.234' is not in the desired state for this cluster.
VERBOSE: [AUE1SQL001D]: LCM: [ End Test ] [[SqlSetup]InstallPrimaryInstance] in 5.5990 seconds.
VERBOSE: [AUE1SQL001D]: LCM: [ Start Set ] [[SqlSetup]InstallPrimaryInstance]
Set function fails because it doesn't match the Test:
PowerShell DSC resource MSFT_SqlSetup failed to execute Set-TargetResource functionality with error message:
System.Exception: Test-TargetResource function returned false when Set-TargetResource function verified the desired state.
This indicates that the Set-TargetResource did not correctly set set the desired state,
or that the function Test-TargetResource does not correctly evaluate the desired state.
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
SqlSetup 'InstallPrimaryInstance' {
Action = 'InstallFailoverCluster'
ForceReboot = $false
UpdateEnabled = 'False'
SourcePath = '\\localhost\MSSQLmedia'
# SourceCredential is only included to force the installer to first copy the media
# to a local location. Installation from a remote share does not work consistently.
SourceCredential = $ADCredentials
InstanceName = $SQLInstanceName
Features = 'SQLENGINE,Replication,FullText,DQ'
InstallSharedDir = 'C:\Program Files\Microsoft SQL Server'
InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server'
InstanceDir = 'C:\Program Files\Microsoft SQL Server'
SQLCollation = 'SQL_Latin1_General_CP1_CI_AS'
SQLSvcAccount = $SQLPSCredentials
AgtSvcAccount = $SQLPSCredentials
SQLSysAdminAccounts = $DomainAdminUser, $SQLAdminUserAD
# Using Cluster Shared Volume
InstallSQLDataDir = "C:\ClusterStorage\SQL"
FailoverClusterNetworkName = $SQLClusterNetworkName
FailoverClusterIpAddress = $SQLClusterIP
PsDscRunAsCredential = $ADCredentials
DependsOn = '[WindowsFeature]NetFramework35', '[WindowsFeature]NetFramework45', '[xSmbShare]MSSQLMedia'
}
SQL Server edition and version the target node is running
Enterprise Edition 14.0.1000.169 (2017)
SQL Server PowerShell modules present on the target node
Name Version Path
---- ------- ----
SqlServer 21.1.18147 C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.1.18147\SqlServer.psd1
SQLPS 14.0 C:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules\SQLPS\SQLPS.psd1
The operating system the target node is running
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Details of the scenario you tried and the problem that is occurring
I'm using the
SqlSetup
DSC resource to install a multi-node SQL cluster. The primary node uses theInstallFailoverCluster
Action parameter, while the secondary nodes use theAddNode
Action.This works fine on an initial install.
However, subsequent runs of the same code on the primary node fails. The SqlSetup resource runs through its Test function and then reports that the FailoverClusterIPAddress 'is not in the desired state for this cluster.' Of course, it then starts the Set function. IMHO, it shouldn't. Even if SQL is now active on another node in the cluster, the Test should still return that everything is in the desired state.
The SQLSetup resource proceeds to execute the Set function, but then that fails because Set also runs a Test and they don't agree.
Note: My code also includes a DSC Script that adds the IPs on the secondary nodes assigned for the SQL cluster as dependencies on the SQL Network cluster resource.
e.g.:
FWIW, subsequent runs on the secondary nodes (AddNode action) works just fine.
Verbose logs showing the problem
FailoverClusterIPAddress is not in the 'desired state':
Set function fails because it doesn't match the Test:
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
SQL Server edition and version the target node is running
Enterprise Edition 14.0.1000.169 (2017)
SQL Server PowerShell modules present on the target node
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
SqlServerDsc 13.1.0.0 C:\Program Files\WindowsPowerShell\Modules\SqlServerDsc\13.1.0.0\SqlServerDsc.psd1