Quickstart: Create an event hub using Azure CLI
Azure Event Hubs is a Big Data streaming platform and event ingestion service, capable of receiving and processing millions of events per second. Event Hubs can process and store events, data, or telemetry produced by distributed software and devices. Data sent to an event hub can be transformed and stored using any real-time analytics provider or batching/storage adapters. For detailed overview of Event Hubs, see Event Hubs overview and Event Hubs features.
In this quickstart, you create an event hub using Azure CLI.
To complete this quickstart, you need an Azure subscription. If you don't have one, create a free account before you begin.
Open Azure Cloud Shell
Azure Cloud Shell is a free, interactive shell that you can use to run the steps in this article. Common Azure tools are preinstalled and configured in Cloud Shell for you to use with your account. Select Copy to copy the code, paste it in Cloud Shell, and then press Enter to run it. There are a few ways to open Cloud Shell:
|Select Try It in the upper-right corner of a code block.|
|Open Cloud Shell in your browser.|
|Select the Cloud Shell button on the menu in the upper-right corner of the Azure portal.|
If you choose to install and use Azure CLI locally, this tutorial requires that you are running Azure CLI version 2.0.4 or later. Run
az --version to check your version. If you need to install or upgrade, see Install the Azure CLI.
Sign in to Azure
The following steps are not required if you're running commands in Cloud Shell. If you're running the CLI locally, perform the following steps to sign in to Azure and set your current subscription:
Run the following command to sign in to Azure:
Set the current subscription context. Replace
MyAzureSub with the name of the Azure subscription you want to use:
az account set --subscription MyAzureSub
Create a resource group
A resource group is a logical collection of Azure resources. All resources are deployed and managed in a resource group. Run the following command to create a resource group:
# Create a resource group. Specify a name for the resource group. az group create --name <resource group name> --location eastus
Create an Event Hubs namespace
An Event Hubs namespace provides a unique scoping container, referenced by its fully qualified domain name, in which you create one or more event hubs. To create a namespace in your resource group, run the following command:
# Create an Event Hubs namespace. Specify a name for the Event Hubs namespace. az eventhubs namespace create --name <Event Hubs namespace> --resource-group <resource group name> -l <region, for example: East US>
Create an event hub
Run the following command to create an event hub:
# Create an event hub. Specify a name for the event hub. az eventhubs eventhub create --name <event hub name> --resource-group <resource group name> --namespace-name <Event Hubs namespace>
Congratulations! You have used Azure CLI to create an Event Hubs namespace, and an event hub within that namespace.
In this article, you created a resource group, an Event Hubs namespace, and an event hub. For step-by-step instructions to send events to (or) receive events from an event hub, see the Send and receive events tutorials:
Send feedback about: