SqlSetup DsC Resource

Hi, powershell friends!

I’m trying to use the powershell dscresource SqlSetup for automating sql server installations. However i’m struggling with errors when trying to pass credentials parameters, the mof file is generated with nodename.mof.error.

My configuration mof file is like this:

[pre]

Import-DscResource -ModuleName SqlServerDsc

node ExampleNode

{
WindowsFeature ‘NetFramework45’
{
Name = ‘NET-Framework-45-Core’
Ensure = ‘Present’
}

SqlSetup ‘InstallDefaultInstance’
{
SourcePath = ‘C:\SQL2017’
InstanceName = ‘PROTHEUS’
AgtSvcAccount = ‘domain\user1’
AgtSvcStartupType = ‘Automatic’
BrowserSvcStartupType = ‘Automatic’
Features = ‘SQLENGINE’
InstallSharedDir = ‘E:\BIN\Program Files\Microsoft SQL Server’
InstallSharedWOWDir = ‘E:\BIN\Program Files (x86)\Microsoft SQL Server’
InstanceDir = ‘E:\DICT’
InstanceID = ‘PROTHEUS’
Sapwd = ‘totjahquonfdh12832719’
SecurityMode = ‘SQL’
SQLBackupDir = ‘F:\BACKUP\PROTHEUS’
SQLCollation = ‘Latin1_General_BIN’
SQLSvcAccount = ‘domain\user1’
SqlSvcStartupType = ‘Automatic’
SQLSysAdminAccounts = ‘domain\domaingroup’
SQLTempDBDir = ‘E:\TEMPDB\PROTHEUS’
SqlTempdbFileCount = ‘8’
SqlTempdbFileGrowth = ‘256’
SqlTempdbFileSize = ‘1024’
SQLTempDBLogDir = ‘E:\TEMPDB\PROTHEUS’
SqlTempdbLogFileGrowth = ‘256’
SqlTempdbLogFileSize = ‘1024’
SQLUserDBDir = ‘F:\DADOS\PROTHEUS’
SQLUserDBLogDir = ‘E:\LOG\PROTHEUS’
UpdateEnabled = ‘False’
UpdateSource = ‘MU’
DependsOn = ‘[WindowsFeature]NetFramework45’

}
}
}

[/pre]

 

Have anyone of you guys tried this Dsc resource?

How can i pass credentials securely and unsecurely in powershell dsc configurations?

 

Not a SQL guy and never used this resource, but from documentation all credentails are accepted as PSCredential, so you have to pass credential object and PFB articles on how to use credentials in DSC configuration.

See examples here if they can help.

https://github.com/PowerShell/SqlServerDsc/tree/dev/Examples/Resources/SqlSetup