DscResources/Azure/Azure.schema.psm1

# (2024-11-08 01:25:25) Generated using Microsoft365DSC v1.24.1106.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 ($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 ($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)
    }
}