Skip to content

Commit

Permalink
SqlServerDsc: Commands support SQL Server 2022 (#1825)
Browse files Browse the repository at this point in the history
- The public commands `Add-SqlDscNode`, `Complete-SqlDscFailoverCluster`,
  `Complete-SqlDscImage`, `Install-SqlDscServer`, and `Repair-SqlDscServer`
  now support the setup argument `ProductCoveredBySA`.
- Private function `Invoke-SetupAction`
  - Was changed to support the SQL Server 2022 GA feature `AzureExtension`
    (that replaced the feature name `ARC`).
  - Support the setup argument `ProductCoveredBySA`.
  - No longer supports the argument `OnBoardSQLToARC` as it was removed in
    SQL Server 2022 GA.
- `Install-SqlDscServer`
  - Was changed to support the SQL Server 2022 GA feature `AzureExtension`
    (that replaced the feature name `ARC`).
- `Uninstall-SqlDscServer`
  - Was changed to support the SQL Server 2022 GA feature `AzureExtension`
    (that replaced the feature name `ARC`).
  • Loading branch information
johlju authored Dec 26, 2022
1 parent d709dc8 commit 1397e58
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 46 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added compatibility levels for SQL Server 2022 (major version 16).
- SqlSetup
- Paths for SQL Server 2022 are correctly returned by Get.
- The public commands `Add-SqlDscNode`, `Complete-SqlDscFailoverCluster`,
`Complete-SqlDscImage`, `Install-SqlDscServer`, and `Repair-SqlDscServer`
now support the setup argument `ProductCoveredBySA` ([issue #1798](https://github.com/dsccommunity/SqlServerDsc/issues/1798)).

### Changed

Expand All @@ -59,6 +62,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- No longer throws an exception when parameter `AgtSvcAccount` is not specified.
- SqlAgReplica
- Converted unit test to Pester 5.
- Private function `Invoke-SetupAction` ([issue #1798](https://github.com/dsccommunity/SqlServerDsc/issues/1798)).
- Was changed to support the SQL Server 2022 GA feature `AzureExtension`
(that replaced the feature name `ARC`).
- Support the setup argument `ProductCoveredBySA`.
- No longer supports the argument `OnBoardSQLToARC` as it was removed in
SQL Server 2022 GA.
- `Install-SqlDscServer`
- Was changed to support the SQL Server 2022 GA feature `AzureExtension`
(that replaced the feature name `ARC`) ([issue #1798](https://github.com/dsccommunity/SqlServerDsc/issues/1798)).
- `Uninstall-SqlDscServer`
- Was changed to support the SQL Server 2022 GA feature `AzureExtension`
(that replaced the feature name `ARC`) ([issue #1798](https://github.com/dsccommunity/SqlServerDsc/issues/1798)).

### Fixed

Expand Down
5 changes: 3 additions & 2 deletions source/Private/Assert-SetupActionProperties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ function Assert-SetupActionProperties
}
}

# If feature ARC is specified then the all the Azure* parameters must be set (except AzureArcProxy).
if ($Property.ContainsKey('Features') -and $Property.Features -contains 'ARC')
# If feature AzureExtension is specified then the all the Azure* parameters must be set (except AzureArcProxy).
if ($Property.ContainsKey('Features') -and $Property.Features -contains 'AZUREEXTENSION') # cSpell: disable-line
{
Assert-RequiredCommandParameter -BoundParameter $Property -RequiredParameter @(
'AzureSubscriptionId'
Expand All @@ -116,6 +116,7 @@ function Assert-SetupActionProperties
'AzureTenantId'
'AzureServicePrincipal'
'AzureServicePrincipalSecret'
'ProductCoveredBySA'
)
}

Expand Down
21 changes: 14 additions & 7 deletions source/Private/Invoke-SetupAction.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function Invoke-SetupAction
'SNAC_SDK', # Part of parent feature Tools (cspell: disable-line)
'SDK', # Part of parent feature Tools
'LocalDB', # Part of parent feature Tools
'ARC'
'AZUREEXTENSION'
)]
[System.String[]]
$Features,
Expand Down Expand Up @@ -1046,6 +1046,18 @@ function Invoke-SetupAction
[System.String[]]
$SkipRules,

[Parameter(ParameterSetName = 'Install')]
[Parameter(ParameterSetName = 'InstallRole')]
[Parameter(ParameterSetName = 'CompleteImage')]
[Parameter(ParameterSetName = 'Upgrade')]
[Parameter(ParameterSetName = 'InstallFailoverCluster')]
[Parameter(ParameterSetName = 'PrepareFailoverCluster')]
[Parameter(ParameterSetName = 'CompleteFailoverCluster')]
[Parameter(ParameterSetName = 'AddNode')]
[Parameter(ParameterSetName = 'EditionUpgrade')]
[System.Management.Automation.SwitchParameter]
$ProductCoveredBySA,

[Parameter()]
[System.UInt32]
$Timeout = 7200,
Expand Down Expand Up @@ -1079,7 +1091,7 @@ function Invoke-SetupAction
For this setup action the parameter Features is not part of the
parameter set, so this can be safely set.
#>
$PSBoundParameters.Features = @('ARC')
$PSBoundParameters.Features = @('AZUREEXTENSION')

break
}
Expand Down Expand Up @@ -1186,11 +1198,6 @@ function Invoke-SetupAction
{
$setupArgument += '={0}' -f ($PSBoundParameters.$parameterName.ToUpper() -join ',')

if ($PSBoundParameters.Features -contains 'ARC' -and $PSBoundParameters.Features -contains 'SQLENGINE')
{
$setupArgument += ' /ONBOARDSQLTOARC' # cspell: disable-line
}

break
}

Expand Down
4 changes: 4 additions & 0 deletions source/Public/Add-SqlDscNode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ function Add-SqlDscNode
[System.Management.Automation.SwitchParameter]
$ConfirmIPDependencyChange,

[Parameter()]
[System.Management.Automation.SwitchParameter]
$ProductCoveredBySA,

[Parameter()]
[System.UInt32]
$Timeout = 7200,
Expand Down
4 changes: 4 additions & 0 deletions source/Public/Complete-SqlDscFailoverCluster.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ function Complete-SqlDscFailoverCluster
[System.Management.Automation.SwitchParameter]
$ConfirmIPDependencyChange,

[Parameter()]
[System.Management.Automation.SwitchParameter]
$ProductCoveredBySA,

[Parameter()]
[System.UInt32]
$Timeout = 7200,
Expand Down
4 changes: 4 additions & 0 deletions source/Public/Complete-SqlDscImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ function Complete-SqlDscImage
[System.String]
$RSSvcStartupType,

[Parameter()]
[System.Management.Automation.SwitchParameter]
$ProductCoveredBySA,

[Parameter()]
[System.UInt32]
$Timeout = 7200,
Expand Down
11 changes: 10 additions & 1 deletion source/Public/Install-SqlDscServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function Install-SqlDscServer
'SNAC_SDK', # Part of parent feature Tools (cspell: disable-line)
'SDK', # Part of parent feature Tools
'LocalDB', # Part of parent feature Tools
'ARC'
'AZUREEXTENSION'
)]
[System.String[]]
$Features,
Expand Down Expand Up @@ -819,6 +819,15 @@ function Install-SqlDscServer
[System.String[]]
$SkipRules,

[Parameter(ParameterSetName = 'Install')]
[Parameter(ParameterSetName = 'InstallRole')]
[Parameter(ParameterSetName = 'Upgrade')]
[Parameter(ParameterSetName = 'InstallFailoverCluster')]
[Parameter(ParameterSetName = 'PrepareFailoverCluster')]
[Parameter(ParameterSetName = 'EditionUpgrade')]
[System.Management.Automation.SwitchParameter]
$ProductCoveredBySA,

[Parameter()]
[System.UInt32]
$Timeout = 7200,
Expand Down
2 changes: 1 addition & 1 deletion source/Public/Repair-SqlDscServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function Repair-SqlDscServer
'SNAC_SDK', # Part of parent feature Tools (cspell: disable-line)
'SDK', # Part of parent feature Tools
'LocalDB', # Part of parent feature Tools
'ARC'
'AZUREEXTENSION'
)]
[System.String[]]
$Features,
Expand Down
2 changes: 1 addition & 1 deletion source/Public/Uninstall-SqlDscServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Uninstall-SqlDscServer
'SNAC_SDK', # Part of parent feature Tools (cspell: disable-line)
'SDK', # Part of parent feature Tools
'LocalDB', # Part of parent feature Tools
'ARC'
'AZUREEXTENSION'
)]
[System.String[]]
$Features,
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Private/Assert-SetupActionProperties.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
}
}

Context 'When specifying feature ''ARC'' and required parameter ''<MockMissingParameterName>'' is missing' -ForEach @(
Context 'When specifying feature ''AZUREEXTENSION'' and required parameter ''<MockMissingParameterName>'' is missing' -ForEach @(
@{
MockParameters = @{
AzureResourceGroup = 'Value'
Expand Down Expand Up @@ -393,7 +393,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
{
$MockParameters.Features = @(
'SQLENGINE'
'ARC'
'AZUREEXTENSION'
'AS'
)

Expand Down
Loading

0 comments on commit 1397e58

Please sign in to comment.