Last active
May 2, 2018 19:08
-
-
Save yorek/2fda2e9219c0e4c8a307c820f9094063 to your computer and use it in GitHub Desktop.
Get information needed to comply with a security audit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Login-AzureRmAccount | |
Select-AzureRmSubscription -Subscription <your-subscription-id> | |
$servers = Get-AzureRmSqlServer | |
foreach($s in $servers) { | |
$databases = Get-AzureRmSqlDatabase -ServerName $s.ServerName -ResourceGroupName $s.ResourceGroupName | |
foreach ($d in $databases) | |
{ | |
$audit = Get-AzureRmSqlDatabaseAuditing -ServerName $s.ServerName -ResourceGroupName $s.ResourceGroupName -DatabaseName $d.DatabaseName | |
$threatDetection = Get-AzureRmSqlDatabaseThreatDetectionPolicy -ServerName $s.ServerName -ResourceGroupName $s.ResourceGroupName -DatabaseName $d.DatabaseName | |
$tde = Get-AzureRmSqlDatabaseTransparentDataEncryption -ServerName $s.ServerName -ResourceGroupName $s.ResourceGroupName -DatabaseName $d.DatabaseName | |
Write-Host $s.ServerName, $d.DatabaseName, $audit.AuditState, $threatDetection.ThreatDetectionState, $tde.State | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment