AzSCAP.PolicyInsights.psm1

Import-Module Az.PolicyInsights

function Get-AzPolicyCompliance {
    param (
        [string]$PolicyDefinitionId
    )
    $states = Get-AzPolicyState -Filter "PolicyDefinitionId eq '$PolicyDefinitionId'"
    if ($states -eq $null) {
        $s = new-object Microsoft.Azure.Management.PolicyInsights.Models.PolicyState;
        $s.ComplianceState = "Compliant";
        $s.PolicyDefinitionId = $PolicyDefinitionId;
        $state = new-object Microsoft.Azure.Commands.PolicyInsights.Models.PolicyState($s);
        return $state;
    }
    return $states;
}

Export-ModuleMember -Function Get-AzPolicyCompliance