internal/eidsca/@templateps1.txt

<#
.SYNOPSIS
    Checks if %ControlName% - %DisplayName% is set to %RecommendedValue%
 
.DESCRIPTION
 
    %ControlItemDescription%
 
    Queries %RelativeUri%
    and returns the result of
     graph/%RelativeUri%.%CurrentValue% -%PwshCompareOperator% %RecommendedValue%
 
.EXAMPLE
    %PSFunctionName%
 
    Returns the result of graph.microsoft.com/beta/%RelativeUri%.%CurrentValue% -%PwshCompareOperator% %RecommendedValue%
#>
 
function %PSFunctionName% {
    [CmdletBinding()]
    [OutputType([bool])]
    param()
 
    %SkipCheck%
    $result = Invoke-MtGraphRequest -RelativeUri "%RelativeUri%" -ApiVersion %ApiVersion%
 
    [string]$tenantValue = $result.%CurrentValue%
    $testResult = $tenantValue -%PwshCompareOperator% %RecommendedValue%
    $tenantValueNotSet = $null -eq $tenantValue -and %RecommendedValue% -notlike '*$null*'
 
    if($testResult){
        $testResultMarkdown = "Well done. The configuration in your tenant and recommended value %CompareOperatorText% **%RecommendedValue%** for **%RelativeUri%**"
    } elseif ($tenantValueNotSet) {
        $testResultMarkdown = "Your tenant is **not configured explicitly**.`n`nThe recommended value is **%RecommendedValue%** for **%RelativeUri%**. It seems that you are using a default value by Microsoft. We recommend to set the setting value explicitly since non set values could change depending on what Microsoft decides the current default should be."
    } else {
        $testResultMarkdown = "Your tenant is configured as **$($tenantValue)**.`n`nThe recommended value %CompareOperatorText% **%RecommendedValue%** for **%RelativeUri%**"
    }
    Add-MtTestResultDetail -Result $testResultMarkdown
 
    return $tenantValue
}