First version of subdomain takeover runbook

This commit is contained in:
Jurjen Ladenius
2021-09-01 16:25:01 +02:00
parent ec9d1d34ae
commit 3a348fc8b0
11 changed files with 810 additions and 187 deletions

View File

@@ -0,0 +1,17 @@
$AzureSQLServerName = "xxxx"
$AzureSQLDatabaseName = "yyyy"
$SQLOutput = ""
try {
$AzureSQLServerName = $AzureSQLServerName + ".database.windows.net"
$Cred = Get-AutomationPSCredential -Name "SQLServerUser-AzureAutomation"
$SQLOutput = $(Invoke-Sqlcmd -ServerInstance $AzureSQLServerName -Username $Cred.UserName -Password $Cred.GetNetworkCredential().Password -Database $AzureSQLDatabaseName -Query "exec [dbo].[AzureSQLMaintenance] @Operation='all' ,@LogToTable=1" -QueryTimeout 65535 -ConnectionTimeout 60 -Verbose) 4>&1
}
catch
{
Write-Host $_
throw "Error occured!"
}
finally {
Write-Output $SQLOutput
}