DscResources/Azure/Azure.schema.psm1

# (2024-11-21 01:32:23) Generated using Microsoft365DSC v1.24.1120.1
Configuration 'Azure'
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $ApplicationId,

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

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

    Import-DscResource -ModuleName Microsoft365DSC

    foreach ($BillingAccountPolicy in $ConfigurationData.NonNodeData.Azure.BillingAccountPolicies)
    {
        $resourceTitle = 'AzureBillingAccountPolicy-{0}' -f $BillingAccountPolicy.BillingAccount

        $parameters = $BillingAccountPolicy
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

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

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

    foreach ($BillingAccountsAssociatedTenant in $ConfigurationData.NonNodeData.Azure.BillingAccountsAssociatedTenants)
    {
        $resourceTitle = 'AzureBillingAccountsAssociatedTenant-{0}' -f $BillingAccountsAssociatedTenant.AssociatedTenantId

        $parameters = $BillingAccountsAssociatedTenant
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

    foreach ($BillingAccountScheduledAction in $ConfigurationData.NonNodeData.Azure.BillingAccountScheduledActions)
    {
        $resourceTitle = 'AzureBillingAccountScheduledAction-{0}' -f $BillingAccountScheduledAction.DisplayName

        $parameters = $BillingAccountScheduledAction
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

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

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

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

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

    foreach ($BillingAccountsRoleAssignment in $ConfigurationData.NonNodeData.Azure.BillingAccountsRoleAssignments)
    {
        $resourceTitle = 'AzureBillingAccountsRoleAssignment-{0}-{1}' -f $BillingAccountsRoleAssignment.PrincipalName,$BillingAccountsRoleAssignment.RoleDefinition

        $parameters = $BillingAccountsRoleAssignment
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

    foreach ($DiagnosticSettingsItems in $ConfigurationData.NonNodeData.Azure.DiagnosticSettingsItems)
    {
        $resourceTitle = 'AzureDiagnosticSettings-{0}' -f $DiagnosticSettingsItems.Name

        $parameters = $DiagnosticSettingsItems
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

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

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

    foreach ($DiagnosticSettingsCustomSecurityAttribute in $ConfigurationData.NonNodeData.Azure.DiagnosticSettingsCustomSecurityAttributes)
    {
        $resourceTitle = 'AzureDiagnosticSettingsCustomSecurityAttribute-{0}' -f $DiagnosticSettingsCustomSecurityAttribute.Name

        $parameters = $DiagnosticSettingsCustomSecurityAttribute
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

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

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

    foreach ($Subscription in $ConfigurationData.NonNodeData.Azure.Subscriptions)
    {
        $resourceTitle = 'AzureSubscription-{0}' -f $Subscription.DisplayName

        $parameters = $Subscription
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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

    foreach ($VerifiedIdFaceCheck in $ConfigurationData.NonNodeData.Azure.VerifiedIdFaceChecks)
    {
        $resourceTitle = 'AzureVerifiedIdFaceCheck-{0}-{1}-{2}' -f $VerifiedIdFaceCheck.SubscriptionId,$VerifiedIdFaceCheck.ResourceGroupName,$VerifiedIdFaceCheck.VerifiedIdAuthorityId

        $parameters = $VerifiedIdFaceCheck
        $parameters.ApplicationId = $ApplicationId
        $parameters.TenantId = $TenantId
        $parameters.CertificateThumbprint = $CertificateThumbprint

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