Modules/Private/2.ProcessingFunctions/Start-ARIExtraJobs.ps1
function Start-ARIExtraJobs { Param ($SkipDiagram, $SkipAdvisory, $SkipPolicy, $SecurityCenter, $Subscriptions, $Resources, $Advisories, $DDFile, $DiagramCache, $FullEnv, $ResourceContainers, $Security, $PolicyDef, $PolicySetDef, $PolicyAssign, $Automation, $Debug) if ($Debug.IsPresent) { $DebugPreference = 'Continue' $ErrorActionPreference = 'Continue' } else { $ErrorActionPreference = "silentlycontinue" } $ARIModule = 'AzureResourceInventory' #$ARIModule = 'C:\usr\src\PSModules\AzureResourceInventory\AzureResourceInventory' <######################################################### DRAW IO DIAGRAM JOB ######################################################################> Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking if Draw.io Diagram Job Should be Run.') if (!$SkipDiagram.IsPresent) { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Draw.io Diagram Processing Job.') Invoke-ARIDrawIOJob -Subscriptions $Subscriptions -Resources $Resources -Advisories $Advisories -DDFile $DDFile -DiagramCache $DiagramCache -FullEnv $FullEnv -ResourceContainers $ResourceContainers -Automation $Automation -ARIModule $ARIModule -Debug $Debug } <######################################################### VISIO DIAGRAM JOB ######################################################################> <# Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking if Visio Diagram Job Should be Run.') if ($Diagram.IsPresent) { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Visio Diagram Processing Job.') Start-job -Name 'VisioDiagram' -ScriptBlock { If ($($args[5]) -eq $true) { $ModuSeq = (New-Object System.Net.WebClient).DownloadString($($args[7]) + '/Extras/VisioDiagram.ps1') } Else { $ModuSeq0 = New-Object System.IO.StreamReader($($args[0]) + '\Extras\VisioDiagram.ps1') $ModuSeq = $ModuSeq0.ReadToEnd() $ModuSeq0.Dispose() } $ScriptBlock = [Scriptblock]::Create($ModuSeq) $VisioRun = ([PowerShell]::Create()).AddScript($ScriptBlock).AddArgument($($args[1])).AddArgument($($args[2])).AddArgument($($args[3])).AddArgument($($args[4])) $VisioJob = $VisioRun.BeginInvoke() while ($VisioJob.IsCompleted -contains $false) {} $VisioRun.EndInvoke($VisioJob) $VisioRun.Dispose() } -ArgumentList $PSScriptRoot, $Subscriptions, $Resources, $Advisories, $DFile, $RunOnline, $Repo, $RawRepo | Out-Null } #> <######################################################### SECURITY CENTER JOB ######################################################################> Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking If Should Run Security Center Job.') if (![string]::IsNullOrEmpty($SecurityCenter)) { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Security Processing Job.') Invoke-ARISecurityCenterJob -Subscriptions $Subscriptions -Automation $Automation -Resources $Resources -SecurityCenter $SecurityCenter -ARIModule $ARIModule -Debug $Debug } <######################################################### POLICY JOB ######################################################################> Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking If Should Run Policy Job.') if (!$SkipPolicy.IsPresent) { if (![string]::IsNullOrEmpty($PolicyAssign) -and ![string]::IsNullOrEmpty($PolicyDef)) { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Policy Processing Job.') Invoke-ARIPolicyJob -Subscriptions $Subscriptions -PolicySetDef $PolicySetDef -PolicyAssign $PolicyAssign -PolicyDef $PolicyDef -ARIModule $ARIModule -Automation $Automation -Debug $Debug } } <######################################################### ADVISORY JOB ######################################################################> Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking If Should Run Advisory Job.') if (!$SkipAdvisory.IsPresent) { if (![string]::IsNullOrEmpty($Advisories)) { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Advisory Processing Job.') Invoke-ARIAdvisoryJob -Advisories $Advisories -ARIModule $ARIModule -Automation $Automation -Debug $Debug } } <######################################################### SUBSCRIPTIONS JOB ######################################################################> Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Subscriptions Processing job.') Invoke-ARISubJob -Subscriptions $Subscriptions -Automation $Automation -Resources $Resources -ARIModule $ARIModule -Debug $Debug } |