Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ together to maintain important cookbooks. If you’d like to know more please vi
- Microsoft SQL Server 2017
- Microsoft SQL Server 2019
- Microsoft SQL Server 2022
- Microsoft SQL Server 2025

### Supported Client Versions

Expand Down
2 changes: 1 addition & 1 deletion documentation/sql_server_configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Properties

- `version` - SQL Version of the instance to be configured. Valid options are `2012`, `2016`, `2017`, `2019`, `2022`. Default is `2012`
- `version` - SQL Version of the instance to be configured. Valid options are `2012`, `2016`, `2017`, `2019`, `2022`, `2025`. Default is `2012`
- `tcp_enabled` - If TCP is enabled for the instance. Default is true
- `sql_port` - Port SQL will listen on. Default is 1433
- `tcp_dynamic_ports` - Sets the Dynamic port SQL will listen on. Default is an empty string
Expand Down
5 changes: 5 additions & 0 deletions libraries/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def self.reg_version_string(version)
when '2017' then 'MSSQL14.'
when '2019' then 'MSSQL15.'
when '2022' then 'MSSQL16.'
when '2025' then 'MSSQL17.'
else raise "Unsupported sql_server version '#{version}'. Please open a PR to add support for this version."
end
end
Expand All @@ -42,6 +43,7 @@ def self.install_dir_version(version)
when '2017' then '140'
when '2019' then '150'
when '2022' then '160'
when '2025' then '170'
else raise "SQL Server version #{version} not supported. Please open a PR to add support for this version."
end
end
Expand All @@ -59,6 +61,7 @@ def self.sql_server_url(version, x86_64)
when '2017' then 'https://download.microsoft.com/download/E/F/2/EF23C21D-7860-4F05-88CE-39AA114B014B/SQLEXPR_x64_ENU.exe'
when '2019' then 'https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLEXPR_x64_ENU.exe'
when '2022' then 'https://download.microsoft.com/download/5/1/4/5145fe04-4d30-4b85-b0d1-39533663a2f1/SQL2022-SSEI-Expr.exe'
when '2025' then 'https://download.microsoft.com/download/7ab8f535-7eb8-4b16-82eb-eca0fa2d38f3/SQL2025-SSEI-Expr.exe'
end
else
case version.to_s
Expand All @@ -75,6 +78,7 @@ def self.sql_server_package_name(version, x86_64)
when '2017' then 'Microsoft SQL Server 2017 (64-bit)'
when '2019' then 'Microsoft SQL Server 2019 (64-bit)'
when '2022' then 'Microsoft SQL Server 2022 (64-bit)'
when '2025' then 'Microsoft SQL Server 2025 (64-bit)'
end
else
case version.to_s
Expand All @@ -91,6 +95,7 @@ def self.sql_server_checksum(version, x86_64)
when '2017' then 'F857FF82145E196BF85AF32EEB0193FE38302E57B30BEB54E513630C60D83E0D'
when '2019' then 'bea033e778048748eb1c87bf57597f7f5449b6a15bac55ddc08263c57f7a1ca8'
when '2022' then '36e0ec2ac3dd60f496c99ce44722c629209ea7302a2ce9cbfd1e42a73510d7b6'
when '2025' then '1c677a33b318481c3217128835f8405cf0026621dcd04b13eb6cb0982e823f27'
end
else
case version.to_s
Expand Down
13 changes: 11 additions & 2 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
::SqlServer::Helper.sql_server_checksum(new_resource.version, x86_64) ||
::Chef::Application.fatal!("No package checksum matches '#{new_resource.version}'. package_checksum property must be set or version property must match a supported version.")

install_options = ['/q', "/ConfigurationFile=#{config_file_path}"]

# Build safe password command line options for the installer
# see http://technet.microsoft.com/library/ms144259
passwords_options = {
Expand All @@ -175,14 +177,21 @@
# When the number of double quotes is odd, we need to escape the enclosing quotes
enclosing_escape = safe_password.count('"').odd? ? '^' : ''
"/#{option}=\"#{safe_password}#{enclosing_escape}\""
end.compact.join ' '
end.compact

install_options.push(passwords_options)

# The SQL Server 2025 setup requires /IAcceptSQLServerLicenseTerms to be passed as a parameter not as a ini entry
if new_resource.accept_eula && new_resource.version.to_s == '2025'
install_options.push('/IAcceptSQLServerLicenseTerms')
end

package install_name do
source package_url
checksum install_checksum
timeout new_resource.installer_timeout
installer_type :custom
options "/q /ConfigurationFile=#{config_file_path} #{passwords_options}"
options install_options.join(' ')
action :install
notifies :reboot_now, 'reboot[sql server install]' if new_resource.sql_reboot
returns [0, 42, 127, 3010]
Expand Down
6 changes: 3 additions & 3 deletions templates/ConfigurationFile.ini.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ QUIET="False"

QUIETSIMPLE="False"

<% if @version != '2022' %>
<% unless %w(2022 2025).include?(@version.to_s) %>
; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

X86="False"
<% end%>
<% end %>

; Detailed help for command line argument ROLE has not been defined yet.

Expand Down Expand Up @@ -330,7 +330,7 @@ EXTSVCACCOUNT="NT Service\MSSQLLaunchpad"
<% end %>
<% end %>

<% if %w(2016 2017 2019 2022).include? @version %>
<% if %w(2016 2017 2019 2022 2025).include? @version %>
; Enables instant file initialization for SQL Server service account.
SQLSVCINSTANTFILEINIT="<%= @sql_instant_file_init ? "True" : "False" %>"

Expand Down
Loading