Framework/Core/SVT/SVTStatusReport.ps1
Set-StrictMode -Version Latest class SVTStatusReport : SVTCommandBase { [SVTResourceResolver] $ServicesResolver = $null; SVTStatusReport([string] $subscriptionId, [InvocationInfo] $invocationContext, [SVTResourceResolver] $resolver): Base($subscriptionId, $invocationContext) { if(-not $resolver) { throw [System.ArgumentException] ("The argument 'resolver' is null"); } $this.ServicesResolver = $resolver; $this.ServicesResolver.LoadAzureResources(); } hidden [SVTEventContext[]] RunAllControls() { [SVTEventContext[]] $result = @(); # Run all Subscription security controls try { $this.PublishCustomMessage(" `r`n" + [Constants]::DoubleDashLine + "`r`nStarted Subscription security controls`r`n" + [Constants]::DoubleDashLine); $sscore = [SubscriptionSecurityStatus]::new($this.SubscriptionContext.SubscriptionId, $this.InvocationContext); if ($sscore) { # Just copy all the tags without validation. Validation will be done internally $sscore.FilterTags = $this.FilterTags; $sscore.ExcludeTags = $this.ExcludeTags; $sscore.ControlIdString = $this.ControlIdString; $sscore.GenerateFixScript = $this.GenerateFixScript; $sscore.AttestationOptions = $this.AttestationOptions; $result += $sscore.RunAllControls(); $this.PublishCustomMessage([Constants]::DoubleDashLine + "`r`nCompleted Subscription security controls`r`n" + [Constants]::DoubleDashLine, [MessageType]::Update); } } catch { $this.CommandError($_); } # Run all Azure services security controls try { $this.PublishCustomMessage(" `r`n" + [Constants]::DoubleDashLine + "`r`nStarted Azure services security controls`r`n" + [Constants]::DoubleDashLine); $secStatus = [ServicesSecurityStatus]::new($this.SubscriptionContext.SubscriptionId, $this.InvocationContext, $this.ServicesResolver); if ($secStatus) { # Just copy all the tags without validation. Validation will be done internally $secStatus.FilterTags = $this.FilterTags; $secStatus.ExcludeTags = $this.ExcludeTags; $secStatus.ControlIdString = $this.ControlIdString; $secStatus.GenerateFixScript = $this.GenerateFixScript; $secStatus.AttestationOptions = $this.AttestationOptions; $result += $secStatus.RunAllControls(); $this.PublishCustomMessage([Constants]::DoubleDashLine + "`r`nCompleted Azure services security controls`r`n" + [Constants]::DoubleDashLine, [MessageType]::Update); } } catch { $this.CommandError($_); } return $result; } } |