|
1 | 1 | ---
|
2 |
| -title: Create an event hub using Azure CLI - Azure Event Hubs | Microsoft Docs |
| 2 | +title: Quickstart - Create an event hub using Azure CLI |
3 | 3 | description: This quickstart describes how to create an event hub using Azure CLI and then send and receive events using Java.
|
4 | 4 | ms.topic: quickstart
|
5 |
| -ms.date: 06/18/2021 |
| 5 | +ms.date: 03/13/2023 |
6 | 6 | ms.author: spelluru
|
7 | 7 | ms.custom: devx-track-azurecli, mode-api
|
8 | 8 | ---
|
9 | 9 |
|
10 | 10 | # Quickstart: Create an event hub using Azure CLI
|
| 11 | +In this quickstart, you will create an event hub using Azure CLI. |
11 | 12 |
|
12 |
| -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](event-hubs-about.md) and [Event Hubs features](event-hubs-features.md). |
13 |
| - |
14 |
| -In this quickstart, you create an event hub using Azure CLI. |
15 | 13 |
|
16 | 14 | [!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
|
17 | 15 |
|
18 | 16 | [!INCLUDE [azure-cli-prepare-your-environment.md](~/articles/reusable-content/azure-cli/azure-cli-prepare-your-environment.md)]
|
19 | 17 |
|
20 | 18 | - This article requires version 2.0.4 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
|
21 | 19 |
|
22 |
| -## Set the subscription context |
23 |
| - |
24 |
| -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: |
25 |
| - |
26 |
| -Set the current subscription context. Replace `MyAzureSub` with the name of the Azure subscription you want to use: |
27 |
| - |
28 |
| -```azurecli-interactive |
29 |
| -az account set --subscription MyAzureSub |
30 |
| -``` |
31 |
| - |
32 | 20 | ## Create a resource group
|
33 |
| -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: |
| 21 | +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. Select **Copy** to copy the command and paste it into the Cloud Shell, and run it. |
34 | 22 |
|
35 | 23 | ```azurecli-interactive
|
36 |
| -# Create a resource group. Specify a name for the resource group. |
37 |
| -az group create --name <resource group name> --location eastus |
| 24 | +rgName="contosorg$RANDOM" |
| 25 | +region="eastus" |
| 26 | +az group create --name $rgName --location $region |
38 | 27 | ```
|
39 | 28 |
|
40 | 29 | ## Create an Event Hubs namespace
|
41 | 30 | 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:
|
42 | 31 |
|
43 | 32 | ```azurecli-interactive
|
44 | 33 | # Create an Event Hubs namespace. Specify a name for the Event Hubs namespace.
|
45 |
| -az eventhubs namespace create --name <Event Hubs namespace> --resource-group <resource group name> -l <region, for example: East US> |
| 34 | +namespaceName="contosoehubns$RANDOM" |
| 35 | +az eventhubs namespace create --name $namespaceName --resource-group $rgName -l $region |
46 | 36 | ```
|
47 | 37 |
|
48 | 38 | ## Create an event hub
|
49 | 39 | Run the following command to create an event hub:
|
50 | 40 |
|
51 | 41 | ```azurecli-interactive
|
52 | 42 | # Create an event hub. Specify a name for the event hub.
|
53 |
| -az eventhubs eventhub create --name <event hub name> --resource-group <resource group name> --namespace-name <Event Hubs namespace> |
| 43 | +eventhubName="contosoehub$RANDOM" |
| 44 | +az eventhubs eventhub create --name $eventhubName --resource-group $rgName --namespace-name $namespaceName |
54 | 45 | ```
|
55 | 46 |
|
56 | 47 | Congratulations! You have used Azure CLI to create an Event Hubs namespace, and an event hub within that namespace.
|
57 | 48 |
|
58 |
| -## Next steps |
| 49 | +## Clean up resources |
| 50 | +If you want to keep this event hub so that you can test sending and receiving events, ignore this section. Otherwise, run the following command to delete the resource group. This command deletes all the resources in the resource group and the resource group itself. |
59 | 51 |
|
60 |
| -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: |
| 52 | +```azurecli-interactive |
| 53 | +az group delete --name $rgName |
| 54 | +``` |
| 55 | + |
| 56 | +## Next steps |
61 | 57 |
|
62 |
| -- [.NET Core](event-hubs-dotnet-standard-getstarted-send.md) |
63 |
| -- [Java](event-hubs-java-get-started-send.md) |
64 |
| -- [Python](event-hubs-python-get-started-send.md) |
65 |
| -- [JavaScript](event-hubs-node-get-started-send.md) |
66 |
| -- [Go](event-hubs-go-get-started-send.md) |
67 |
| -- [C (send only)](event-hubs-c-getstarted-send.md) |
68 |
| -- [Apache Storm (receive only)](event-hubs-storm-getstarted-receive.md) |
| 58 | +> [!div class="nextstepaction"] |
| 59 | +> 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: [.NET Core](event-hubs-dotnet-standard-getstarted-send.md), [Java](event-hubs-java-get-started-send.md), [Python](event-hubs-python-get-started-send.md), [JavaScript](event-hubs-node-get-started-send.md), [Go](event-hubs-go-get-started-send.md), [C (send only)](event-hubs-c-getstarted-send.md), [Apache Storm (receive only)](event-hubs-storm-getstarted-receive.md) |
69 | 60 |
|
70 |
| -[create a free account]: https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio |
71 |
| -[Install the Azure CLI]: /cli/azure/install-azure-cli |
72 |
| -[az group create]: /cli/azure/group#az_group_create |
73 |
| -[fully qualified domain name]: https://wikipedia.org/wiki/Fully_qualified_domain_name |
0 commit comments