|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create an event hub with consumer group using Bicep - Azure Event Hubs' |
| 3 | +description: 'Quickstart: Create an Event Hubs namespace with an event hub and a consumer group using Bicep' |
| 4 | +author: schaffererin |
| 5 | +ms.topic: quickstart |
| 6 | +ms.author: v-eschaffer |
| 7 | +ms.custom: subject-armqs, devx-track-azurepowershell, mode-arm |
| 8 | +ms.date: 03/22/2022 |
| 9 | +--- |
| 10 | + |
| 11 | +# Quickstart: Create an event hub by using Bicep |
| 12 | + |
| 13 | +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). In this quickstart, you create an event hub by using [Bicep](../azure-resource-manager/bicep/overview.md). You deploy a Bicep file to create a namespace of type [Event Hubs](./event-hubs-about.md), with one event hub. |
| 14 | + |
| 15 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin. |
| 20 | + |
| 21 | +## Review the Bicep file |
| 22 | + |
| 23 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/eventhubs-create-namespace-and-eventhub/). |
| 24 | + |
| 25 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.eventhub/eventhubs-create-namespace-and-eventhub/main.bicep"::: |
| 26 | + |
| 27 | +The resources defined in the Bicep file include: |
| 28 | + |
| 29 | +- [**Microsoft.EventHub/namespaces**](/azure/templates/microsoft.eventhub/namespaces) |
| 30 | +- [**Microsoft.EventHub/namespaces/eventhubs**](/azure/templates/microsoft.eventhub/namespaces/eventhubs) |
| 31 | + |
| 32 | +## Deploy the Bicep file |
| 33 | + |
| 34 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 35 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 36 | + |
| 37 | + # [CLI](#tab/CLI) |
| 38 | + |
| 39 | + ```azurecli |
| 40 | + az group create --name exampleRG --location eastus |
| 41 | + az deployment group create --resource-group exampleRG --template-file main.bicep --parameters projectName=<project-name> |
| 42 | + ``` |
| 43 | +
|
| 44 | + # [PowerShell](#tab/PowerShell) |
| 45 | +
|
| 46 | + ```azurepowershell |
| 47 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 48 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -projectName "<project-name>" |
| 49 | + ``` |
| 50 | +
|
| 51 | + --- |
| 52 | +
|
| 53 | + > [!NOTE] |
| 54 | + > Replace **\<project-name\>** with a project name. It will be used to generate the Event Hubs name and the Namespace name. |
| 55 | +
|
| 56 | + When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 57 | +
|
| 58 | +## Validate the deployment |
| 59 | +
|
| 60 | +Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group. |
| 61 | +
|
| 62 | +# [CLI](#tab/CLI) |
| 63 | +
|
| 64 | +```azurecli-interactive |
| 65 | +az resource list --resource-group exampleRG |
| 66 | +``` |
| 67 | + |
| 68 | +# [PowerShell](#tab/PowerShell) |
| 69 | + |
| 70 | +```azurepowershell-interactive |
| 71 | +Get-AzResource -ResourceGroupName exampleRG |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Clean up resources |
| 77 | + |
| 78 | +When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the VM and all of the resources in the resource group. |
| 79 | + |
| 80 | +# [CLI](#tab/CLI) |
| 81 | + |
| 82 | +```azurecli-interactive |
| 83 | +az group delete --name exampleRG |
| 84 | +``` |
| 85 | + |
| 86 | +# [PowerShell](#tab/PowerShell) |
| 87 | + |
| 88 | +```azurepowershell-interactive |
| 89 | +Remove-AzResourceGroup -Name exampleRG |
| 90 | +``` |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Next steps |
| 95 | + |
| 96 | +In this article, you created an Event Hubs namespace and an event hub in the namespace using Bicep. For step-by-step instructions to send events to (or) receive events from an event hub, see the **Send and receive events** tutorials: |
| 97 | + |
| 98 | +- [.NET Core](event-hubs-dotnet-standard-getstarted-send.md) |
| 99 | +- [Java](event-hubs-java-get-started-send.md) |
| 100 | +- [Python](event-hubs-python-get-started-send.md) |
| 101 | +- [JavaScript](event-hubs-node-get-started-send.md) |
| 102 | +- [Go](event-hubs-go-get-started-send.md) |
| 103 | +- [C (send only)](event-hubs-c-getstarted-send.md) |
| 104 | +- [Apache Storm (receive only)](event-hubs-storm-getstarted-receive.md) |
| 105 | + |
| 106 | +[3]: ./media/event-hubs-quickstart-powershell/sender1.png |
| 107 | +[4]: ./media/event-hubs-quickstart-powershell/receiver1.png |
| 108 | +[5]: ./media/event-hubs-quickstart-powershell/metrics.png |
| 109 | + |
| 110 | +[Understand the structure and syntax of Bicep files]: ../azure-resource-manager/bicep/file.md |
| 111 | +[Deploy resources with Bicep and Azure PowerShell]: ../azure-resource-manager/bicep/deploy-powershell.md |
| 112 | +[Deploy resource with Bicep and Azure CLI]: ../azure-resource-manager/bicep/deploy-cli.md |
0 commit comments