POA.psm1

# POA Module - Purview Optimization Assessment

function Get-PurviewAssessmentReport {
<#
.SYNOPSIS
    Microsoft Purview Optimization Assessment Tool
.DESCRIPTION
    Conducts a comprehensive analysis of your Microsoft 365 Purview implementation.
    Generates interactive HTML reports and optional Excel remediation plans.
.PARAMETER ExportToExcel
    Generates an Excel remediation plan in addition to the HTML report.
.PARAMETER Transcript
    Creates a detailed execution log for troubleshooting.
.PARAMETER AddDPU
    Includes DPU-related collection (OME configuration, user count, tenant name).
.PARAMETER UserPrincipalName
    User Principal Name for authentication (e.g., admin@tenant.onmicrosoft.com).
.PARAMETER SelectCloud
    Prompts to select a cloud environment (GCC High, DoD, Germany, China). Default is Commercial/GCC.
.PARAMETER MaxRetryAttempts
    Maximum retry attempts for authentication and API calls (1-10, default 3).
#>

    [CmdletBinding()]
    param(
        [Switch]$ExportToExcel,
        [Switch]$Transcript,
        [Switch]$AddDPU,
        [Parameter(HelpMessage="User Principal Name for authentication (e.g., admin@tenant.onmicrosoft.com)")]
        [ValidatePattern('^[^@]+@[^@]+\.[^@]+$')]
        [string]$UserPrincipalName,
        [Parameter(HelpMessage="Prompt to select a cloud environment (GCC High, DoD, Germany, China). Default is Commercial/GCC.")]
        [Switch]$SelectCloud,
        [Parameter(HelpMessage="Maximum retry attempts for authentication and API calls")]
        [ValidateRange(1, 10)]
        [int]$MaxRetryAttempts = 3
    )

    $scriptPath = Join-Path $PSScriptRoot "Get-PurviewAssessmentReport.ps1"
    $params = @{}
    if ($ExportToExcel)   { $params['ExportToExcel'] = $true }
    if ($Transcript)      { $params['Transcript'] = $true }
    if ($AddDPU)          { $params['AddDPU'] = $true }
    if ($UserPrincipalName) { $params['UserPrincipalName'] = $UserPrincipalName }
    if ($SelectCloud)     { $params['SelectCloud'] = $true }
    if ($PSBoundParameters.ContainsKey('MaxRetryAttempts')) { $params['MaxRetryAttempts'] = $MaxRetryAttempts }

    & $scriptPath @params
}

Export-ModuleMember -Function Get-PurviewAssessmentReport