@@ -120,18 +120,19 @@ function Test-ThreatDetectionDatabaseUpdatePolicy
120
120
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
121
121
122
122
# Test
123
- Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " Sql_Injection" , " Sql_Injection_Vulnerability" , " Access_Anomaly"
123
+ Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " Sql_Injection" , " Sql_Injection_Vulnerability" , " Access_Anomaly" , " Usage_Anomaly "
124
124
$policy = Get-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName
125
125
126
126
# Assert
127
127
Assert-AreEqual $policy.ThreatDetectionState " Enabled"
128
128
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
129
129
Assert-False {$policy.EmailAdmins }
130
- Assert-AreEqual $policy.ExcludedDetectionTypes.Length 3
130
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Length 4
131
131
Assert-AreEqual $policy.StorageAccountName $params.storageAccount
132
132
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
133
133
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
134
134
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
135
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Usage_Anomaly)}
135
136
136
137
# Test
137
138
Remove-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName
@@ -141,10 +142,11 @@ function Test-ThreatDetectionDatabaseUpdatePolicy
141
142
Assert-AreEqual $policy.ThreatDetectionState " Disabled"
142
143
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
143
144
Assert-False {$policy.EmailAdmins }
144
- Assert-AreEqual $policy.ExcludedDetectionTypes.Length 3
145
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Length 4
145
146
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
146
147
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
147
148
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
149
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Usage_Anomaly)}
148
150
149
151
# Test
150
152
Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " None"
@@ -189,17 +191,18 @@ function Test-ThreatDetectionServerUpdatePolicy
189
191
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
190
192
191
193
# Test
192
- Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly - StorageAccountName $params.storageAccount
194
+ Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Usage_Anomaly - StorageAccountName $params.storageAccount
193
195
$policy = Get-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName
194
196
195
197
# Assert
196
198
Assert-AreEqual $policy.ThreatDetectionState " Enabled"
197
199
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
198
200
Assert-False {$policy.EmailAdmins }
199
- Assert-AreEqual $policy.ExcludedDetectionTypes.Length 3
201
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Length 4
200
202
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
201
203
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
202
204
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
205
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Usage_Anomaly)}
203
206
204
207
# Test
205
208
Remove-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName
@@ -209,10 +212,11 @@ function Test-ThreatDetectionServerUpdatePolicy
209
212
Assert-AreEqual $policy.ThreatDetectionState " Disabled"
210
213
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
211
214
Assert-False {$policy.EmailAdmins }
212
- Assert-AreEqual $policy.ExcludedDetectionTypes.Length 3
215
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Length 4
213
216
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
214
217
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
215
218
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
219
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Usage_Anomaly)}
216
220
217
221
# Test
218
222
Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType None - StorageAccountName $params.storageAccount
0 commit comments