Curated Examples
Build service health HTML report
Render Microsoft 365 service health data into a local HTML report.
This pattern is useful when operations needs a shareable report instead of console output.
It is adapted from Examples/Example-Office365StatusUsingDashimo.ps1.
Example
Import-Module PSWinDocumentation.O365HealthService
Import-Module PSWriteHTML
$applicationId = '<application-id>'
$applicationKey = '<client-secret>'
$tenantDomain = 'contoso.com'
$reportPath = Join-Path $PSScriptRoot 'Health.html'
$health = Get-Office365Health -ApplicationID $applicationId -ApplicationKey $applicationKey -TenantDomain $tenantDomain -Verbose
Dashboard -FilePath $reportPath {
TabOption -BorderRadius 0px -BackgroundColorActive DimGrey
SectionOption -BorderRadius 0px -HeaderBackGroundColor DimGrey
TableOption -DataStore JavaScript -ArrayJoinString '; ' -ArrayJoin -BoolAsString
Tab -Name 'Current Status' {
Section -Name 'Current Status' {
Table -DataTable $health.CurrentStatus -Filtering {
TableCondition -Name 'ServiceStatus' -Value 'serviceOperational' -BackgroundColor MintGreen -FailBackgroundColor Salmon
}
}
}
Tab -Name 'Incidents' {
Section -Name 'Incidents' {
Table -DataTable $health.Incidents -Filtering {
TableCondition -Name 'IsResolved' -Value $true -BackgroundColor MintGreen -FailBackgroundColor Salmon -ComparisonType bool
}
}
}
} -Online -ShowHTML
What this demonstrates
- combining service health collection with PSWriteHTML output
- writing the report to a script-local file
- keeping credentials as placeholders in public documentation