You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$Skip= ($__dbcconfig|Where-Object Name -EQ'skip.database.compatibilitylevel').Value
218
218
219
-
Context "Compatibility level matches server compatibility level" {
219
+
Context "Compatibility level matches server compatibility level on <_.Name>" {
220
220
It "Database <_.Name> has the expected compatibility level on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database } else { $psitem.ConfigValues.compatexclude-notcontains$psitem.Name } } {
221
221
$psitem.CompatibilityLevel| Should -Be $psitem.ServerLevel-Because "it means you are on the appropriate compatibility level for your SQL Server version to use all available features."
$Skip= ($__dbcconfig|Where-Object Name -EQ'skip.security.guestuserconnect').Value
228
228
229
-
Context "Testing Guest user has CONNECT permission" {
229
+
Context "Testing Guest user has CONNECT permission on <_.Name>" {
230
230
It "Database Guest user should return no CONNECT permissions in <_.Name> on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database } else { $psitem.ConfigValues.guestuserexclude-notcontains$psitem.Name } } {
231
231
$psitem.GuestUserConnect| Should -BeFalse -Because "we don't want the guest user to have connect access to our database."
$Skip= ($__dbcconfig|Where-Object Name -EQ'skip.database.recoverymodel').Value
238
238
239
-
Context "Testing Recovery Model" {
239
+
Context "Testing Recovery Model on <_.Name>" {
240
240
It "Database <_.Name> should be set to <_.ConfigValues.recoverymodeltype> on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database } else { $psitem.ConfigValues.recoverymodelexclude-notcontains$psitem.Name } } {
241
241
$psitem.RecoveryModel| Should -Be $psitem.ConfigValues.recoverymodeltype-Because "You expect this recovery model."
$Skip= ($__dbcconfig|Where-Object Name -EQ'skip.database.pseudosimple').Value
248
248
249
-
Context "Testing database is not in PseudoSimple recovery model" {
249
+
Context "Testing database is not in PseudoSimple recovery model on <_.Name>" {
250
250
It "Database <_.Name> has PseudoSimple recovery model equal false on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database-and$_.RecoveryModel-eq'Full' } else { $psitem.ConfigValues.pseudosimpleexclude-notcontains$psitem.Name-and$_.RecoveryModel-eq'Full' } } {
251
251
$psitem.PseudoSimple| Should -BeFalse -Because "PseudoSimple means that a FULL backup has not been taken and the database is still effectively in SIMPLE mode"
$Skip= ($__dbcconfig|Where-Object Name -EQ'skip.security.containedbautoclose').Value
258
258
259
-
Context "Testing contained database auto close option" {
259
+
Context "Testing contained database auto close option on <_.Name>" {
260
260
It "Database <_.Name> should have auto close set to false on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database-and$_.ContainmentType-ne"NONE" } else { $psitem.ConfigValues.contdbautocloseexclude-notcontains$psitem.Name-and$_.ContainmentType-ne"NONE" } } {
261
261
$psitem.ContainedDbAutoClose| Should -BeFalse -Because "Contained Databases should have auto close set to false for CIS compliance."
Context "Testing contained database to see if sql authenticated users exist" {
271
+
Context "Testing contained database to see if sql authenticated users exist on <_.Name>" {
272
272
It "Database <_.Name> should have no sql authenticated users on <_.SqlInstance>"-Skip:$skip-ForEach $psitem.Databases.Where{ if ($Database) { $_.Name-in$Database-and$_.ContainmentType-ne"NONE" } else { $psitem.ConfigValues.contdbsqlauthexclude-notcontains$psitem.Name-and$_.ContainmentType-ne"NONE" } } {
273
273
$psitem.ContainedDbSqlAuthUsers| Should -Be 0-Because "We expect there to be no sql authenticated users in contained database."
0 commit comments