Skip to content

Instantly share code, notes, and snippets.

@jpomfret
Last active October 24, 2020 20:27
Show Gist options
  • Save jpomfret/9e110fd6aa220b1f245945becceb90fb to your computer and use it in GitHub Desktop.
Save jpomfret/9e110fd6aa220b1f245945becceb90fb to your computer and use it in GitHub Desktop.
Sample configuration to install SQL Server using MSAs for Services
$SQLSvcMSA = 'DOMAIN\MSASQLName$'
$AgtSvcMSA = 'DOMAIN\MSAAgentName$'
# These are required but not used since we are using MSAs
$SQLSvcAccount = New-Object System.Management.Automation.PSCredential($SQLSvcMSA, $('mypassword' | ConvertTo-SecureString -asPlainText -Force))
$AgtSvcAccount = New-Object System.Management.Automation.PSCredential($AgtSvcMSA, $('mypassword' | ConvertTo-SecureString -asPlainText -Force))
Configuration ServerBuild {
Import-DscResource -ModuleName 'PSDscResources'
Import-DscResource -ModuleName 'SqlServerDsc'
SqlSetup Install_SQL
{
SourcePath = '\\fileshare\SQL2017\developer\'
UpdateEnabled = $true
UpdateSource = '\\fileshare\SQL2017\Updates\'
InstanceName = 'MSSQLSERVER'
Features = 'SQLEngine'
SQLSvcAccount = $SQLSvcAccount
AgtSvcAccount = $AgtSvcAccount
SQLSysAdminAccounts = 'DOMAIN\SysAdminAccount'
InstallSQLDataDir = 'D:\'
SQLUserDBDir = 'D:\SQLData'
SQLUserDBLogDir = 'D:\DbLogs'
SQLTempDBDir = 'D:\SQLData'
SQLTempDBLogDir = 'D:\DbLogs'
SecurityMode = 'SQL'
SAPwd = $SAPwd
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment