Microsoft.AzureStack.ReadinessChecker.Reporting.psm1

<#
.SYNOPSIS
    Common Reporting functions across all modules/scenarios
.DESCRIPTION
    Logging, Reporting
.INPUTS
    Inputs (if any)
.OUTPUTS
    Output (if any)
.NOTES
    General notes
#>


if (-not $outputPath) {
    $OutputPath = "$ENV:TEMP\AzsReadinessChecker"
}

if ($AzsReadinessLogFile) {
    Remove-Variable AzsReadinessLogFile -ErrorAction SilentlyContinue
}
if ($AzsReadinessReport) {
    Remove-Variable AzsReadinessReport -ErrorAction SilentlyContinue
}

if ($AzsReadinessReportXml) {
    Remove-Variable AzsReadinessReportXml -ErrorAction SilentlyContinue
}

$Global:AzsReadinessLogFile = Join-Path -Path $OutputPath -ChildPath 'AzsReadinessChecker.log'
$Global:AzsReadinessReport = Join-Path -Path $OutputPath -ChildPath 'AzsReadinessCheckerReport.json'
$Global:AzsReadinessReportXml = Join-Path -Path $OutputPath -ChildPath 'AzsReadinessCheckerReport.xml'

function Get-AzsReadinessProgress {
    <#
    .SYNOPSIS
        Look for existing progress or create new progress.
    .DESCRIPTION
        Finds either the latest progress XML file or creates a new progress XML file
    .EXAMPLE
        PS C:\> <example usage>
        Explanation of what the example does
    .INPUTS
        Clean switch, in case the user wants to start fresh
        Path to search for progress run.
    .OUTPUTS
        PSCustomObject of progress.
    .NOTES
    #>

    param ([switch]$clean, $path = $PSScriptRoot)
    $thisFunction = $MyInvocation.MyCommand.Name
    $latestReport = Get-Item -Path $Global:AzsReadinessReportXml -ErrorAction SilentlyContinue
    if (-not $clean -and $latestReport) {
        $report = Import-CliXML $latestReport.FullName
        Write-AzsReadinessLog -Message ('Found existing report: {0}' -f $report.FilePath) -Type Info -Function $thisFunction
    }
    else {
        $hash = @{
            FilePath              = $Global:AzsReadinessReportXml
            Version               = $MyInvocation.MyCommand.Module.Version.ToString()
            Jobs                  = @{}
            CertificateValidation = @{}
            AzureValidation       = @{
                AzureRegistration  = @{}
                AzureInstallResult = @{}
            }
            GraphValidation       = @{}
            ADFSValidation        = @{}
            NetworkValidation     = @{}
        }
        $report = new-object PSObject -Property $hash
        Write-AzsReadinessLog -Message ('Creating new report {0}' -f $report.FilePath) -Type Info -Function $thisFunction
    }
    $report
}

function Write-AzsReadinessProgress {
    <#
    .SYNOPSIS
        Write report output to JSON
    .DESCRIPTION
        After all processing, take results object and convert to JSON report.
        Any file already existing will be overwritten.
    .EXAMPLE
        Write-AzsReadinessProgress -report $report
        Writes $report to JSON file
    .INPUTS
        [psobject]
    .OUTPUTS
        XML file on disk (path on disk is expected to be embedded in psobject)
    .NOTES
        General notes
    #>

    param ([psobject]$report)
    $thisFunction = $MyInvocation.MyCommand.Name
    try {
        $report | Export-CliXml -Depth 10 -Path $report.FilePath -Force
        Write-AzsReadinessLog -Message ('Azs Readiness progress written: {0}' -f $report.FilePath) -Type Info -Function $thisFunction
    }
    Catch {
        Write-AzsReadinessLog -Message ('Writing XML progress to disk error {0}' -f $_.exception.message) -Type Error -Function $thisFunction
        throw $_.exception
    }
}

