Create new event hub
Here are the steps to create a new Event Hub in Azure:
Prerequisites:
- You have an Azure subscription.
- You have the Azure CLI or Azure Portal installed on your machine.
Using Azure CLI:
-
Open a terminal or command prompt and log in to your Azure account using the Azure CLI:
az login
-
Create a new resource group:
az group create --name <resource-group-name> --location <location>
Replace
<resource-group-name>
with a name for your resource group, and<location>
with the location where you want to create the resource group (e.g. "West US"). -
Create a new Event Hub:
az eventhubs namespace create --name <event-hub-namespace> --resource-group <resource-group-name> --location <location>
Replace
<event-hub-namespace>
with a name for your Event Hub namespace, and<resource-group-name>
and<location>
with the values you created in steps 1 and 2. -
Create a new Event Hub:
az eventhubs eventhub create --name <event-hub-name> --namespace-name <event-hub-namespace> --resource-group <resource-group-name> --partition-count 2
Replace
<event-hub-name>
with a name for your Event Hub,<event-hub-namespace>
with the name you created in step 3, and<resource-group-name>
with the name you created in step 2. The--partition-count
parameter specifies the number of partitions for the Event Hub.
Using Azure Portal:
- Log in to the Azure Portal: https://portal.azure.com/
- Click on "Create a resource" and search for "Event Hub".
- Click on "Event Hub" and then click on "Create".
- Fill in the required information:
- Name: Enter a name for your Event Hub.
- Resource group: Select the resource group you created earlier.
- Location: Select the location where you want to create the Event Hub.
- Namespace: Enter a name for your Event Hub namespace.
- Partition count: Enter the number of partitions you want for the Event Hub (e.g. 2).
- Click on "Create" to create the Event Hub.
Verify the Event Hub:
Once you've created the Event Hub, you can verify that it's been created successfully by checking the Azure Portal or using the Azure CLI:
az eventhubs eventhub show --name <event-hub-name> --namespace-name <event-hub-namespace> --resource-group <resource-group-name>
This command will display information about the Event Hub, including its name, namespace, and partition count.