DSCResources/cIntuneRoleAssignment/cIntuneRoleAssignment.schema.psm1

configuration cIntuneRoleAssignment {
    param (
        [Parameter()]
        [hashtable[]]
        $Items
)

<#
IntuneRoleAssignment [String] #ResourceName
{
    DisplayName = [string]
    [AccessTokens = [string[]]]
    [ApplicationId = [string]]
    [ApplicationSecret = [PSCredential]]
    [CertificateThumbprint = [string]]
    [Credential = [PSCredential]]
    [DependsOn = [string[]]]
    [Description = [string]]
    [Ensure = [string]{ Absent | Present }]
    [Id = [string]]
    [ManagedIdentity = [bool]]
    [Members = [string[]]]
    [MembersDisplayNames = [string[]]]
    [PsDscRunAsCredential = [PSCredential]]
    [ResourceScopes = [string[]]]
    [ResourceScopesDisplayNames = [string[]]]
    [RoleDefinition = [string]]
    [RoleDefinitionDisplayName = [string]]
    [ScopeType = [string]]
    [TenantId = [string]]
}
 
#>



    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Import-DscResource -ModuleName Microsoft365DSC

    $dscResourceName = 'IntuneRoleAssignment'

    $param = $PSBoundParameters
    $param.Remove("InstanceName")

    $dscParameterKeys = 'DisplayName' -split ', '

        foreach ($item in $Items)
        {
            if (-not $item.ContainsKey('Ensure'))
            {
                $item.Ensure = 'Present'
            }
            $keyValues = foreach ($key in $dscParameterKeys)
        {
            $item.$key
        }
        $executionName = $keyValues -join '_'
        $executionName = $executionName -replace "[\s()\\:*-+/{}```"']", '_'
        (Get-DscSplattedResource -ResourceName $dscResourceName -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)
    }
}