function Write-AzsReadinessLog {
    <#
    .SYNOPSIS
        Write verbose logging to disk
    .DESCRIPTION
        Formats and writes verbose logging to disk under scriptroot. Log type (or severity) is essentially cosmetic
        to the verbose log file, no action should be inferred, such as termination of the script.
    .EXAMPLE
        Write-AzsReadinessLog -Message ('Script messaging include data {0}' -f $data) -Type 'Info|Warning|Error' -Function 'FunctionName'
    .INPUTS
        Message - a string of the body of the log entry
        Type - a cosmetic type or severity for the message, must be info, warning or error
        Function - ideally the name of the function or the script writing the log entry.
    .OUTPUTS
        Appends Log entry to AzsReadinessChecker.log under the script root.
    .NOTES
        General notes
    #>

    param([string]$Message,
        [ValidateSet('Info', 'Warning', 'Error', 'Success')][string]$Type = 'Info',
        [ValidateNotNullOrEmpty()][string]$Function = ((Get-PSCallStack)[0].Command),
        [switch]$toScreen
    )
    $Message = RunMask $Message
    if ($toScreen) {
        if ($PSEdition -eq 'desktop') {
            switch -wildcard ($function) {
                '*-AzsReadiness*' {$foregroundcolor = 'DarkYellow' }
                default {$foregroundcolor = "White" }
            }
            switch ($Type) {
                'Success' {$foregroundcolor = 'Green'}
                'Warning' {$foregroundcolor = 'Yellow'}
                'Error' {$foregroundcolor = 'Red'}
                default {$foregroundcolor = "White" }
            }
            Write-Host $message -foregroundcolor $foregroundcolor
        }
        else {
            Write-Output $message
        }
    }

    $entry = "[{0}] [{1}] [{2}] {3}" -f ([datetime]::now).tostring(), $type, $function, ($Message -replace "`n|`t", "")
    if (-not (Test-Path $AzsReadinessLogFile)) {
        New-Item -Path $AzsReadinessLogFile -Force | Out-Null
    }
    $entry | Out-File -FilePath $AzsReadinessLogFile -Append -Force
}

function Add-AzsReadinessCheckerJob {
    <#
    .SYNOPSIS
        Adds a 'Job' to the progress object.
    .DESCRIPTION
        If a user runs the tool multiple time to check different assets
        e.g. Certificates on one execution and Registration details on the next execution
        Those executions are added to the progress for tracking purposes.
        Execution/Job details include:
            start time,
            parameters,
            parameterset (indicating what is being checked, certificates or Azure Accounts),
            Placeholders for EndTime and Duration (later filled in by Close-AzsReadinessCheckerJob)
    .EXAMPLE
        Add-AzsReadinessCheckerJob -report $report
        Adds execution job to progress object ($report)
    .INPUTS
        Report - psobject - containing all progress to date
    .OUTPUTS
        Report - psobject - updated with execution job log.
    .NOTES
        General notes
    #>

    param ($report)
    $thisFunction = $MyInvocation.MyCommand.Name
    $allJobs = @{}
    $alljobs = $report.Jobs

    # Index for jobs must be a string for json conversion later
    if ($alljobs.Count) {
        $jobCount = ($alljobs.Count++).tostring()
    }
    else {
        $jobCount = '0'
    }

    # Record current job
    $currentJob = @{
        Index             = $jobCount
        StartTime         = (Get-Date -f 'yyyy/MM/dd HH:mm:ss')
        PSBoundParameters = $paramToString
        Operations        = ($PSCmdlet.ParameterSetName -join ', ')
        EndTime           = $null
        Duration          = $null
    }
    Write-AzsReadinessLog -Message ('Adding current job to progress: {0}' -f $currentJob) -Type Info -Function $thisFunction
    # Add current job
    $allJobs += @{"$jobcount" = $currentJob}
    $report.Jobs = $allJobs
    $report
}

