diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d57f09b..311105dea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)). @@ -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 diff --git a/source/Classes/002.DatabasePermission.ps1 b/source/Classes/002.DatabasePermission.ps1 index e71fbd04b..09915de7c 100644 --- a/source/Classes/002.DatabasePermission.ps1 +++ b/source/Classes/002.DatabasePermission.ps1 @@ -43,64 +43,93 @@ 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', @@ -108,8 +137,18 @@ class DatabasePermission : IComparable, System.IEquatable[Object] 'TakeOwnership', 'Unmask', 'Update', + 'ViewAnyColumnEncryptionKeyDefinition', + 'ViewAnyColumnMasterKeyDefinition', + 'ViewAnySensitivityClassification', + 'ViewCryptographicallySecuredDefinition', + 'ViewDatabasePerformanceState', + 'ViewDatabaseSecurityAudit', + 'ViewDatabaseSecurityState', + 'ViewDatabaseState', 'ViewDefinition', - 'ViewDatabaseState' + 'ViewLedgerContent', + 'ViewPerformanceDefinition', + 'ViewSecurityDefinition' )] [System.String[]] $Permission diff --git a/source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1 b/source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1 index 33f42dbe5..bd26e087a 100644 --- a/source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1 +++ b/source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1 @@ -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 @@ -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 @@ -2129,6 +2134,11 @@ function Invoke-SqlScript } } + if ([System.String]::IsNullOrEmpty($Variable)) + { + $null = $PSBoundParameters.Remove('Variable') + } + Invoke-SqlCmd @PSBoundParameters } diff --git a/tests/Integration/DSC_SqlSetup.config.ps1 b/tests/Integration/DSC_SqlSetup.config.ps1 index 0dccbeffc..80f2fe738 100644 --- a/tests/Integration/DSC_SqlSetup.config.ps1 +++ b/tests/Integration/DSC_SqlSetup.config.ps1 @@ -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' } }