{"record":{"id":"0924c49639c264a1","repo":"home-assistant/core","slug":"could-not-connect-to-azure-event-hub","errorCode":null,"errorMessage":"Could not connect to Azure Event Hub","messagePattern":"Could not connect to Azure Event Hub","errorType":"exception","errorClass":"ConfigEntryNotReady","httpStatus":null,"severity":"error","filePath":"homeassistant/components/azure_event_hub/__init__.py","lineNumber":107,"sourceCode":"            DOMAIN, context={\"source\": SOURCE_IMPORT}, data=yaml_config[DOMAIN]\n        )\n    )\n    return True\n\n\nasync def async_setup_entry(\n    hass: HomeAssistant, entry: AzureEventHubConfigEntry\n) -> bool:\n    \"\"\"Do the setup based on the config entry and the filter from yaml.\"\"\"\n    hub = AzureEventHub(\n        hass,\n        entry,\n        hass.data[DATA_COMPONENT],\n    )\n    try:\n        await hub.async_test_connection()\n    except EventHubError as err:\n        raise ConfigEntryNotReady(\"Could not connect to Azure Event Hub\") from err\n    entry.runtime_data = hub\n    entry.async_on_unload(hub.async_stop)\n    entry.async_on_unload(entry.add_update_listener(async_update_listener))\n    await hub.async_start()\n    return True\n\n\nasync def async_update_listener(\n    hass: HomeAssistant, entry: AzureEventHubConfigEntry\n) -> None:\n    \"\"\"Update listener for options.\"\"\"\n    entry.runtime_data.update_options(entry.options)\n\n\nasync def async_unload_entry(\n    hass: HomeAssistant, entry: AzureEventHubConfigEntry\n) -> bool:\n    \"\"\"Unload a config entry.\"\"\"","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/azure_event_hub/__init__.py#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"def is_event_hub_error(err: BaseException) -> bool:\n    from azure.eventhub.exceptions import EventHubError\n    return isinstance(err, EventHubError)","tryCatchPattern":"try:\n    await hub.async_test_connection()\nexcept EventHubError as err:\n    # transient: surface as retryable, do not crash setup\n    raise ConfigEntryNotReady(\"Could not connect to Azure Event Hub\") from err","preventionTips":["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"],"tags":["azure","event-hub","config-entry","connection"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}