function Close-AzsReadinessCheckerJob {
    <#
    .SYNOPSIS
        Writes endtime and duration for jobs
    .DESCRIPTION
        Find latest job entry and update time and calculates duration
        calls function to update xml on disk
        and updates and returns report object
    .EXAMPLE
        Close-AzsReadinessCheckerJob -report $report
    .INPUTS
        Report - psobject - containing all progress to date
    .OUTPUTS
        Report - psobject - updated with finished execution job log.
    .NOTES
        General notes
    #>

    param ($report)
    $thisFunction = $MyInvocation.MyCommand.Name
    try {
        $latestJob = $report.jobs.Keys -match '[0-9]' | ForEach-Object {[int]$_} | Sort-Object -Descending | Select-Object -First 1
        $report.jobs["$latestJob"].EndTime = (Get-Date -f 'yyyy/MM/dd HH:mm:ss')
        $duration = (([dateTime]$report.jobs["$latestJob"].EndTime) - ([dateTime]$report.jobs["$latestJob"].StartTime)).TotalSeconds
        $report.jobs["$latestJob"].Duration = $duration
        Write-AzsReadinessLog -Message ('Updating current job to progress with endTime: {0} and duration {1}' -f $report.jobs["$latestJob"].EndTime, $duration) -Type Info -Function $thisFunction
    }
    Catch {
        Write-AzsReadinessLog -Message ('Updating current job to progress failed with exception: {0}' -f $_.exception) -Type Error -Function $thisFunction
        throw
    }
    Write-AzsReadinessProgress -report $report
    $report
}

function Write-AzsReadinessReport {
    <#
    .SYNOPSIS
        Writes progress to disk in JSON format
    .DESCRIPTION
        Write progress object to disk in JSON format, overwriting as neccessary.
        The resulting blob is intended to be a portable record of what has been checked
        including the results of that check
    .EXAMPLE
        Write-AzsReadinessReport -report $report
    .INPUTS
        Report - psobject - containing all progress to date
    .OUTPUTS
        JSON - file - named AzsReadinessReport.json
    .NOTES
        General notes
    #>

    param ([psobject]$report)
    $thisFunction = $MyInvocation.MyCommand.Name
    try {
        ConvertTo-Json -InputObject $report -depth 10 | Out-file $AzsReadinessReport -force
        Write-AzsReadinessLog -Message ('JSON report written to {0}' -f $AzsReadinessReport) -Type Info -Function $thisFunction
    }
    catch {
        Write-AzsReadinessLog -Message ('Writing JSON report failed:' -f $_.exception.message) -Type Error -Function $thisFunction
        throw $_.exception
    }
}

function Copy-AzsReadinessLogging {
    <#
    .SYNOPSIS
        Copy each individual component log to the main log for AzsReadinessChecker
    .DESCRIPTION
        This function copies an individual component log to the main log for this tool.
        E.g. get CertChecker.log and insert it into AzsReadinessChecker.log,
        so there's a single source of truth.
        It archives individual component logs after copying their content.
        This ensures all timestamps are chronological.
        If no content is found, a placeholder of [missing] is inserted to indicate log copy failure.
    .EXAMPLE
        Copy-AzsReadinessLogging -ComponentLogFile CertChecker
        Gets CertChecker.log and inserts it into AzsReadinessChecker.log
    .INPUTS
        ComponentLogFile - string - valid set of 'CertChecker','AADHelper','CertRequest'
    .OUTPUTS
        File content in AzsReadinessChecker.log
    .NOTES
    #>

    param ([ValidateSet('CertChecker', 'AADHelper')][string]$ComponentLogFile)
    $thisFunction = $MyInvocation.MyCommand.Name
    switch ($ComponentLogFile) {
        'CertChecker' {$logPath = "$PSScriptRoot\CertificateValidation\CertChecker.log" }
        'AADHelper' {$logPath = "$PSScriptRoot\AzureValidation\AADChecker.log" }
    }
    if (Test-Path $logPath) {
        $logContent = Get-Content $logPath -ErrorAction SilentlyContinue
        if (-not $logContent) {
            # if there is no log content make an indication of this
            $logContent = '[missing]'
        }
        else {
            # if there is a log rename it to archive it, so the next execution would create a fresh.
            Move-Item -Path $logPath -Destination $logPath.replace('.log', '-{0}.log' -f (Get-Date -f yyyyMMddHHmmss)) -Force
        }
        # logs will always be fresh for each execution so indiscriminately copy all content to the main log.
        $logContent | Out-File $AzsReadinessLogFile -Append
        Write-AzsReadinessLog -Message ('Finished copying {0} log from {1}' -f $ComponentLogFile, $logPath, $outfile) -Type Info -Function $thisFunction
    }
    else {
        Write-AzsReadinessLog -Message ('Retrieving {0} log from {1} failed.' -f $ComponentLogFile, $logPath) -Type Error -Function $thisFunction
    }
}

