Microsoft.AzureStack.ReadinessChecker.psm1
#Requires -RunAsAdministrator #Requires -Version 5.0 <############################################################# # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # #############################################################> <# .SYNOPSIS This module is intended to be made directly available to customers, that can be run before Azure Stack deployment and for ongoing use for operational tasks such as Secret Rotation. .DESCRIPTION Contains the following: CertificateValidation Read the PFXData, public info is protected by the password and without a profile loaded (such as GMSA account). Signature Algorithm is not SHA1. Private Key is present and contains local machine key attribute. Certification Chain is complete including intermediaries and in a specific order. DNS Names match the required names or covered by supporting wildcard. Key Usage contains Digital Signature and Key Encipherment. AzureValidation AADServiceAdministrator is correctly provisioned and matches deploymentdata.json for install Registration Account is correct type and owners of the subscriptionID provided. Generate Certificate Requests Generate Certificate Requests using the documented requerst template for Azure Stack. .EXAMPLE PS C:\>$password = Read-Host -Prompt "Enter PFX Password" -AsSecureString PS C:\>Start-AzsReadinessChecker -CertificatePath .\Certificates\ -pfxPassword $password -regionname east -fqdn azurestack.contoso.com -identitySystem ADD Validate Certificates .EXAMPLE PS C:\>$serviceAdminCredential = Get-Credential (serviceadmin@contoso.onmicrosoft.com) -Message "Enter Credentials for Service Administrator of Azure Active Directory Tenant" PS C:\>Start-AzsReadinessChecker -AADServiceAdministrator $serviceAdminCredential - AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com Validates Azure Assets - Azure Active Directory Validation .EXAMPLE PS C:\>$registrationCredential = Get-Credential (subscriptionowner@contoso.onmicrosoft.com) -Message "Enter Credentials for Subscription Owner" PS C:\>$subscriptionID = "f7c26209-cd2d-4625-86ba-724ebeece794" PS C:\>Start-AzsReadinessChecker -RegistrationAccount $registrationCredential -RegistrationSubscriptionID $subscriptionID -AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com Validates Azure Assets - Registration Validation .EXAMPLE PS C:\>$regionName = 'east' PS C:\>$externalFQDN = 'azurestack.contoso.com' PS C:\>$subjectHash = [ordered]@{"OU"="AzureStack";"O"="Microsoft";"L"="Redmond";"ST"="Washington";"C"="US"} PS C:\>Start-AzsReadinessChecker -regionName $regionName -externalFQDN $externalFQDN -subject $subjectHash -requestType SingleSAN -IdentitySystem AAD Generates Certificate Requests - Single multi child domain wildcard suitable for AAD install .EXAMPLE PS C:\>Start-AzsReadinessChecker ps1 -RegionName $regionName -ExternalFQDN $externalFQDN -subjectName $subjectName -IdentitySystem AAD -RequestType Multiple -IncludePaaS Generates Certificate Request - Multiple single domain wildcard including PaaS .EXAMPLE PS C:\>Start-AzsReadinessChecker -ReportPath Contoso-AzsReadinessReport.json Reads Contoso's Readiness Report, provides details and summary of validation results .EXAMPLE PS C:\>Start-AzsReadinessChecker -ReportPath Contoso-AzsReadinessReport.json -ReportSections Certificate -Summary Reads Contoso's Readiness Report, provides summary tailored to certificate validation only. .EXAMPLE PS C:\>Start-AzsReadinessChecker [-pfxPassword <SecureString>] -pfxPath <String> -ExportToPath <String> [<CommonParameters>] .EXAMPLE PS C:\>$PaaSCertificates = @{ 'PaaSDBCert' = @{'pfxPath' = 'c:\certs\DBCert.pfx';'pfxPassword' = (ConvertTo-SecureString -String 'Password' -AsPlainText -Force)} 'PaaSDefaultCert' = @{'pfxPath' = 'c:\certs\DefaultPaaSCert.pfx';'pfxPassword' = (ConvertTo-SecureString -String 'Password' -AsPlainText -Force)} 'PaaSAPICert' = @{'pfxPath' = 'c:\certs\PaaSAPICert.pfx';'pfxPassword' = (ConvertTo-SecureString -String 'Password' -AsPlainText -Force)} 'PaaSFTPCert' = @{'pfxPath' = 'c:\certs\PaaSFTPCert.pfx';'pfxPassword' = (ConvertTo-SecureString -String 'Password' -AsPlainText -Force)} 'PaaSSSOCert' = @{'pfxPath' = 'c:\certs\PaaSSSOCert.pfx';'pfxPassword' = (ConvertTo-SecureString -String 'Password' -AsPlainText -Force)} } PS C:\>Start-AzsReadinessChecker -RegionName east -FQDN azurestack.contoso.com -paasCertificates $PaaSCertificates Validate PaaS Certificates .PARAMETER CertificatePath Specifies the path under which only the certificate required certificate folders are present. Required folders for Azure Stack deployment with Azure Active Directory identity system are: ACSBlob, ACSQueue, ACSTable, Admin Portal, ARM Admin, ARM Public, KeyVault, KeyVaultInternal, Public Portal Required folder for Azure Stack deployment with Active Directory Federation Services identity system are: ACSBlob, ACSQueue, ACSTable, ADFS, Admin Portal, ARM Admin, ARM Public, Graph, KeyVault, KeyVaultInternal, Public Portal .PARAMETER RegionName Specifies the Azure Stack deployment's region name when deploymentdata.json is not used. .PARAMETER FQDN Specifies the Azure Stack deployment's External FQDN, also aliased as ExternalFQDN and ExternalDomainName .PARAMETER IdentitySystem Specifies the Azure Stack deployment's Identity System valid values, AAD or ADFS, for Azure Active Directory and Active Directory Federated Services respectively .PARAMETER PfxPassword Specifies the password associated with PFX certificate files. .PARAMETER DeploymentDataJSONPath Specifies the Azure Stack deployment deployment data JSON configuration file. Generally only available to the deployment team. .PARAMETER PfxPath Specifies the path to a problematic certificate that requires import/export routine to fix, as indicated by certificate validation in this tool .PARAMETER ExportPFXPath Specifies the destination path for the resultant PFX file from import/export routine. .PARAMETER Subject Specifies an ordered dictionary of the subject for the certificate request generation. .PARAMETER RequestType Specifies the SAN type of the certificate request. Valid values: MultipleSAN, SingleSAN. MultipleSAN generates one certificate request for all services, SingleSAN generates multiple certificate requests, one for each service. .PARAMETER IncludePaaS Specifies if PaaS services/hostnames should be added to the certificate request(s) .PARAMETER OutputRequestPath Specifies the destination path for certificate request files, directory must already exist. .PARAMETER AADServiceAdministrator Specifies Azure Active Directory Service Administrator intended to be used for Azure Stack deployment. .PARAMETER AADDirectoryTenantName Specifies the Azure Active Directory name intended to be used for Azure Stack deployment. .PARAMETER AzureEnvironment Specifies the instance of Azure Services containing the accounts, directories and subscriptions intended to be used for Azure Stack deployment and registration. .PARAMETER RegistrationAccount Specifies the Registration Account intended to be used for Azure Stack registration. .PARAMETER RegistrationSubscriptionID Specifies the Registration Subscription ID intended to be used for Azure Stack registration. .PARAMETER ReportPath Specifies path for Readiness Report, defaults to current directory and default report name. .PARAMETER ReportSections Specifies report sections to output, defaults to All. .PARAMETER Summary Specifies whether to only show report summary, omits detail. .PARAMETER CleanReport Specifies whether to purge the existing report and start again with a clean report. Execution history and validation data is lost. .PARAMETER OutputPath Specifies custom path to save Readiness JSON report and Verbose log file. .PARAMETER PaaSCertificates Specifies a hashtable containing path and password to DB, Default, API, FTP & SSO Paas Certificates. Each individual certificate is optional. .NOTES Verbose Logging is written to the script root .LINK https://aka.ms/AzsReadinessChecker #> function Start-AzsReadinessChecker { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] Param( [Parameter(Mandatory=$false,ParameterSetName='ValidateCertificates',HelpMessage="Enter Path to Certificates Directory")] [Parameter(Mandatory=$false,ParameterSetName='ValidateCertificatesJSON',HelpMessage="Enter Path to Certificates Directory")] [ValidateScript({Test-Path $_ -PathType Container})] [string] $CertificatePath = ".\Certificates", [Parameter(Mandatory=$true,ParameterSetName='ValidateCertificates',HelpMessage="Enter Azure Stack Region Name")] [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage="Enter Azure Stack Region Name")] [Parameter(Mandatory=$true,ParameterSetName='ValidatePaaSCertificates',HelpMessage="Enter Azure Stack Region Name")] [string]$RegionName, [Parameter(Mandatory=$true,ParameterSetName='ValidateCertificates',HelpMessage="Enter Azure Stack External FQDN (without region name)")] [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage="Enter Azure Stack External FQDN (without region name)")] [Parameter(Mandatory=$true,ParameterSetName='ValidatePaaSCertificates',HelpMessage="Enter Azure Stack External FQDN (without region name)")] [Alias("ExternalFQDN","ExternalDomainName")] [string]$FQDN, [Parameter(Mandatory=$true,ParameterSetName='ValidateCertificates',HelpMessage="Enter Azure Stack Identity System (AAD or ADFS)")] [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage="Enter Azure Stack Identity System (AAD or ADFS)")] [ValidateSet('AAD','ADFS')] [string]$IdentitySystem, [Parameter(Mandatory=$true,ParameterSetName='ValidateCertificates',HelpMessage="Enter the PFX password as a securestring")] [Parameter(Mandatory=$true,ParameterSetName='CertificateImportExport',HelpMessage="Enter the PFX password as a securestring")] [Parameter(Mandatory=$true,ParameterSetName='ValidateCertificatesJSON',HelpMessage="Enter the PFX password as a securestring")] [securestring]$PfxPassword, [Parameter(Mandatory=$true, ParameterSetName='ValidateCertificatesJSON',HelpMessage="Enter Path to DeploymentData.json")] [Parameter(Mandatory=$true, ParameterSetName='ValidateAzureInstallJSON',HelpMessage="Enter Path to DeploymentData.json")] [Parameter(Mandatory=$true, ParameterSetName='ValidateAzureRegistrationJSON',HelpMessage="Enter Path to DeploymentData.json")] [Parameter(Mandatory=$true,ParameterSetName='ValidatePaaSCertificatesJSON',HelpMessage="Provide Hashtable with PFX path and password details for each PaaS Certificate. See Get-Help Start-AzsReadinessChecker -Examples")] [ValidateScript({Test-Path $_ -Include *.json})] [string]$DeploymentDataJSONPath, [Parameter(Mandatory=$true,ParameterSetName='CertificateImportExport',HelpMessage="Path to PFX on disk")] [ValidateScript({Test-Path $_ -Include *.pfx -PathType Leaf})] [string]$PfxPath, [Parameter(Mandatory=$true,ParameterSetName="CertificateImportExport",HelpMessage="Destination Path for PFX export e.g. C:\ExistingFolder\NewSSL.pfx")] [ValidateScript({((Test-Path -Path (Split-Path -Path $_ -Parent)) -AND ([IO.Path]::GetExtension($_) -eq '.pfx'))})] [string]$ExportPFXPath, [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage='Provide subject name as an ordered hashtable e.g. $subject = [ordered]@{"OU"="AzureStack";"O"="Microsoft";"L"="Redmond";"ST"="Washington";"C"="US"}')] [System.Collections.Specialized.OrderedDictionary]$Subject, [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage="Enter Certificate Request generation type ('Single' = Request individual wildcard certificates, 'Multiple' = Request single multi domain wildcard certificates")] [ValidateSet('MultipleCSR','SingleCSR')] [string]$RequestType, [Parameter(Mandatory=$false,ParameterSetName='CertificateRequest',HelpMessage="Use if you want to add PaaS domain names to the certificate request")] [switch]$IncludePaaS = $false, [Parameter(Mandatory=$true,ParameterSetName="CertificateRequest",HelpMessage="Destination Path for Certificate Request(s)")] [ValidateScript({Test-Path -Path $_ -PathType Container})] [string]$OutputRequestPath, [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureInstall',HelpMessage="Enter Service Administrator Azure Credential as PSCredential")] [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureInstallJSON',HelpMessage="Enter Service Administrator Azure Credential as PSCredential")] [pscredential]$AADServiceAdministrator, [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureInstall',HelpMessage="Enter primary domain name of Azure Tenant Directory")] [string]$AADDirectoryTenantName, [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureInstall',HelpMessage="Enter Azure Service Endpoint 'AzureCloud', 'AzureChinaCloud', or 'AzureGermanCloud'")] [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureRegistration',HelpMessage="Enter Azure Service Endpoint 'AzureCloud', 'AzureChinaCloud', or 'AzureGermanCloud'")] [ValidateSet('AzureCloud','AzureChinaCloud','AzureGermanCloud')] [string]$AzureEnvironment, [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureRegistration',HelpMessage="Enter Azure Registration Azure Credential as PSCredential")] [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureRegistrationJSON',HelpMessage="Enter Azure Registration Azure Credential as PSCredential")] [pscredential]$RegistrationAccount, [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureRegistration',HelpMessage="Enter Azure Registration Subscription ID")] [Parameter(Mandatory=$true,ParameterSetName='ValidateAzureRegistrationJSON')] [System.Guid]$RegistrationSubscriptionID, [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', 'Jobs', or 'All'")] [ValidateSet('Certificate','AzureRegistration','AzureIdentity','Jobs','All')] [string]$ReportSections = 'All', [Parameter(Mandatory=$false,ParameterSetName="ReadReport",HelpMessage="Summarize report for issues only")] [switch]$Summary = $false, [Parameter(Mandatory=$false,ParameterSetName='ValidateCertificates',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidateCertificatesJSON',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidateAzureRegistration',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidateAzureRegistrationJSON',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidateAzureInstall',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidateAzureInstallJSON',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidatePaaSCertificates',HelpMessage="Remove all previous progress and create a clean report")] [Parameter(Mandatory=$false,ParameterSetName='ValidatePaaSCertificatesJSON',HelpMessage="Remove all previous progress and create a clean report")] [switch]$CleanReport = $false, [Parameter(HelpMessage="Directory path for log and report output")] [string]$OutputPath = "$ENV:TEMP\AzsReadinessChecker", [Parameter(Mandatory=$true,ParameterSetName='ValidatePaaSCertificates',HelpMessage="Provide Hashtable with PFX path and password details for each PaaS Certificate. See Get-Help Start-AzsReadinessChecker -Examples")] [Parameter(Mandatory=$true,ParameterSetName='ValidatePaaSCertificatesJSON',HelpMessage="Provide Hashtable with PFX path and password details for each PaaS Certificate. See Get-Help Start-AzsReadinessChecker -Examples")] [hashtable]$PaaSCertificates ) $ErrorActionPreference = 'Stop' $thisFunction = $MyInvocation.MyCommand.Name #Provision output if not already existing and derive log and report paths if (-not (Test-Path $OutputPath)) { try { $null = New-Item $OutputPath -ItemType Directory -Force Write-AzsReadinessLog -Message ('Creating output path {0}' -f $OutputPath) -Type Info -Function $thisFunction -toScreen } catch { throw ("Creating output path location {0} failed with error {1}" -f $OutputPath, $_.exception) } } if ($deploymentDataJSONPath) { Try { $deploymentDataJSON = Get-Content $deploymentDataJSONPath | ConvertFrom-Json } Catch { if ($_.exception -like '*Invalid JSON primitive*') { throw "Invalid JSON file provided $deploymentDataJSONPath" } } } $Global:AzsReadinessLogFile = Join-Path -Path $OutputPath -ChildPath 'AzsReadinessChecker.log' $Global:AzsReadinessReport = Join-Path -Path $OutputPath -ChildPath 'AzsReadinessCheckerReport.json' $paramToString = ($PSBoundParameters.GetEnumerator() | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join ';' Write-AzsReadinessLog -Message ('AzsReadinessChecker v{0} started' -f $MyInvocation.MyCommand.Module.Version.ToString()) -Type Info -Function $thisFunction -toScreen Write-AzsReadinessLog -Message ('AzsReadinessChecker started version: {0} with parameters: {1}' -f $MyInvocation.MyCommand.Module.Version.ToString(), $paramToString) -Type Info -Function $thisFunction Write-AzsReadinessLog -Message ('OSVersion: {0} PSVersion: {1} PSEdition: {2}' -f [environment]::OSVersion.Version.tostring(),$PSVersionTable.PSVersion.tostring(), $PSEdition) -Type Info -Function $thisFunction if ($PSCmdlet.ParameterSetName -match 'Validate') { # Get new or existing Readiness Report $readinessReport = Get-AzsReadinessProgress -clean:$CleanReport $readinessReport = Add-AzsReadinessCheckerJob -report $readinessReport } # Run Param sets in this order Validate Certificates > Validate Azure Install > Validate Azure Registration if ($PSCmdlet.ParameterSetName -contains 'ValidateCertificates') { # convert IdentitySystem to useADFS switch Write-AzsReadinessLog -Message ("Starting Certificate Validation`n") -Type Info -Function $thisFunction -toScreen Switch ($IdentitySystem) { 'ADFS' { $useADFS = $true } 'AAD' { $useADFS = $false } } $certificateValidationParams = @{ 'CertificatePath' = $CertificatePath 'RegionName' = $RegionName 'Externalfqdn' = $FQDN 'pfxPassword' = $pfxPassword 'UseADFS' = $useADFS } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.CertificateValidation.psm1 -force $readinessReport.CertificateValidation.DeploymentCertificates = Invoke-AzureStackCertificateValidation @certificateValidationParams Copy-AzsReadinessLogging -ComponentLogFile CertChecker Write-AzsReadinessLog -Message ("`nFinished Certificate Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidateCertificatesJSON') { Write-AzsReadinessLog -Message ("Starting Certificate Validation with JSON configuration`n") -Type Info -Function $thisFunction -toScreen $ValidateCertificatesJSONParams = @{ 'CertificatePath' = $CertificatePath 'pfxPassword' = $pfxPassword 'deploymentDataJSONPath' = $deploymentDataJSONPath } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.CertificateValidation.psm1 -force $readinessReport.CertificateValidation.DeploymentCertificates = Invoke-AzureStackCertificateValidation @ValidateCertificatesJSONParams Copy-AzsReadinessLogging -ComponentLogFile CertChecker Write-AzsReadinessLog -Message ("`nFinished Certificate Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidatePaaSCertificates') { if ((test-path $PaaSCertificates.values.pfxpath -include *.pfx) -contains $false) { throw ("Unable to resolve PFX File(s). Ensure all PFX files paths are accurate.") } Write-AzsReadinessLog -Message ("Starting PaaS Certificate Validation`n") -Type Info -Function $thisFunction -toScreen $paasCertificateValidationParams = @{ 'PaaSCertificates' = $PaaSCertificates 'RegionName' = $RegionName 'Externalfqdn' = $FQDN } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.CertificateValidation.psm1 -force $readinessReport.CertificateValidation.PaaSCertificates = Invoke-AzureStackCertificateValidation @paasCertificateValidationParams Copy-AzsReadinessLogging -ComponentLogFile CertChecker Write-AzsReadinessLog -Message ("`nFinished PaaS Certificate Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidatePaaSCertificatesJSON') { if ((test-path $PaaSCertificates.values.pfxpath -include *.pfx) -contains $false) { throw ("Unable to resolve PFX File(s). Ensure all PFX files paths are accurate.") } Write-AzsReadinessLog -Message ("Starting PaaS Certificate Validation with JSON configuration`n") -Type Info -Function $thisFunction -toScreen $ValidatePaaSCertificatesJSONParams = @{ 'PaaSCertificates' = $PaaSCertificates 'deploymentDataJSONPath' = $deploymentDataJSONPath } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.CertificateValidation.psm1 -force $readinessReport.CertificateValidation.PaaSCertificates = Invoke-AzureStackCertificateValidation @ValidatePaaSCertificatesJSONParams Copy-AzsReadinessLogging -ComponentLogFile CertChecker Write-AzsReadinessLog -Message ("`nFinished PaaS Certificate Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidateAzureInstall') { Write-AzsReadinessLog -Message ("Starting Azure Identity Validation`n") -Type Info -Function $thisFunction -toScreen $ValidateAzureInstallParams = @{ 'AADServiceAdministrator' = $AADServiceAdministrator 'AzureEnvironment' = $AzureEnvironment 'AADDirectoryTenantName' = $AADDirectoryTenantName } $null = Import-Module $PSScriptRoot\AzureValidation\Microsoft.AzureStack.AzureValidation.psm1 -force $readinessReport.AzureValidation.AzureInstallResult = Invoke-AzureStackAzureValidation @ValidateAzureInstallParams Copy-AzsReadinessLogging -ComponentLogFile AADHelper Write-AzsReadinessLog -Message ("`nFinished Azure Identity Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidateAzureInstallJSON') { Write-AzsReadinessLog -Message ("Starting Azure Identity Validation with JSON configuration`n") -Type Info -Function $thisFunction -toScreen $ValidateAzureInstallJSONParams = @{ 'AADServiceAdministrator' = $AADServiceAdministrator 'deploymentDataJSONPath' = $deploymentDataJSONPath } $null = Import-Module $PSScriptRoot\AzureValidation\Microsoft.AzureStack.AzureValidation.psm1 -force $readinessReport.AzureValidation.AzureInstallResult = Invoke-AzureStackAzureValidation @ValidateAzureInstallJSONParams Copy-AzsReadinessLogging -ComponentLogFile AADHelper Write-AzsReadinessLog -Message ("`nFinished Azure Identity Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidateAzureRegistration') { Write-AzsReadinessLog -Message ("Starting Azure Registration Validation`n") -Type Info -Function $thisFunction -toScreen $ValidateAzureRegistrationParams = @{ 'RegistrationAccount' = $RegistrationAccount 'AzureEnvironment' = $AzureEnvironment 'RegistrationSubscriptionID' = $RegistrationSubscriptionID } $null = Import-Module $PSScriptRoot\AzureValidation\Microsoft.AzureStack.AzureValidation.psm1 -force $readinessReport.AzureValidation.AzureRegistration = Invoke-AzureStackAzureValidation @ValidateAzureRegistrationParams Copy-AzsReadinessLogging -ComponentLogFile AADHelper Write-AzsReadinessLog -Message ("`nFinished Azure Registration Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'ValidateAzureRegistrationJSON') { Write-AzsReadinessLog -Message ("Starting Azure Registration Validation with JSON configuration`n") -Type Info -Function $thisFunction -toScreen Test-ValidateJSON $deploymentDataJSONPath $ValidateAzureRegistrationJSONParams = @{ 'RegistrationAccount' = $RegistrationAccount 'deploymentDataJSONPath' = $deploymentDataJSONPath 'RegistrationSubscriptionID' = $RegistrationSubscriptionID } $null = Import-Module $PSScriptRoot\AzureValidation\Microsoft.AzureStack.AzureValidation.psm1 -force $readinessReport.AzureValidation.AzureRegistration = Invoke-AzureStackAzureValidation @ValidateAzureRegistrationJSONParams Copy-AzsReadinessLogging -ComponentLogFile AADHelper Write-AzsReadinessLog -Message ("`nFinished Azure Registration Validation") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'CertificateImportExport') { Write-AzsReadinessLog -Message ("Starting Certificate Import/Export`n") -Type Info -Function $thisFunction -toScreen $CertificateImportExportParams = @{ 'pfxPath' = $pfxPath 'ExportPFXPath' = $ExportPFXPath 'pfxPassword' = $pfxPassword } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.CertificateValidation.psm1 -force Invoke-AzureStackCertificateValidation @CertificateImportExportParams Copy-AzsReadinessLogging -ComponentLogFile CertChecker Write-AzsReadinessLog -Message ("`nFinished Certificate Import/Export") -Type Info -Function $thisFunction -toScreen } if ($PSCmdlet.ParameterSetName -contains 'CertificateRequest') { Write-AzsReadinessLog -Message ("Starting Certificate Request Generation`n") -Type Info -Function $thisFunction -toScreen $certificateRequestParams = @{ 'regionName' = $regionName 'externalFQDN' = $fqdn 'subject' = $subject 'requestType' = $RequestType 'includePaaS' = $IncludePaaS 'OutputRequestPath' = $OutputRequestPath 'IdentitySystem' = $IdentitySystem } $null = Import-Module $PSScriptRoot\CertificateValidation\Microsoft.AzureStack.PublicCertificateRequest.psm1 -force Write-AzsCertificateRequestFile @certificateRequestParams Write-AzsReadinessLog -Message ("`nFinished Certificate Request Generation") -Type Info -Function $thisFunction -toScreen } if ($readinessReport) { $readinessReport = Close-AzsReadinessCheckerJob -report $readinessReport Write-AzsReadinessProgress -report $readinessReport Write-AzsReadinessReport -report $readinessReport } if ($PSCmdlet.ParameterSetName -contains 'ReadReport') { 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 } else { Write-AzsReadinessLog -Message ("Unable to find $reportPath. Please specify a valid report file.") -Type Warning -Function $thisFunction -toscreen } } Write-AzsReadinessLog -Message ("`nAzsReadinessChecker Log location: $AzsReadinessLogFile") -Type Info -Function $thisFunction -toscreen if ($PSCmdlet.ParameterSetName -match 'Validate') { Write-AzsReadinessLog -Message ("AzsReadinessChecker Report location: $AzsReadinessReport") -Type Info -Function $thisFunction -toscreen } Write-AzsReadinessLog -Message ("AzsReadinessChecker Completed") -Type Info -Function $thisFunction -toscreen } function Test-ValidateJSON { <# .SYNOPSIS Validate JSON file provided .DESCRIPTION Validate JSON file can parsed. .EXAMPLE Test-ValidationJSON -path .\some.json .INPUTS path to json file .OUTPUTS None - logging only .NOTES General notes #> [CmdletBinding()] param ($path) $thisFunction = $MyInvocation.MyCommand.Name Try { $null = Get-Content $path -ErrorAction Stop | ConvertFrom-Json Write-AzsReadinessLog -Message ('Validated JSON: {0}' -f $path) -Type Info -Function $thisFunction } Catch { if ($_.exception -like '*Invalid JSON primitive*') { Write-AzsReadinessLog -Message ('Invalid JSON file provided: {0}' -f $path) -Type Error -Function $thisFunction throw ('Invalid JSON file provided: {0}' -f $path) } else { Write-AzsReadinessLog -Message ('Reading JSON file {0} failed with error: {1}' -f $_.exception.message) -Type Error -Function $thisFunction throw ('Reading JSON file {0} failed with error: {1}' -f $_.exception) } } } 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-ChildItem -Path $path -Filter AzsReadinessProgress.xml | Sort-Object LastWriteTime | Select-Object -first 1 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 = Join-Path $PSScriptRoot 'AzsReadinessProgress.xml' Version = $MyInvocation.MyCommand.Module.Version.ToString() Jobs = @{} CertificateValidation = @{ DeploymentCertificates = @{} PaaSCertificates = @{} } AzureValidation = @{ AzureRegistration = @{} AzureInstallResult = @{} } } $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')][string]$Type = 'Info', [ValidateNotNullOrEmpty()][string]$Function, [switch]$toScreen ) if ($toScreen) { if ($PSEdition -eq 'desktop') { switch -wildcard ($function) { '*-AzsReadiness*' {$foregroundcolor = 'DarkYellow' } 'Success' {$foregroundcolor = 'Green'} 'Warn' {$foregroundcolor = 'Yellow'} default {$foregroundcolor = "White" } } Write-Host $message -foregroundcolor $foregroundcolor } else { Write-Output $message } } if (-not $function){$function = 'Start-AzsReadinessChecker'} $entry = "[{0}] [{1}] [{2}] {3}" -f ([datetime]::now).tostring(), $type, $function, $message $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 ("$PSScriptRoot\AzsReadinessReport.json")) -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) 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. Rename-Item -path $logPath -NewName $logPath.replace('.log','-{0}.log' -f (Get-Date -f yyyyMMddHHmmss)) } # 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','Jobs','All')]$validations) $thisFunction = $MyInvocation.MyCommand.Name Write-AzsReadinessLog -Message ('Reading report contents to output to screen') -Type Info -Function $thisFunction if ($validations -match 'Certificate|All') { if ($reportJSON.CertificateValidation.DeploymentCertificates.Test -OR $reportJSON.CertificateValidation.PaaSCertificates.Test) { if (-not $Summary) { Write-AzsReadinessLog "`n############### Deployment Certificate Validation Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.CertificateValidation.DeploymentCertificates | Select-Object Test, Result, Path, FailureDetail | Format-List Write-AzsReadinessLog "`n############### PaaS Certificate Validation Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.CertificateValidation.PaaSCertificates | Select-Object Test, Result, Path, FailureDetail | Format-List } Write-AzsReadinessLog "`n############### Certificate Validation Summary ###############`n" -Type Info -Function $thisFunction -toscreen if ($reportJSON.CertificateValidation.DeploymentCertificates.FailureDetail -match '[a-z]' -or $reportJSON.CertificateValidation.PaaSCertificates.FailureDetail -match '[a-z]') { $certificateFailures = $reportJSON.CertificateValidation.DeploymentCertificates, $reportJSON.CertificateValidation.PaaSCertificates | 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 Write-AzsReadinessLog "Run Start-AzsReadinessChecker -CertificatePath .\Certificates\ -pfxPassword `$password -regionname east -fqdn azurestack.contoso.com" -Type Info -Function $thisFunction } } if ($validations -match 'AzureRegistration|All') { if ($reportJSON.AzureValidation.AzureRegistration.AzureAccountLogon) { if (-not $Summary) { Write-AzsReadinessLog "`n############### Azure Registration Validation Logon Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.AzureValidation.AzureRegistration.AzureAccountLogon | Select-Object ` @{Label="Test Name"; Expression={$_.Test}}, ` @{Label="Result"; Expression={$_.result}}, ` @{Label="Registration Credential"; Expression={$_.Assets.credential}}, ` @{Label="Azure Environment"; Expression={$_.Assets.AzureEnvironment}},` @{Label="Azure Active Directory Tenant"; Expression={$_.Assets.AADDirectoryTenantName}}, ` @{Label="Error Details"; Expression={$_.errorDetails}} | Format-List Write-AzsReadinessLog "############### Azure Registration Validation Subscription Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.AzureValidation.AzureRegistration.SubscriptionDetail | Select-Object ` @{Label="Test"; Expression={$_.Test}}, ` @{Label="Result"; Expression={$_.Result}}, ` @{Label="AzureEnvironment"; Expression={$_.AzureEnvironment}}, ` @{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 "Start-AzsReadinessChecker -RegistrationAccount `$registrationCredential -RegistrationSubscriptionID `$subscriptionID -AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com" -Type Warning -Function $thisFunction } } if ($validations -match 'AzureIdentity|All') { if ($reportJSON.AzureValidation.AzureInstallResult.AzureAccountLogon) { if (-not $Summary) { Write-AzsReadinessLog "`n############### Azure Identity Validation Logon Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.AzureValidation.AzureInstallResult.AzureAccountLogon | Select-Object Test, Result, ` @{Label="credential"; Expression={$_.Assets.credential}}, ` @{Label="AzureEnvironment"; Expression={$_.Assets.AzureEnvironment}}, ` @{Label="AADDirectoryTenantName"; Expression={$_.Assets.AADDirectoryTenantName}}, ` errorDetails | Format-List Write-AzsReadinessLog "############### Azure Identity Validation Overall Results ###############" -Type Info -Function $thisFunction -toscreen Write-Output $reportJSON.AzureValidation.AzureInstallResult | Select-Object Test, Result, ` @{Label="AADServiceAdmin"; Expression={$_.Assets.AADServiceAdmin}}, ` @{Label="AzureEnvironment"; Expression={$_.Assets.AzureEnvironment}}, ` @{Label="AADDirectoryTenantName"; Expression={$_.Assets.AADDirectoryTenantName}}, ` 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 "Start-AzsReadinessChecker -AADServiceAdministrator `$serviceAdminCredential - AzureEnvironment AzureCloud -AzureDirectoryTenantName azurestack.contoso.com" -Type Warning -Function $thisFunction } } if ($validations -match 'Jobs|All') { if (-not $reportjson.jobs) { Write-AzsReadinessLog "Job Summary not available. Run the Start-AzsReadinessChecker" -Type Warning -Function $thisFunction -toscreen } else { if (-not $Summary) { Write-AzsReadinessLog "############### 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 } } } } # SIG # Begin signature block # MIIdqAYJKoZIhvcNAQcCoIIdmTCCHZUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUlJJyC/fRones5wZfW5SR7qbO # VnygghhUMIIEwjCCA6qgAwIBAgITMwAAALpqNt4arb08HwAAAAAAujANBgkqhkiG # 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G # A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSEw # HwYDVQQDExhNaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EwHhcNMTYwOTA3MTc1ODQ2 # WhcNMTgwOTA3MTc1ODQ2WjCBsjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp # bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw # b3JhdGlvbjEMMAoGA1UECxMDQU9DMScwJQYDVQQLEx5uQ2lwaGVyIERTRSBFU046 # RjZGRi0yREE3LUJCNzUxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNl # cnZpY2UwggEiMA0G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