Quickstart: Create an event hub using Azure PowerShell
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 PowerShell.
This article has been updated to use the new Azure PowerShell Az module. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For installation instructions, see Install Azure PowerShell.
To complete this tutorial, make sure you have:
- Azure subscription. If you don't have one, create a free account before you begin.
- Visual Studio 2017 Update 3 (version 15.3, 26730.01) or later.
- .NET Standard SDK, version 2.0 or later.
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're using PowerShell locally, you must run the latest version of PowerShell to complete this quickstart. If you need to install or upgrade, see Install and Configure Azure PowerShell.
Create a resource group
A resource group is a logical collection of Azure resources, and you need a resource group to create an event hub.
The following example creates a resource group in the East US region. Replace
myResourceGroup with the name of the resource group you want to use:
New-AzResourceGroup –Name myResourceGroup –Location eastus
Create an Event Hubs namespace
Once your resource group is made, create an Event Hubs namespace within that resource group. An Event Hubs namespace provides a unique fully-qualified domain name in which you can create your event hub. Replace
namespace_name with a unique name for your namespace:
New-AzEventHubNamespace -ResourceGroupName myResourceGroup -NamespaceName namespace_name -Location eastus
Create an event hub
Now that you have an Event Hubs namespace, create an event hub within that namespace:
Allowed period for
MessageRetentionInDays is between 1 and 7 days.
New-AzEventHub -ResourceGroupName myResourceGroup -NamespaceName namespace_name -EventHubName eventhub_name -MessageRetentionInDays 3
Congratulations! You have used Azure PowerShell to create an Event Hubs namespace, and an event hub within that namespace.
In this article, you created the Event Hubs namespace, and used sample applications to send and receive events from your 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: