@@ -76,18 +76,20 @@ function Test-ThreatDetectionDatabaseUpdatePolicy
76
76
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
77
77
78
78
# Test
79
- Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " Sql_Injection" , " Sql_Injection_Vulnerability" , " Access_Anomaly"
79
+ Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " Sql_Injection" , " Sql_Injection_Vulnerability" , " Access_Anomaly" , " Data_Exfiltration " , " Unsafe_Action "
80
80
$policy = Get-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName
81
81
82
82
# Assert
83
83
Assert-AreEqual $policy.ThreatDetectionState " Enabled"
84
84
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
85
85
Assert-False {$policy.EmailAdmins }
86
- Assert-AreEqual $policy.ExcludedDetectionTypes.Count 3
86
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Count 5
87
87
Assert-AreEqual $policy.StorageAccountName $params.storageAccount
88
88
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
89
89
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
90
90
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
91
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Data_Exfiltration)}
92
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Unsafe_Action)}
91
93
92
94
# Test
93
95
Remove-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName
@@ -97,10 +99,12 @@ function Test-ThreatDetectionDatabaseUpdatePolicy
97
99
Assert-AreEqual $policy.ThreatDetectionState " Disabled"
98
100
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
99
101
Assert-False {$policy.EmailAdmins }
100
- Assert-AreEqual $policy.ExcludedDetectionTypes.Count 3
102
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Count 5
101
103
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
102
104
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
103
105
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
106
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Data_Exfiltration)}
107
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Unsafe_Action)}
104
108
105
109
# Test
106
110
Set-AzureRmSqlDatabaseThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - DatabaseName $params.databaseName - ExcludedDetectionType " None"
@@ -144,17 +148,19 @@ function Test-ThreatDetectionServerUpdatePolicy
144
148
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
145
149
146
150
# Test
147
- Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly - StorageAccountName $params.storageAccount
151
+ Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration , Unsafe_Action - StorageAccountName $params.storageAccount
148
152
$policy = Get-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName
149
153
150
154
# Assert
151
155
Assert-AreEqual $policy.ThreatDetectionState " Enabled"
152
156
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
153
157
Assert-False {$policy.EmailAdmins }
154
- Assert-AreEqual $policy.ExcludedDetectionTypes.Count 3
158
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Count 5
155
159
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
156
160
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
157
161
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
162
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Data_Exfiltration)}
163
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Unsafe_Action)}
158
164
159
165
# Test
160
166
Remove-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName
@@ -164,10 +170,12 @@ function Test-ThreatDetectionServerUpdatePolicy
164
170
Assert-AreEqual $policy.ThreatDetectionState " Disabled"
165
171
Assert-AreEqual $policy.NotificationRecipientsEmails " [email protected] ;[email protected] "
166
172
Assert-False {$policy.EmailAdmins }
167
- Assert-AreEqual $policy.ExcludedDetectionTypes.Count 3
173
+ Assert-AreEqual $policy.ExcludedDetectionTypes.Count 5
168
174
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection)}
169
175
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Sql_Injection_Vulnerability)}
170
176
Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Access_Anomaly)}
177
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Data_Exfiltration)}
178
+ Assert-True {$policy.ExcludedDetectionTypes.Contains ([Microsoft.Azure.Commands.Sql.ThreatDetection.Model.DetectionType ]::Unsafe_Action)}
171
179
172
180
# Test
173
181
Set-AzureRmSqlServerThreatDetectionPolicy - ResourceGroupName $params.rgname - ServerName $params.serverName - ExcludedDetectionType None - StorageAccountName $params.storageAccount
0 commit comments