function Get-AzsReadinessReport {
    <#
    .SYNOPSIS
        Read the readiness report and format it to screen
    .DESCRIPTION
 
    .EXAMPLE
        Get-AzsReadinessReport -reportFile $reportFile
    .INPUTS
        Report - psobject
    .OUTPUTS
        Write-Output
    .NOTES
    #>

    param ($reportJSON, [ValidateSet('Certificate', 'AzureRegistration', 'AzureIdentity', 'Graph', 'ADFS', 'Jobs', 'Network', 'All')]$validations, [switch]$Summary)
    $thisFunction = $MyInvocation.MyCommand.Name
    Write-AzsReadinessLog -Message ('Reading report contents to output to screen') -Type Info -Function $thisFunction
    if ($validations -match 'Certificate|All') {
        foreach ($key in $reportJSON.CertificateValidation.PSObject.Properties.Name) {
            if ($reportJSON.CertificateValidation.$key.Test) {
                if (-not $Summary) {
                    Write-AzsReadinessLog "`n############### $key Certificate Validation Results ###############`n" -Type Info -Function $thisFunction -toScreen
                    if ($reportJSON.CertificateValidation.$key.count -ne $null) {
                        Write-Output $reportJSON.CertificateValidation.$key | Select-Object Test, Result, Path, FailureDetail, ReuseCount | Format-List
                    }
                    else {
                        Write-AzsReadinessLog "Deployment Certificate Validation results not available."  -Type Info -Function $thisFunction -toScreen
                    }
                }
                Write-AzsReadinessLog "`n############### $key Certificate Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
                if ($reportJSON.CertificateValidation.$key.FailureDetail -match '[a-z]') {
                    $certificateFailures = $reportJSON.CertificateValidation.$key |
                        ForEach-Object {$PSITEM | where-object FailureDetail -ne $null}
                    foreach ($certificateFailure in $certificateFailures) {
                        Write-AzsReadinessLog ("`n`tCertificate: {0}" -f $certificateFailure.path) -Type Warning -toScreen
                        Write-AzsReadinessLog ("`tIssue(s): {0}" -f ($certificateFailure.failureDetail -join ', ')) -Type Warning -Function Warn -toScreen
                    }
                }
                else {
                    Write-AzsReadinessLog "`tCertificate Validation found no errors or warnings." -Type Info -Function Success -toScreen
                }
            }
            else {
                Write-AzsReadinessLog "`n############### Certificate Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
                Write-AzsReadinessLog "Certificate Validation results not available." -Type Info -Function $thisFunction -toScreen
            }
        }
    }
    if ($validations -match 'AzureRegistration|All') {
        if ($reportJSON.AzureValidation.AzureRegistration.Result) {
            if (-not $Summary) {
                Write-AzsReadinessLog "############### Azure Registration Subscription Results ###############" -Type Info -Function $thisFunction -toScreen
                Write-Output $reportJSON.AzureValidation.AzureRegistration.SubscriptionDetail |
                    Select-Object `
                @{Label = "Operation"; Expression = {$_.Test}}, `
                @{Label = "AzureEnvironment"; Expression = {$_.AzureEnvironment}}, `
                @{Label = "Account"; Expression = {$_.credential}}, `
                @{Label = "Account Role"; Expression = {$_.userrole}}, `
                @{Label = "Azure Active Directory Tenant"; Expression = {$_.AADDirectoryTenantName}}, `
                @{Label = "Subscription Id"; Expression = {$_.subscription.subscriptionId}}, `
                @{Label = "displayName"; Expression = {$_.subscription.displayName}}, `
                @{Label = "Location Placement Id"; Expression = {$_.subscription.subscriptionPolicies.locationPlacementId}}, `
                @{Label = "Quota ID"; Expression = {$_.subscription.subscriptionPolicies.quotaId}}, `
                @{Label = "spendingLimit"; Expression = {$_.subscription.subscriptionPolicies.spendingLimit}}, `
                @{Label = "Authorization Source"; Expression = {$_.subscription.authorizationSource}}, `
                @{Label = "Enabled"; Expression = {$_.subscription.state}}, `
                @{Label = "Subscription Type"; Expression = {$_.subscription.subscriptionPolicies.quotaId}}, `
                @{Label = "Error Details"; Expression = {$_.errorDetails}} |
                    Format-List

                Write-AzsReadinessLog "`n############### Azure Registration Validation Overall Results ###############" -Type Info -Function $thisFunction -toScreen

                Write-Output $reportJSON.AzureValidation.AzureRegistration |
                    Select-Object `
                @{Label = "Test"; Expression = {$_.Test}}, `
                @{Label = "Result"; Expression = {$_.result}}, `
                @{Label = "Subscription Id"; Expression = {$_.Assets.SubscriptionId}}, `
                @{Label = "Enabled"; Expression = {$_.Assets.Enabled}}, `
                @{Label = "Subscription Type"; Expression = {$_.Assets.SubscriptionType}}, `
                @{Label = "Error Details"; Expression = {$_.errorDetails}} |
                    Format-List
            }
            Write-AzsReadinessLog "`n############### Registration Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            if ($reportJSON.AzureValidation.AzureRegistration.errorDetails -or $reportJSON.AzureValidation.AzureRegistration.SubscriptionDetail.errorDetails) {
                $reportJSON.AzureValidation.AzureRegistration, $reportJSON.AzureValidation.AzureRegistration.SubscriptionDetail | where-object errorDetails -ne $null | `
                    ForEach-Object {Write-AzsReadinessLog ("`t{0}" -f ($_.errorDetails -join ', ')) -Type Warning -function Warn -toScreen}
            }
            else {
                Write-AzsReadinessLog "`tRegistration Validation found no errors or warnings.`n" -Type Info -Function Success -toScreen
            }
        }
        else {
            Write-AzsReadinessLog "`n############### Registration Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Azure Registration Validation results not available." -Type Warning -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Invoke-AzsRegistrationValidation -RegistrationAccount `$registrationCredential -RegistrationSubscriptionID `$subscriptionID -AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com" -Type Warning -Function $thisFunction
        }
    }
    if ($validations -match 'AzureIdentity|All') {
        if ($reportJSON.AzureValidation.AzureInstallResult.Result) {
            if (-not $Summary) {
                Write-AzsReadinessLog "############### Azure Identity Results ###############" -Type Info -Function $thisFunction -toScreen
                Write-Output $reportJSON.AzureValidation.AzureInstallResult |
                    Select-Object Test, Result, `
                @{Label = "AAD Service Admin"; Expression = {$_.Assets.AADServiceAdmin}}, `
                @{Label = "Azure Environment"; Expression = {$_.Assets.AzureEnvironment}}, `
                @{Label = "Azure Active Directory Tenant"; Expression = {$_.Assets.AADDirectoryTenantName}}, `
                @{Label = "Error Details"; Expression = {$_.errorDetails}} |
                    Format-List
            }
            Write-AzsReadinessLog "`n############### Azure Identity Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            if ($reportJSON.AzureValidation.AzureInstallResult.errorDetails) {
                $reportJSON.AzureValidation.AzureInstallResult | where-object errorDetails -ne $null | `
                    ForEach-Object {Write-AzsReadinessLog ("`t{0}" -f ($_.errorDetails -join ', ')) -Type Warning -Function $thisFunction -toScreen}
            }
            else {
                Write-AzsReadinessLog "`tAzure Identity Validation found no errors or warnings.`n" -Type Info -Function Success -toScreen
            }
        }
        else {
            Write-AzsReadinessLog "`n############### Azure Identity Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Azure Identity Validation results not available." -Type Warning -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Invoke-AzsIdentityValidation -AADServiceAdministrator `$serviceAdminCredential - AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com" -Type Warning -Function $thisFunction
        }
    }
    if ($validations -match 'Graph|All') {
        if ($reportJSON.GraphValidation.Test) {
            if (-not $Summary) {
                Write-AzsReadinessLog "############### Azure Graph Validation Results ###############" -Type Info -Function $thisFunction -toScreen
                Write-Output $reportJSON.GraphValidation |
                    Select-Object Test, Result, @{Label = "Error Details"; Expression = {$_.FailureDetail}} | Format-List
            }
            Write-AzsReadinessLog "`n############### Azure Graph Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            if ($reportJSON.GraphValidation.errorDetails) {
                $reportJSON.GraphValidation | where-object errorDetails -ne $null | `
                    ForEach-Object {Write-AzsReadinessLog ("`t{0}" -f ($_.errorDetails -join ', ')) -Type Warning -Function $thisFunction -toScreen}
            }
            else {
                Write-AzsReadinessLog "`tAzure Stack Graph Validation found no errors or warnings.`n" -Type Info -Function Success -toScreen
            }
        }
        else {
            Write-AzsReadinessLog "`n############### Azure Stack Graph Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Azure Stack Graph Validation results not available." -Type Warning -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Invoke-AzureStackGraphValidation -ForestFQDN contoso.com -Credential `$cred" -Type Warning -Function $thisFunction
        }
    }
    if ($validations -match 'ADFS|All') {
        if ($reportJSON.ADFSValidation.Test) {
            if (-not $Summary) {
                Write-AzsReadinessLog "############### Azure Stack ADFS Validation Results ###############" -Type Info -Function $thisFunction -toScreen
                Write-Output $reportJSON.ADFSValidation |
                    Select-Object Test, Result, @{Label = "Error Details"; Expression = {$_.FailureDetail}} | Format-List
            }
            Write-AzsReadinessLog "`n############### Azure Stack ADFS Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            if ($reportJSON.ADFSValidation.errorDetails) {
                $reportJSON.ADFSValidation | where-object errorDetails -ne $null | `
                    ForEach-Object {Write-AzsReadinessLog ("`t{0}" -f ($_.errorDetails -join ', ')) -Type Warning -Function $thisFunction -toScreen}
            }
            else {
                Write-AzsReadinessLog "`tAzure Stack ADFS Validation found no errors or warnings.`n" -Type Info -Function Success -toScreen
            }
        }
        else {
            Write-AzsReadinessLog "`n############### Azure Stack ADFS Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Azure Stack ADFS Validation results not available." -Type Warning -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Invoke-AzsADFSValidation -CustomADFSFederationMetadataEndpointUri https://adfs.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml" -Type Warning -Function $thisFunction
        }
    }
    if ($validations -match 'Network|All') {
        if ($reportJSON.NetworkValidation.Test) {
            if (-not $Summary) {
                Write-AzsReadinessLog "############### Azure Stack Network Validation Results ###############" -Type Info -Function $thisFunction -toScreen
                Write-Output $reportJSON.NetworkValidation |
                    Select-Object Test, Result, @{Label = "Error Details"; Expression = {$_.FailureDetail}} | Format-List
            }
            Write-AzsReadinessLog "`n############### Azure Stack Network Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            if ($reportJSON.NetworkValidation.errorDetails) {
                $reportJSON.NetworkValidation | where-object errorDetails -ne $null | `
                    ForEach-Object {Write-AzsReadinessLog ("`t{0}" -f ($_.errorDetails -join ', ')) -Type Warning -Function $thisFunction -toScreen}
            }
            else {
                Write-AzsReadinessLog "`tAzure Stack Network Validation found no errors or warnings.`n" -Type Info -Function Success -toScreen
            }
        }
        else {
            Write-AzsReadinessLog "`n############### Azure Stack Network Validation Summary ###############`n" -Type Info -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Azure Stack Network Validation results not available." -Type Warning -Function $thisFunction -toScreen
            Write-AzsReadinessLog "Invoke-AzsNetworkValidation -DnsServer 192.168.50.1 -TimeServer pool.ntp.org" -Type Warning -Function $thisFunction
        }
    }
    if ($validations -match 'Jobs|All') {
        if (-not $reportjson.jobs) {
            Write-AzsReadinessLog "Job Summary not available. No validations have been run." -Type Warning -Function $thisFunction -toScreen
        }
        else {
            if (-not $Summary) {
                Write-AzsReadinessLog "`n############### AzsReadiness Job Summary ###############`n" -Type Info -Function $thisFunction -toScreen
                $jobs = @{}
                $reportjson.jobs.psobject.properties | ForEach-Object { $jobs[$_.Name] = $_.Value }
                $jobDetail = $jobs.Keys | ForEach-Object {if ($_ -ne 'count') {$jobs[$_]}}
                $jobDetail |
                    Sort-Object Index |
                    Select-Object `
                @{Label = "Index"; Expression = {$_.Index}}, `
                @{Label = "Operations"; Expression = {$_.Operations -join ', '}}, `
                @{Label = "StartTime"; Expression = {$_.StartTime}}, `
                @{Label = "EndTime"; Expression = {$_.EndTime}}, `
                @{Label = "Duration"; Expression = {$_.Duration}}, `
                @{Label = "PSBoundParameters"; Expression = {$_.PSBoundParameters}}  |
                    Format-List
            }
        }
    }
}

