DSCResources/cIntuneAppConfigurationDevicePolicy/cIntuneAppConfigurationDevicePolicy.schema.psm1

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

<#
IntuneAppConfigurationDevicePolicy [String] #ResourceName
{
    DisplayName = [string]
    Id = [string]
    [AccessTokens = [string[]]]
    [ApplicationId = [string]]
    [ApplicationSecret = [PSCredential]]
    [Assignments = [MSFT_DeviceManagementConfigurationPolicyAssignments[]]]
    [CertificateThumbprint = [string]]
    [ConnectedAppsEnabled = [bool]]
    [Credential = [PSCredential]]
    [DependsOn = [string[]]]
    [Description = [string]]
    [EncodedSettingXml = [string]]
    [Ensure = [string]{ Absent | Present }]
    [ManagedIdentity = [bool]]
    [PackageId = [string]]
    [PayloadJson = [string]]
    [PermissionActions = [MSFT_MicrosoftGraphandroidPermissionAction[]]]
    [ProfileApplicability = [string]{ androidDeviceOwner | androidWorkProfile | default }]
    [PsDscRunAsCredential = [PSCredential]]
    [RoleScopeTagIds = [string[]]]
    [Settings = [MSFT_MicrosoftGraphappConfigurationSettingItem[]]]
    [TargetedMobileApps = [string[]]]
    [TenantId = [string]]
}
 
#>



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

    $dscResourceName = 'IntuneAppConfigurationDevicePolicy'

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

    $dscParameterKeys = 'Id' -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)
    }
}