All scripts
Azure AI 353
Get-AzureLoadBalancerHealthReport
Reports backend pool health probe status for every Azure Load Balancer, so a backend that has been silently unhealthy does not go unnoticed until users complain.
Get-AzureLoadBalancerHealthReport.ps1
<#
.SYNOPSIS
Reports backend health for all Azure Load Balancers.
.DESCRIPTION
Checks health probe configuration and backend pool membership for
every load balancer in the subscription, so a backend that has been
silently unhealthy is caught before users start reporting
intermittent failures.
.EXAMPLE
.\Get-AzureLoadBalancerHealthReport.ps1
.NOTES
Requires the Az.Network module and an active Connect-AzAccount session.
.AUTHOR
Shehryar Hassan
#>
$lbs = Get-AzLoadBalancer
$report = foreach ($lb in $lbs) {
foreach ($pool in $lb.BackendAddressPools) {
[pscustomobject]@{
LoadBalancer = $lb.Name
BackendPool = $pool.Name
MemberCount = $pool.BackendIpConfigurations.Count
ProbeCount = $lb.Probes.Count
}
}
}
$report | Format-Table -AutoSize
$report | Where-Object MemberCount -eq 0 | ForEach-Object { Write-Warning "$($_.LoadBalancer) / $($_.BackendPool) has zero backend members." }
Read it before you run it, and test in a safe tenant first.