Search code examples
pythonazure-eventhubqpid

unauthorized error when creating queue in event hubs


need to create queue in eventhub for receive messages sent to it using python, but got this error when using the code below.

note : policy is set to send, listen.

thanks

from azure.servicebus import ServiceBusService

sbs = ServiceBusService("xxhubspacexx",
                        shared_access_key_name="xxpolicyxx",
                        shared_access_key_value="xxkeyvalxx")

sbs.create_queue("taskqueue") #AzureHttpError: Unauthorized

Solution

    1. You call it Event Hubs but it's actually a Service Bus Queue. They are distinct services. Event Hubs have no queues.
    2. The error message is quite clear I think: the shared access policy that you are using has permissions for Send and Listen, but no Manage permission which is required to create Service Bus queues.