# Azure Service Bus Idle

> ZopNight reads the IncomingMessages and OutgoingMessages series on a Service Bus namespace over 30 days and flags it only when every present series averages 0 and at least one carries 7 or more days of trustworthy history. Base namespace charges continue regardless of message flow, so confirmed silence is recoverable spend.

Source: https://zop.dev/integrations/azure/recommendations/azure-service-bus-idle
Updated: 2026-08-19

---

## Message queues fail quiet, not loud

When an application is decommissioned, its queues rarely go with it. The Service Bus namespace
keeps its base charge (and Premium keeps its messaging-unit fee) while both sides of every
queue and topic sit empty. ZopNight watches the namespace-level `IncomingMessages` and
`OutgoingMessages` series: a positive average on either one means some producer or consumer is
alive, and the rule steps aside immediately.

## Trusting a zero takes history

A zero average on a series that spans two days is indistinguishable from a namespace that was
just created or just re-created. The rule requires at least one present series to carry 7 or
more days of real data before believing the silence, which is the same coverage bar ZopNight's
rightsizing rules use. With no authoritative series present at all, there is no fallback: the
discoverer emits no message-count tags, so absence of telemetry means abstain, never fire.

## Read the namespace counters

```bash
az monitor metrics list \
  --resource "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ServiceBus/namespaces/<name>" \
  --metric IncomingMessages OutgoingMessages \
  --interval P1D --offset 30d --aggregation Total
```

Thirty daily totals of 0 in both directions mirrors what the rule saw.

## Why dead-letter queues deserve a look first

Zero flowing messages does not always mean zero messages. Before deleting, check queue depths:
a dead-letter queue holding failed payloads may be the only remaining copy of unprocessed
work. `az servicebus queue show` reports `countDetails` per queue, including dead-letter
counts. Drain or export anything that matters, then delete the namespace. Queues, topics, and
subscriptions go with it.

## When no finding is emitted

Any positive incoming or outgoing average, both series absent, all present series shallower
than 7 days, or a missing namespace price. Each of these keeps the rule silent. Severity is
medium: the base fee is modest on Basic and Standard, material on Premium messaging units.

## Minimal access to reproduce

Reader on the subscription covers namespace discovery; Monitoring Reader covers the two metric
series. No write permission exists in ZopNight for Service Bus, so remediation is always a
reviewed, human delete.
