You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Quickstart: Create an event hub using Azure Resource Manager template
21
+
# Quickstart: Create an event hub by using an Azure Resource Manager template
22
+
22
23
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).
23
24
24
-
In this quickstart, you create an event hub using an Azure Resource Manager template. You use an Azure Resource Manager template to create a namespace of type [Event Hubs](event-hubs-what-is-event-hubs.md), with one event hub and one consumer group. The article shows how to define which resources are deployed and how to define parameters that are specified when the deployment is executed. You can use this template for your own deployments, or customize it to meet your requirements. For information about creating templates, see [Authoring Azure Resource Manager templates][Authoring Azure Resource Manager templates]. For the JSON syntax and properties to use in a template, see [Microsoft.EventHub resource types](/azure/templates/microsoft.eventhub/allversions).
25
-
26
-
> [!NOTE]
27
-
> For the complete template, see the [Event hub and consumer group template][Event Hub and consumer group template] on GitHub. This template created a consumer group in addition to an event hub namespace and an event hub. To check for the latest templates, visit the [Azure Quickstart Templates][Azure Quickstart Templates] gallery and search for Event Hubs.
To complete this quickstart, you need an Azure subscription. If you don't have one, [create a free account](https://azure.microsoft.com/free/) before you begin.
34
-
35
-
If you want to use **Azure PowerShell** to deploy the Resource Manager template, [Install Azure PowerShell](https://docs.microsoft.com/powershell/azure/install-az-ps).
36
-
37
-
If you want to use **Azure CLI** to deploy the Resource Manager template, [Install Azure CLI](/cli/azure/install-azure-cli).
38
-
39
-
## Create the Resource Manager template JSON
40
-
Create a JSON file named MyEventHub.json with the following content, and save it to a folder (for example: C:\EventHubsQuickstarts\ResourceManagerTemplate).
In this quickstart, you create an event hub by using an [Azure Resource Manager template](../azure-resource-manager/resource-group-overview.md). You deploy an Azure Resource Manager template to create a namespace of type [Event Hubs](event-hubs-what-is-event-hubs.md), with one event hub. The article shows how to define which resources are deployed and how to define parameters that are specified when the deployment is executed. You can use this template for your own deployments, or customize it to meet your requirements. For information about creating templates, see [Authoring Azure Resource Manager templates][Authoring Azure Resource Manager templates]. For the JSON syntax and properties to use in a template, see [Microsoft.EventHub resource types](/azure/templates/microsoft.eventhub/allversions).
91
26
92
-
## Create the parameters JSON
93
-
Create a JSON file named MyEventHub-Parameters.json that contains parameters for the Azure Resource Manager template.
"value": "<specify a name for the event hub namespace>"
102
-
},
103
-
"eventhub_name": {
104
-
"value": "<Specify a name for the event hub in the namespace>"
105
-
}
106
-
}
107
-
}
108
-
```
27
+
If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
109
28
29
+
## Create an event hub
110
30
31
+
In this quickstart, you use an [existing Resource Manager template](https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/101-eventhubs-create-namespace-and-eventhub/azuredeploy.json). To find more template samples, see [Azure QuickStart Templates](https://azure.microsoft.com/resources/templates/?term=eventhub&pageNumber=1&sort=Popular).
111
32
112
-
## Use Azure PowerShell to deploy the template
33
+
To deploy the template:
113
34
114
-
### Sign in to Azure
115
-
1. Launch Azure PowerShell
35
+
1. Select **Try it** from the following code block, and the follow the instructions to sign on to the Azure Cloud shell.
116
36
117
-
2. Run the following command to sign in to Azure:
37
+
```azurepowershell-interactive
38
+
$projectName = Read-Host -Prompt "Enter a project name that is used for generating resource names"
39
+
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
To verify the deployment, you can either open the resource group from the [Azure portal](https://portal.azure.com), or use the following Azure PowerShell script.
139
55
140
-
# Deploy the Resource Manager template. Specify the names of deployment itself, resource group, JSON file for the template, JSON file for parameters
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:
149
-
150
-
Run the following command to sign in to Azure:
151
-
152
-
```azurecli
153
-
az login
63
+
Write-Host "Press [ENTER] to continue ..."
154
64
```
155
65
156
-
Set the current subscription context. Replace `MyAzureSub` with the name of the Azure subscription you want to use:
66
+
## Clean up resources
157
67
158
-
```azurecli
159
-
az account set --subscription <Name of your Azure subscription>
160
-
```
68
+
When the Azure resources are no longer needed, clean up the resources you deployed by deleting the resource group.
161
69
162
-
### Provision resources
163
-
To deploy the resources using Azure CLI, switch to the C:\EventHubsQuickStart\ARM\ folder, and run the following commands:
70
+
```azurepowershell-interactive
71
+
$projectName = Read-Host -Prompt "Enter the same project name that you used in the last procedure"
72
+
$resourceGroupName = "${projectName}rg"
164
73
165
-
> [!IMPORTANT]
166
-
> Specify a name for the Azure resource group in the az group create command. .
az group create --name <YourResourceGroupName> --location eastus
171
-
172
-
# # Deploy the Resource Manager template. Specify the names of resource group, deployment, JSON file for the template, JSON file for parameters
173
-
az group deployment create --name <Specify a name for the deployment> --resource-group <YourResourceGroupName> --template-file MyEventHub.json --parameters @MyEventHub-Parameters.json
76
+
Write-Host "Press [ENTER] to continue ..."
174
77
```
175
78
176
-
Congratulations! You have used the Azure Resource Manager template to create an Event Hubs namespace, and an event hub within that namespace.
177
-
178
79
## Next steps
179
80
180
-
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:
81
+
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:
0 commit comments