Skip to content

Instantly share code, notes, and snippets.

@yorek
Last active May 2, 2018 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorek/2fda2e9219c0e4c8a307c820f9094063 to your computer and use it in GitHub Desktop.
Save yorek/2fda2e9219c0e4c8a307c820f9094063 to your computer and use it in GitHub Desktop.
Get information needed to comply with a security audit
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