1<#2.SYNOPSIS3 Probes reachability of an Azure Service Bus / Event Hubs namespace and prints4 a normalized per-check report.5.DESCRIPTION6 Runs the mechanical connectivity probe for a messaging namespace: DNS7 resolution, HTTPS reachability, and TCP connectivity to the well-known8 messaging ports (AMQP 5671/5672, HTTPS 443, and — with -Kafka — Event Hubs9 Kafka 9093). Emits one normalized table plus a summary so the result is clear10 without re-inspecting raw Test-NetConnection / Resolve-DnsName output.1112 A blocked port is a valid diagnostic result, not a failure. Choosing which13 namespace to test and diagnosing a blocked port (IP firewall vs. corporate14
111$rows.Add([PSCustomObject]@{ Check = "DNS resolution"; Port = "-"; Result = $dnsResult })
112
113if ($dnsOk) {
114 $rows.Add([PSCustomObject]@{ Check = "HTTPS reachability"; Port = "443"; Result = (Get-HttpsResult) })
115 $rows.Add([PSCustomObject]@{ Check = "AMQP over TLS"; Port = "5671"; Result = (Get-PortResult 5671) })
116 $rows.Add([PSCustomObject]@{ Check = "AMQP"; Port = "5672"; Result = (Get-PortResult 5672) })
117 $rows.Add([PSCustomObject]@{ Check = "HTTPS / WebSockets"; Port = "443"; Result = (Get-PortResult 443) })
118 if ($Kafka) {
119 $rows.Add([PSCustomObject]@{ Check = "Event Hubs Kafka"; Port = "9093"; Result = (Get-PortResult 9093) })
120 }
121} else {
122 $rows.Add([PSCustomObject]@{ Check = "HTTPS reachability"; Port = "443"; Result = "skipped (DNS failed)" })
123 $rows.Add([PSCustomObject]@{ Check = "AMQP over TLS"; Port = "5671"; Result = "skipped (DNS failed)" })
124 $rows.Add([PSCustomObject]@{ Check = "AMQP"; Port = "5672"; Result = "skipped (DNS failed)" })
125 $rows.Add([PSCustomObject]@{ Check = "HTTPS / WebSockets"; Port = "443"; Result = "skipped (DNS failed)" })
126 if ($Kafka) {
127 $rows.Add([PSCustomObject]@{ Check = "Event Hubs Kafka"; Port = "9093"; Result = "skipped (DNS failed)" })
128 }
129}
130
131$rows | Format-Table -AutoSize
132
133if (-not $dnsOk) {
134 Write-Host "Summary: could not resolve $fqdn. Check the namespace name and DNS/private-endpoint configuration before testing ports."
135} else {
136 Write-Host "Summary: DNS resolved to $resolvedIp. 'reachable' ports accept TCP connections; any 'BLOCKED' port points to an IP firewall, NSG, corporate proxy, or private-endpoint restriction to investigate. Port 443 (WebSockets) can be used as a fallback when AMQP ports 5671/5672 are blocked."