unrecognized arguments: --eventhub-name

Klinemeier, Kevin (624) 0 Reputation points
2024-12-10T02:25:12.8266667+00:00

https://zcusa.951200.xyz/en-us/azure/event-hubs/event-hubs-get-connection-string#azure-cli

has --namespace-name xxx in the instructions, but when I try it on my desktop or in cloud shell, I get this error:

unrecognized arguments: --eventhub-name xxx

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
663 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 33,951 Reputation points MVP
    2024-12-10T15:36:16.8233333+00:00

    Hello @Klinemeier, Kevin (624),

    welcome to this moderated Azure community forum.

    An eventhub lives inside an eventhub namespace.

    Here is a possible CLI example flow after you have logged in:

    az login
    

    First we need a resource group:

    az group create --name acsResourceGroup --location westeurope
    

    Notice that when you're prompted about a CLI extension for an extension, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.

    Try creating a standard size Event Hub Namespace, living inside a resourcegroup:

    az eventhubs namespace create --name acs-eventprocessor-service-ehns --resource-group acsResourceGroup -l westeurope --sku Standard
    
    

    This Event Hub namespace is empty so let’s add an Event Hub:

    az eventhubs eventhub create --name messages --resource-group acsResourceGroup --namespace-name acs-eventprocessor-service-ehns --partition-count 4
    

    It is wise to use specific consumer groups for consumers so add a consumer group named ‘aci’:

    az eventhubs eventhub consumer-group create --consumer-group-name aci --eventhub-name messages --namespace-name acs-eventprocessor-service-ehns --resource-group acsResourceGroup
    

    To get the connection strings, you can list them:

    az eventhubs namespace authorization-rule keys list --resource-group acsResourceGroup --namespace-name acs-eventprocessor-service-ehns --name RootManageSharedAccessKey
    

    To get only the primary key, try:

    PRIMARYCONNSTRING=$(az eventhubs namespace authorization-rule keys list --resource-group acsResourceGroup --namespace-name acs-eventprocessor-service-ehns --name RootManageShared
    AccessKey --query primaryConnectionString --output tsv)
    
    echo $PRIMARYCONNSTRING
    

    This should give you a head start.

    Please check this documentation too for more examples.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.