home-assistant/core · error · ConfigEntryNotReady
Could not connect to Azure Event Hub
Error message
Could not connect to Azure Event Hub
What it means
Raised as ConfigEntryNotReady when azure-eventhub's EventHubError escapes AzureEventHub.async_test_connection() during config entry setup. It means the EventProducer could not be created or could not reach the namespace (connection string, Fully Qualified Namespace, or network problem). Home Assistant will retry setup with backoff instead of failing permanently.
Source
Thrown at homeassistant/components/azure_event_hub/__init__.py:107
DOMAIN, context={"source": SOURCE_IMPORT}, data=yaml_config[DOMAIN]
)
)
return True
async def async_setup_entry(
hass: HomeAssistant, entry: AzureEventHubConfigEntry
) -> bool:
"""Do the setup based on the config entry and the filter from yaml."""
hub = AzureEventHub(
hass,
entry,
hass.data[DATA_COMPONENT],
)
try:
await hub.async_test_connection()
except EventHubError as err:
raise ConfigEntryNotReady("Could not connect to Azure Event Hub") from err
entry.runtime_data = hub
entry.async_on_unload(hub.async_stop)
entry.async_on_unload(entry.add_update_listener(async_update_listener))
await hub.async_start()
return True
async def async_update_listener(
hass: HomeAssistant, entry: AzureEventHubConfigEntry
) -> None:
"""Update listener for options."""
entry.runtime_data.update_options(entry.options)
async def async_unload_entry(
hass: HomeAssistant, entry: AzureEventHubConfigEntry
) -> bool:
"""Unload a config entry."""View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Verify the connection string in the config entry (host UI: Settings > Devices & services > Azure Event Hub > re-configure) and confirm it contains a valid SharedAccessKey and the correct EntityPath
- Test reachability of the Event Hub namespace (amqps://<namespace>.servicebus.windows.net:5671) from the host network
- If SAS keys were rotated, regenerate the connection string in the Azure portal and update the integration options
- Because the error is ConfigEntryNotReady, transient outages self-heal on retry; check the Azure namespace status if it persists
Defensive patterns
Strategy: retry
Type guard
def is_event_hub_error(err: BaseException) -> bool:
from azure.eventhub.exceptions import EventHubError
return isinstance(err, EventHubError) Try / catch
try:
await hub.async_test_connection()
except EventHubError as err:
# transient: surface as retryable, do not crash setup
raise ConfigEntryNotReady("Could not connect to Azure Event Hub") from err Prevention
- Validate the connection string with a standalone EventHubProducerClient before configuring the integration
- Store SAS keys in a secret manager so rotation does not strand the entry
- Monitor entry state; ConfigEntryNotReady retries are expected during Azure outages
When it happens
Trigger: async_setup_entry calls hub.async_test_connection(); any azure.eventhub.exceptions.EventHubError (connection string malformed, SAS key expired, namespace DNS unreachable, RBAC auth failure to the Event Hub) surfaces here.
Common situations: Wrong or rotated connection string, using the namespace-level connection string without the EntityPath for an import/export hub, firewall/proxy blocking amqps port 5671, or an expired SAS policy.
Related errors
- Could not find Azure Data Explorer database or table
- account_not_found
- invalid_auth
- Credential is already linked to a user
- System generated users cannot disable multi-factor auth modu
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/0924c49639c264a1.
Report an issue: GitHub.