Framework/Core/SubscriptionSecurity/SecurityCenterStatus.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using namespace System.Management.Automation
Set-StrictMode -Version Latest 

# The class serves as an intermediate class to call SecurityCenter class
# SecurityCenter class is being used in SubscriptionCore
class SecurityCenterStatus: AzCommandBase
{   
    
    [string] $SecurityContactEmails;
    [string] $SecurityPhoneNumber;

    SecurityCenterStatus([string] $subscriptionId, [InvocationInfo] $invocationContext): 
        Base($subscriptionId, $invocationContext)
    { }

    [string] SetPolicies([bool] $setOptionalPolicy)
    {    
        $secCenter = [SecurityCenter]::new($this.SubscriptionContext.SubscriptionId,$this.SecurityContactEmails, $this.SecurityPhoneNumber);

        if ($secCenter) 
        {
            $updatePolicies = $true;
            $updateSecurityContacts = $true;
            $updateProvisioningSettings = $true;
            return $this.InvokeFunction($secCenter.SetPolicies,@($updateProvisioningSettings,$updatePolicies,$updateSecurityContacts,$setOptionalPolicy));
        }

        return "";
    }
    
}