DSCResources/cEXOManagementRoleAssignment/cEXOManagementRoleAssignment.schema.psm1
configuration cEXOManagementRoleAssignment { param ( [Parameter()] [hashtable[]] $Items ) <# EXOManagementRoleAssignment [String] #ResourceName { Name = [string] Role = [string] [AccessTokens = [string[]]] [App = [string]] [ApplicationId = [string]] [CertificatePassword = [PSCredential]] [CertificatePath = [string]] [CertificateThumbprint = [string]] [Credential = [PSCredential]] [CustomRecipientWriteScope = [string]] [CustomResourceScope = [string]] [DependsOn = [string[]]] [Ensure = [string]{ Absent | Present }] [ExclusiveRecipientWriteScope = [string]] [ManagedIdentity = [bool]] [Policy = [string]] [PsDscRunAsCredential = [PSCredential]] [RecipientAdministrativeUnitScope = [string]] [RecipientOrganizationalUnitScope = [string]] [RecipientRelativeWriteScope = [string]] [SecurityGroup = [string]] [TenantId = [string]] [User = [string]] } #> Import-DscResource -ModuleName PSDesiredStateConfiguration Import-DscResource -ModuleName Microsoft365DSC $dscResourceName = 'EXOManagementRoleAssignment' $param = $PSBoundParameters $param.Remove("InstanceName") $dscParameterKeys = 'Name, Role' -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) } } |