@@ -131,7 +131,8 @@ function Test-SynapseSqlPool
131
131
132
132
<#
133
133
. SYNOPSIS
134
- Tests Synapse Workspace SQL Pool Auditing settings.
134
+ Tests Synapse SQL Pool Security settings.
135
+ Including SQL Pool Auditing settings, Advanced threat protection settings, Vulnerability assessment settings and Transparent Data Encryption.
135
136
#>
136
137
function Test-SynapseSqlPool-Security
137
138
{
@@ -151,22 +152,62 @@ function Test-SynapseSqlPool-Security
151
152
$sqlPoolName = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer ]::GetVariable(" sqlPoolName" , $sqlPoolName )
152
153
$account = New-AzStorageAccount - ResourceGroupName $resourceGroupName - Name $storageGen2AccountName - Location $location - SkuName Standard_LRS - Kind StorageV2
153
154
154
- # Set SQL Auditing
155
+ # Set SQL Pool Auditing
155
156
Set-AzSynapseSqlPoolAudit - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - BlobStorageTargetState Enabled - StorageAccountResourceId $account.id - StorageKeyType Primary
156
157
157
- # Get SQL Auditing
158
+ # Get SQL Pool Auditing
158
159
$auditing = Get-AzSynapseSqlPoolAudit - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName
159
160
160
161
Assert-AreEqual $auditing.BlobStorageTargetState Enabled
161
162
Assert-AreEqual $auditing.StorageAccountResourceId $account.id
162
163
163
- # Remove SQL Auditing
164
+ # Set SQL Pool Advanced threat protection
165
+ $threatProtectionSet = Update-AzSynapseSqlPoolAdvancedThreatProtectionSetting - ResourceGroupName
$resourceGroupName - WorkspaceName
$workspaceName - Name
$sqlPoolName - NotificationRecipientsEmails
" [email protected] ;[email protected] " `
166
+ - EmailAdmins $False - ExcludedDetectionType " Sql_Injection" , " Unsafe_Action" - StorageAccountName $storageGen2AccountName
167
+
168
+ Assert-AreEqual $threatProtectionSet.ThreatDetectionState Enabled
169
+ Assert-AreEqual $threatProtectionSet.StorageAccountName $storageGen2AccountName
170
+
171
+ # Set SQL Pool Vulnerability assessment
172
+ $vulnerabilityAssessmentSet = Update-AzSynapseSqlPoolVulnerabilityAssessmentSetting - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - StorageAccountName $storageGen2AccountName `
173
+ - RecurringScansInterval Weekly
- EmailAdmins
$False - NotificationEmail
" [email protected] " , " [email protected] "
174
+
175
+ Assert-AreEqual $vulnerabilityAssessmentSet.StorageAccountName $storageGen2AccountName
176
+ Assert-AreEqual $vulnerabilityAssessmentSet.RecurringScansInterval Weekly
177
+
178
+ # Remove SQL Pool Vulnerability assessment
179
+ Assert-True {Clear-AzSynapseSqlPoolVulnerabilityAssessmentSetting - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - PassThru}
180
+
181
+ # Verify that SQL Pool Vulnerability assessment was deleted
182
+ $vulnerabilityAssessmentGet = Get-AzSynapseSqlPoolVulnerabilityAssessmentSetting - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName
183
+
184
+ Assert-AreEqual $vulnerabilityAssessmentGet.RecurringScansInterval None
185
+
186
+ # Remove SQL Pool Advanced threat protection
187
+ Assert-True {Clear-AzSynapseSqlPoolAdvancedThreatProtectionSetting - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - PassThru}
188
+
189
+ # Verify that SQL Pool Advanced threat protection was deleted
190
+ $threatProtectionGet = Get-AzSynapseSqlPoolAdvancedThreatProtectionSetting - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName
191
+
192
+ Assert-AreEqual $threatProtectionGet.ThreatDetectionState Disabled
193
+
194
+ # Remove SQL Pool Auditing
164
195
Assert-True {Remove-AzSynapseSqlPoolAudit - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - PassThru}
165
196
166
- # Verify that SQL Auditing was deleted
197
+ # Verify that SQL Pool Auditing was deleted
167
198
$auditing = Get-AzSynapseSqlPoolAudit - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName
168
199
169
200
Assert-AreEqual $auditing.BlobStorageTargetState Disabled
201
+
202
+ # Set SQL Pool Transparent Data Encryption
203
+ $tdeSet = Set-AzSynapseSqlPoolTransparentDataEncryption - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName - State Enabled
204
+
205
+ Assert-AreEqual $tdeSet.State Enabled
206
+
207
+ # Get SQL Pool Transparent Data Encryption
208
+ $tdeGet = Get-AzSynapseSqlPoolTransparentDataEncryption - ResourceGroupName $resourceGroupName - WorkspaceName $workspaceName - Name $sqlPoolName
209
+
210
+ Assert-AreEqual $tdeGet.State Enabled
170
211
}
171
212
finally
172
213
{
0 commit comments