function Read-AzsReadinessReport {
    param (
        [Parameter(Mandatory = $true, ParameterSetName = "ReadReport", HelpMessage = "Path for Readiness Report")]
        [ValidateScript( {Test-Path $_ -Include *.json})]
        [string]$ReportPath,

        [Parameter(Mandatory = $false, ParameterSetName = "ReadReport", HelpMessage = "Specify Report Path as 'Certificate', 'AzureRegistration', 'AzureIdentity', 'Graph', 'ADFS', 'Jobs', or 'All'")]
        [ValidateSet('Certificate', 'AzureRegistration', 'AzureIdentity', 'Graph', 'ADFS', 'Jobs', 'Network', 'All')]
        [string[]]$ReportSections = 'All',

        [Parameter(Mandatory = $false, ParameterSetName = "ReadReport", HelpMessage = "Summarize report for issues only")]
        [switch]$Summary = $false
    )
    $thisFunction = $MyInvocation.MyCommand.Name
    Write-AzsReadinessLog -Message ("`nReading {0} Validation(s) from Report {1}" -f ($ReportSections -join ', '), $reportPath) -Type Info -Function $thisFunction -toScreen
    if (Test-Path $reportPath) {
        $reportJSON = Get-Content -path $reportPath -ErrorAction Stop | ConvertFrom-Json
        Get-AzsReadinessReport -reportJSON $reportJSON -validations $ReportSections -Summary:$summary
    }
    else {
        Write-AzsReadinessLog -Message ("Unable to find $reportPath. Please specify a valid report file.") -Type Warning -Function $thisFunction -toScreen
    }
}

