Skip to content

Commit

Permalink
Bump SqlServer version for SQL Server 2022 integration tests (#1899)
Browse files Browse the repository at this point in the history
- SqlServerDsc
  - Bump SqlServer version to 22.0.59 for integration tests for SQL Server 2022.
- SqlServerDsc.Common
  - `Invoke-SqlScript` no longer passes the parameter `Variable` to
    `Invoke-SqlCmd` if it is not set (issue #1896).
- `DatabasePermission`
  - Class was updated with the latest database permissions.
  • Loading branch information
johlju authored Apr 10, 2023
1 parent 4dc1bee commit 501bfe1
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update the initializing header for all integration test to be equal to
the unit tests.
- Rename task jobs in Azure Pipelines ([issue #1881](https://github.com/dsccommunity/SqlServerDsc/issues/1881)).
- Bump SqlServer version to 22.0.59 for integration tests for SQL Server 2022.
- `Get-SqlDscAudit`
- The parameter `Name` is no longer mandatory. When left out all the current
audits are returned ([issue #1812](https://github.com/dsccommunity/SqlServerDsc/issues/1812)).
Expand All @@ -65,6 +66,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the instance to go online. If the instance has not gone online during
the timeout period the error thrown will no contain the last error
reported by `Connect-SQL` ([issue #1891](https://github.com/dsccommunity/SqlServerDsc/issues/1891)).
- `Invoke-SqlScript` no longer passes the parameter `Variable` to
`Invoke-SqlCmd` if it is not set ([issue #1896](https://github.com/dsccommunity/SqlServerDsc/issues/1896)).
- `DatabasePermission`
- Class was updated with the latest database permissions.

### Fixed

Expand Down
71 changes: 55 additions & 16 deletions source/Classes/002.DatabasePermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,73 +43,112 @@ class DatabasePermission : IComparable, System.IEquatable[Object]
[DscProperty(Mandatory)]
[AllowEmptyCollection()]
[ValidateSet(
'AdministerDatabaseBulkOperations',
'Alter',
'AlterAnyAsymmetricKey',
'AlterAnyApplicationRole',
'AlterAnyAssembly',
'AlterAnyAsymmetricKey',
'AlterAnyCertificate',
'AlterAnyColumnEncryptionKey',
'AlterAnyColumnMasterKey',
'AlterAnyContract',
'AlterAnyDatabaseAudit',
'AlterAnyDataspace',
'AlterAnyDatabaseDdlTrigger',
'AlterAnyDatabaseEventNotification',
'AlterAnyDatabaseEventSession',
'AlterAnyDatabaseEventSessionAddEvent',
'AlterAnyDatabaseEventSessionAddTarget',
'AlterAnyDatabaseEventSessionDisable',
'AlterAnyDatabaseEventSessionDropEvent',
'AlterAnyDatabaseEventSessionDropTarget',
'AlterAnyDatabaseEventSessionEnable',
'AlterAnyDatabaseEventSessionOption',
'AlterAnyDatabaseScopedConfiguration',
'AlterAnyDataspace',
'AlterAnyExternalDataSource',
'AlterAnyExternalFileFormat',
'AlterAnyExternalJob',
'AlterAnyExternalLanguage',
'AlterAnyExternalLibrary',
'AlterAnyExternalStream',
'AlterAnyFulltextCatalog',
'AlterAnyMask',
'AlterAnyMessageType',
'AlterAnyRemoteServiceBinding',
'AlterAnyRole',
'AlterAnyRoute',
'AlterAnyRemoteServiceBinding',
'AlterAnyContract',
'AlterAnySymmetricKey',
'AlterAnySchema',
'AlterAnySecurityPolicy',
'AlterAnySensitivityClassification',
'AlterAnyService',
'AlterAnyDatabaseDdlTrigger',
'AlterAnySymmetricKey',
'AlterAnyUser',
'AlterLedger',
'AlterLedgerConfiguration',
'Authenticate',
'BackupDatabase',
'BackupLog',
'Control',
'Checkpoint',
'Connect',
'ConnectReplication',
'Checkpoint',
'Control',
'CreateAggregate',
'CreateAsymmetricKey',
'CreateAnyDatabaseEventSession',
'CreateAssembly',
'CreateAsymmetricKey',
'CreateCertificate',
'CreateContract',
'CreateDatabase',
'CreateDefault',
'CreateDatabaseDdlEventNotification',
'CreateFunction',
'CreateDefault',
'CreateExternalLanguage',
'CreateExternalLibrary',
'CreateFulltextCatalog',
'CreateFunction',
'CreateMessageType',
'CreateProcedure',
'CreateQueue',
'CreateRemoteServiceBinding',
'CreateRole',
'CreateRoute',
'CreateRule',
'CreateRemoteServiceBinding',
'CreateContract',
'CreateSymmetricKey',
'CreateSchema',
'CreateSynonym',
'CreateService',
'CreateSymmetricKey',
'CreateSynonym',
'CreateTable',
'CreateType',
'CreateUser',
'CreateView',
'CreateXmlSchemaCollection',
'Delete',
'DropAnyDatabaseEventSession',
'EnableLedger',
'Execute',
'ExecuteAnyExternalEndpoint',
'ExecuteAnyExternalScript',
'Insert',
'KillDatabaseConnection',
'OwnershipChaining',
'References',
'Select',
'Showplan',
'SubscribeQueryNotifications',
'TakeOwnership',
'Unmask',
'Update',
'ViewAnyColumnEncryptionKeyDefinition',
'ViewAnyColumnMasterKeyDefinition',
'ViewAnySensitivityClassification',
'ViewCryptographicallySecuredDefinition',
'ViewDatabasePerformanceState',
'ViewDatabaseSecurityAudit',
'ViewDatabaseSecurityState',
'ViewDatabaseState',
'ViewDefinition',
'ViewDatabaseState'
'ViewLedgerContent',
'ViewPerformanceDefinition',
'ViewSecurityDefinition'
)]
[System.String[]]
$Permission
Expand Down
18 changes: 14 additions & 4 deletions source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2021,18 +2021,18 @@ function Test-ActiveNode
.PARAMETER QueryTimeout
Specifies, as an integer, the number of seconds after which the T-SQL
script execution will time out. In some SQL Server versions there is a
bug in Invoke-Sqlcmd where the normal default value 0 (no timeout) is not
bug in Invoke-SqlCmd where the normal default value 0 (no timeout) is not
respected and the default value is incorrectly set to 30 seconds.
.PARAMETER Variable
Creates a Invoke-Sqlcmd scripting variable for use in the Invoke-Sqlcmd
Creates a Invoke-SqlCmd scripting variable for use in the Invoke-SqlCmd
script, and sets a value for the variable.
.PARAMETER DisableVariables
Specifies, as a boolean, whether or not PowerShell will ignore sqlcmd
Specifies, as a boolean, whether or not PowerShell will ignore Invoke-SqlCmd
scripting variables that share a format such as $(variable_name). For more
information how to use this, please go to the help documentation for
[Invoke-Sqlcmd](https://docs.microsoft.com/en-us/powershell/module/sqlserver/Invoke-Sqlcmd).
[Invoke-SqlCmd](https://docs.microsoft.com/en-us/powershell/module/sqlserver/Invoke-Sqlcmd).
.PARAMETER Encrypt
Specifies how encryption should be enforced. When not specified, the default
Expand All @@ -2044,6 +2044,11 @@ function Test-ActiveNode
This parameter can only be used when the module SqlServer v22.x.x is installed.
.NOTES
This wrapper for Invoke-SqlCmd make verbose functionality of PRINT and
RAISEERROR statements work as those are outputted in the verbose output
stream. For some reason having the wrapper in a separate module seems to
trigger (so that it works getting) the verbose output for those statements.
Parameter `Encrypt` controls whether the connection used by `Invoke-SqlCmd`
should enforce encryption. This parameter can only be used together with the
module _SqlServer_ v22.x (minimum v22.0.49-preview). The parameter will be
Expand Down Expand Up @@ -2129,6 +2134,11 @@ function Invoke-SqlScript
}
}

if ([System.String]::IsNullOrEmpty($Variable))
{
$null = $PSBoundParameters.Remove('Variable')
}

Invoke-SqlCmd @PSBoundParameters
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DSC_SqlSetup.config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ else
# Features CONN, BC, SDK, SNAC_SDK, DREPLAY_CLT, DREPLAY_CTLR are no longer supported in 2022.
SupportedFeatures = 'SQLENGINE,REPLICATION'

SqlServerModuleVersion = '22.0.49-preview'
SqlServerModuleVersion = '22.0.59'
}
}

Expand Down

0 comments on commit 501bfe1

Please sign in to comment.