Illegal Entity exception

Symptoms

Error: “An entity, such as the Event Hub, cannot be found. Verify that the Event Hub information provided is valid. This exception is thrown when the Event Hub Connection String or Event Hub information that is provided does not meet the requirements to be a valid connection string. An attempt will be made to query for content at the next retry interval.”

Error: "The messaging entity 'sb://qahub4.servicebus.windows.net/notreal' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions."

Error: "com.microsoft.azure.eventhubs.IllegalEntityException: The messaging entity 'sb://qahub4.servicebus.windows.net/notreal' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions."

Causes

The event hub (entity) doesn’t exist or the event hub connection string doesn’t contain a reference to an event hub (entity).

Resolving the problem

Follow these steps to resolve your illegal entity error.

  1. Make sure that the event hub connection string contains the entitypath section and that it refers to the event hubs name. For example,

    Endpoint=sb://<Namespace Name>.servicebus.windows.net/;SharedAccessKeyName=<SAS Key Name>;SharedAccessKey=[SAS Key];EntityPath=<Event Hub Name>

  2. Verify that the event hub exists on the Azure portal, and that the event hub path references the entitypath that you want to connect to.
  3. Verify that the consumer group is created and entered correctly in the Consumer Group field.