function Write-Header {
    param ($invocation, $params)
    $paramToString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join ';'
# only print the header to screen if the user called the function directly rather than an add on via packaging.
    # ConvertTo-AzsPfx calls Invoke-AzsCertValidation, only want a header/footer when called by ConvertTo-AzsPfx
    if (-not ('ConvertTo-AzsPFX' -in (Get-PSCallStack).command -and 'Invoke-AzsCertificateValidation' -in (Get-PSCallStack).command )) {
        $cmdLetName = Get-CmdletName (Get-PSCallStack)
        $cmdletVersion = (Get-Command $cmdletName).version.tostring()
        Write-AzsReadinessLog -Message ('{0} v{1} started.' -f `
            $cmdLetName,$cmdletVersion) `
                -Type Info `
                -Function $MyInvocation.MyCommand.Name `
                -toScreen
    }

    Write-AzsReadinessLog -Message ('{0} started version: {1} with parameters: {2}' `
            -f $invocation.MyCommand.Name, (Get-Module Microsoft.AzureStack.ReadinessChecker).Version.ToString(), $paramToString) `
        -Type Info `
        -Function $MyInvocation.MyCommand.Name

    Write-AzsReadinessLog -Message ('OSVersion: {0} PSVersion: {1} PSEdition: {2} Security Protocol: {3}' -f `
            [environment]::OSVersion.Version.tostring(), $PSVersionTable.PSVersion.tostring(), $PSEdition, [Net.ServicePointManager]::SecurityProtocol) `
        -Type Info `
        -Function $MyInvocation.MyCommand.Name
}

function Write-Footer {
    param ($invocation)
    # only print the footer to screen if the user called the function directly rather than an add on via packaging.
    # ConvertTo-AzsPfx calls Invoke-AzsCertValidation, only want a header/footer when called by ConvertTo-AzsPfx
    if (-not ('ConvertTo-AzsPFX' -in (Get-PSCallStack).command -and 'Invoke-AzsCertificateValidation' -in (Get-PSCallStack).command )) {
        Write-AzsReadinessLog -Message ("`nLog location (contains PII): $AzsReadinessLogFile") `
            -Type Info `
            -Function $MyInvocation.MyCommand.Name `
            -toScreen
        if ($invocation.MyCommand.Name -match 'Validation') {
            Write-AzsReadinessLog -Message ("Report location (contains PII): $AzsReadinessReport") `
                -Type Info `
                -Function $MyInvocation.MyCommand.Name `
                -toScreen
        }

        Write-AzsReadinessLog -Message ("{0} Completed" -f (Get-CmdletName (Get-PSCallStack))) `
            -Type Info `
            -Function $MyInvocation.MyCommand.Name `
            -toScreen
    }
}

Function Get-CmdletName {
    param ($callstack)
    try {
        $functionCalled = (Get-PSCallStack)[-2].Command
        if (!$functionCalled) {
            "Certificate Validation"
        }
        $functionCalled
    }
    catch {
        throw "Certificate Validation"
    }
}

function Get-GuidMask {
    [cmdletbinding()]
    [OutputType([string])]
    Param ([Parameter(ValueFromPipeline = $True)][string]$guid)
    Begin {
        $r = [regex]::new("(-([a-fA-F0-9]{4}-){3})")

    }
    Process {
            try {
                return [regex]::replace($guid,$r,"-xxxx-xxxx-xxxx-")
            }
            catch {
                $_.exception
            }
        }
    End{}
}

function Get-PIIMask {
    [cmdletbinding()]
    [OutputType([string])]
    Param ([Parameter(ValueFromPipeline = $True)][string]$in)
    Begin {
        $pii = $($ENV:USERDNSDOMAIN),$($ENV:COMPUTERNAME),$($ENV:USERNAME),$($ENV:USERDOMAIN) | Foreach-Object {
            if ($null -ne $PSITEM) {
                $PSITEM
            }
        }
        $r = $pii -join '|'
    }
    Process {
            try {
                return [regex]::replace($in,$r,"[*redacted*]")
            }
            catch {
                $_.exception
            }
        }
    End{}
}

function RunMask {
    [cmdletbinding()]
    [OutputType([string])]
    Param ([Parameter(ValueFromPipeline = $True)][string]$in)
    Begin {}
    Process {
            try {
                $in | Get-PIIMask | Get-GuidMask
            }
            catch {
                $_.exception
            }
        }
    End{}
}

function Write-AzsResult
{
    param([psobject]$in, $AdditionalhelpURL)
    if ($in.test)
    {
        Write-Host ("`t{0}: " -f $($in.Test)) -noNewLine
        if ($in.Result -eq 'OK')
        {
            Write-Host 'OK' -foregroundcolor Green
        }
        elseif ($in.Result -eq 'WARNING')
        {
            Write-Host 'Warning' -foregroundcolor Yellow
        }
        elseif ($in.Result -eq 'Skipped')
        {
            Write-Host 'Skipped' -foregroundcolor White
        }
        elseif ($in.Result -eq 'SkippedByConfig')
        {
            Write-Host 'SkippedByConfig' -foregroundcolor White
        }
        else
        {
            Write-Host 'Fail' -foregroundcolor Red
        }
    }
    else
    {
        Write-Host "`Details:"
        $in | ForEach-Object {if($_){Write-Host "[-] $_" -foregroundcolor Yellow}}
        if ($AdditionalhelpURL){
            Write-Host ("Additional help URL {0}" -f "$additionalHelpUrl")
        }
    }
}
# SIG # Begin signature block
# MIIjkgYJKoZIhvcNAQcCoIIjgzCCI38CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDx+mdS1l69Bu+R
# 7qRmGnBE4sat6gxbvhXwKRuCPffF86CCDYEwggX/MIID56ADAgECAhMzAAACUosz
# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBw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