DscResources/PowerPlatform/PowerPlatform.schema.psm1

# (2024-11-08 01:25:35) Generated using Microsoft365DSC v1.24.1106.1
Configuration 'PowerPlatform'
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $ApplicationId,

        [Parameter(Mandatory = $true)]
        [System.String]
        $TenantId,

        [Parameter(Mandatory = $true)]
        [System.String]
        $CertificateThumbprint
    )

    Import-DscResource -ModuleName Microsoft365DSC

    foreach ($AdminDLPPolicy in $ConfigurationData.NonNodeData.PowerPlatform.AdminDLPPolicies)
    {
        $resourceTitle = 'PPAdminDLPPolicy-{0}' -f $AdminDLPPolicy.DisplayName

        $parameters = $AdminDLPPolicy
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        (Get-DscSplattedResource -ResourceName 'PPAdminDLPPolicy' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }

    foreach ($DLPPolicyConnectorConfigurations in $ConfigurationData.NonNodeData.PowerPlatform.DLPPoliciesConnectorConfigurations)
    {
        $resourceTitle = 'PPDLPPolicyConnectorConfigurations-{0}-{1}' -f $DLPPolicyConnectorConfigurations.PolicyName,$DLPPolicyConnectorConfigurations.PPTenantId

        $parameters = $DLPPolicyConnectorConfigurations
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        if ($parameters.ContainsKey('ConnectorActionConfigurations'))
        {
            $parameters.ConnectorActionConfigurations = $parameters.ConnectorActionConfigurations | ForEach-Object {
                if ($_.ContainsKey('actionRules'))
                {
                    $_.actionRules = $_.actionRules | ForEach-Object {
                        if ($_.ContainsKey('UniqueId'))
                        {
                            $_.Remove('UniqueId')
                        }

                        (Get-DscSplattedResource -ResourceName 'MSFT_PPDLPPolicyConnectorConfigurationsActionRules' -Properties $_ -NoInvoke).Invoke($_)
                    }
                }

                if ($_.ContainsKey('UniqueId'))
                {
                    $_.Remove('UniqueId')
                }

                (Get-DscSplattedResource -ResourceName 'MSFT_PPDLPPolicyConnectorConfigurationsAction' -Properties $_ -NoInvoke).Invoke($_)
            }
        }

        (Get-DscSplattedResource -ResourceName 'PPDLPPolicyConnectorConfigurations' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }

    foreach ($PowerAppPolicyUrlPatterns in $ConfigurationData.NonNodeData.PowerPlatform.PowerAppPoliciesUrlPatterns)
    {
        $resourceTitle = 'PPPowerAppPolicyUrlPatterns-{0}-{1}' -f $PowerAppPolicyUrlPatterns.PolicyName,$PowerAppPolicyUrlPatterns.PPTenantId

        $parameters = $PowerAppPolicyUrlPatterns
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        if ($parameters.ContainsKey('RuleSet'))
        {
            $parameters.RuleSet = $parameters.RuleSet | ForEach-Object {
                if ($_.ContainsKey('UniqueId'))
                {
                    $_.Remove('UniqueId')
                }

                (Get-DscSplattedResource -ResourceName 'MSFT_PPPowerAPpPolicyUrlPatternsRule' -Properties $_ -NoInvoke).Invoke($_)
            }
        }

        (Get-DscSplattedResource -ResourceName 'PPPowerAppPolicyUrlPatterns' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }

    foreach ($PowerAppsEnvironment in $ConfigurationData.NonNodeData.PowerPlatform.PowerAppsEnvironments)
    {
        $resourceTitle = 'PPPowerAppsEnvironment-{0}' -f $PowerAppsEnvironment.DisplayName

        $parameters = $PowerAppsEnvironment
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        (Get-DscSplattedResource -ResourceName 'PPPowerAppsEnvironment' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }

    if ($ConfigurationData.NonNodeData.PowerPlatform.ContainsKey('TenantIsolationSettings'))
    {
        $resourceTitle = 'TenantIsolationSettingsDefaults'

        $parameters = $ConfigurationData.NonNodeData.PowerPlatform.TenantIsolationSettings
        $parameters.IsSingleInstance = 'Yes'
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        if ($parameters.ContainsKey('Rules'))
        {
            $parameters.Rules = $parameters.Rules | ForEach-Object {
                if ($_.ContainsKey('UniqueId'))
                {
                    $_.Remove('UniqueId')
                }

                (Get-DscSplattedResource -ResourceName 'MSFT_PPTenantRule' -Properties $_ -NoInvoke).Invoke($_)
            }
        }

        if ($parameters.ContainsKey('RulesToInclude'))
        {
            $parameters.RulesToInclude = $parameters.RulesToInclude | ForEach-Object {
                if ($_.ContainsKey('UniqueId'))
                {
                    $_.Remove('UniqueId')
                }

                (Get-DscSplattedResource -ResourceName 'MSFT_PPTenantRule' -Properties $_ -NoInvoke).Invoke($_)
            }
        }

        if ($parameters.ContainsKey('RulesToExclude'))
        {
            $parameters.RulesToExclude = $parameters.RulesToExclude | ForEach-Object {
                if ($_.ContainsKey('UniqueId'))
                {
                    $_.Remove('UniqueId')
                }

                (Get-DscSplattedResource -ResourceName 'MSFT_PPTenantRule' -Properties $_ -NoInvoke).Invoke($_)
            }
        }

        (Get-DscSplattedResource -ResourceName 'PPTenantIsolationSettings' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }

    if ($ConfigurationData.NonNodeData.PowerPlatform.ContainsKey('TenantSettings'))
    {
        $resourceTitle = 'TenantSettingsDefaults'

        $parameters = $ConfigurationData.NonNodeData.PowerPlatform.TenantSettings
        $parameters.IsSingleInstance = 'Yes'
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

        if ($parameters.ContainsKey('UniqueId'))
        {
            $parameters.Remove('UniqueId')
        }
        (Get-DscSplattedResource -ResourceName 'PPTenantSettings' -ExecutionName $resourceTitle -Properties $parameters -NoInvoke).Invoke($parameters)
    }
}