Private/Test-PowerPlatformLicense.ps1
|
# Test-PowerPlatformLicense.ps1 # Checks for Power Platform licensing and populates the PowerPlatform schema node. # Gates Power Platform collection in the main orchestrator. # Part of the M365-QuickAssess module -- not exported. function Test-PowerPlatformLicense { param ( $Assessment ) Write-Log "Checking for Power Platform licensing..." try { $skus = Get-MgSubscribedSku -ErrorAction Stop $ppSkus = $skus | Where-Object { $_.SkuPartNumber -match "POWERAPPS|FLOW|DYNAMICS|CDS|POWER_PLATFORM" } if ( $ppSkus ) { $licenseNames = ( $ppSkus | Select-Object -ExpandProperty SkuPartNumber ) -join ", " Write-Log "Power Platform licensing detected: $licenseNames" $Assessment.PowerPlatform.HasPowerPlatform = $true $Assessment.PowerPlatform.Licenses = $licenseNames } else { Write-Log "No Power Platform licensing detected" $Assessment.PowerPlatform.HasPowerPlatform = $false $Assessment.PowerPlatform.Licenses = $null } } catch { Write-Log "Power Platform license check failed: $( $_.Exception.Message )" "WARN" $Assessment.PowerPlatform.HasPowerPlatform = $null $Assessment.PowerPlatform.Licenses = $null } } |