Skip to content

Commit 6e27ddd

Browse files
committed
[ARM] update the event hub quickstart
1 parent 0656c94 commit 6e27ddd

File tree

1 file changed

+35
-134
lines changed

1 file changed

+35
-134
lines changed

articles/event-hubs/event-hubs-resource-manager-namespace-event-hub.md

Lines changed: 35 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -13,171 +13,72 @@ ms.devlang: tbd
1313
ms.topic: article
1414
ms.tgt_pltfrm: dotnet
1515
ms.workload: na
16-
ms.date: 10/16/2018
16+
ms.date: 06/13/2019
1717
ms.author: shvija
1818

1919
---
2020

21-
# Quickstart: Create an event hub using Azure Resource Manager template
21+
# Quickstart: Create an event hub by using an Azure Resource Manager template
22+
2223
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).
2324

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.
28-
29-
## Prerequisites
30-
31-
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
32-
33-
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).
41-
42-
```json
43-
{
44-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
45-
"contentVersion": "1.0.0.0",
46-
"parameters": {
47-
"eventhub-namespace-name": {
48-
"type": "String"
49-
},
50-
"eventhub_name": {
51-
"type": "String"
52-
}
53-
},
54-
"resources": [
55-
{
56-
"type": "Microsoft.EventHub/namespaces",
57-
"sku": {
58-
"name": "Standard",
59-
"tier": "Standard",
60-
"capacity": 1
61-
},
62-
"name": "[parameters('eventhub-namespace-name')]",
63-
"apiVersion": "2017-04-01",
64-
"location": "East US",
65-
"tags": {},
66-
"scale": null,
67-
"properties": {
68-
"isAutoInflateEnabled": false,
69-
"maximumThroughputUnits": 0
70-
},
71-
"dependsOn": []
72-
},
73-
{
74-
"type": "Microsoft.EventHub/namespaces/eventhubs",
75-
"name": "[concat(parameters('eventhub-namespace-name'), '/', parameters('eventhub_name'))]",
76-
"apiVersion": "2017-04-01",
77-
"location": "East US",
78-
"scale": null,
79-
"properties": {
80-
"messageRetentionInDays": 7,
81-
"partitionCount": 1,
82-
"status": "Active"
83-
},
84-
"dependsOn": [
85-
"[resourceId('Microsoft.EventHub/namespaces', parameters('eventhub-namespace-name'))]"
86-
]
87-
}
88-
]
89-
}
90-
```
25+
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).
9126

92-
## Create the parameters JSON
93-
Create a JSON file named MyEventHub-Parameters.json that contains parameters for the Azure Resource Manager template.
94-
95-
```json
96-
{
97-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
98-
"contentVersion": "1.0.0.0",
99-
"parameters": {
100-
"eventhub-namespace-name": {
101-
"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.
10928

29+
## Create an event hub
11030

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).
11132

112-
## Use Azure PowerShell to deploy the template
33+
To deploy the template:
11334

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.
11636

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)"
40+
$resourceGroupName = "${projectName}rg"
41+
$templateUri = "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/101-eventhubs-create-namespace-and-eventhub/azuredeploy.json"
11842
119-
```azurepowershell
120-
Login-AzAccount
121-
```
122-
3. If you have Issue the following commands to set the current subscription context:
43+
New-AzResourceGroup -Name $resourceGroupName -Location $location
44+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateFileName -projectName $projectName
12345
124-
```azurepowershell
125-
Select-AzSubscription -SubscriptionName "<YourSubscriptionName>"
46+
Write-Host "Press [ENTER] to continue ..."
12647
```
12748

128-
### Provision resources
129-
To deploy/provision the resources using Azure PowerShell, switch to the C:\EventHubsQuickStart\ARM\ folder, run the following commands:
130-
131-
> [!IMPORTANT]
132-
> Specify a name for the Azure resource group as a value for $resourceGroupName before running the commands.
49+
1. Select **Copy** to copy the PowerShell code.
50+
1. Right-click the shell console, and then select **Paste**.
13351

134-
```azurepowershell
135-
$resourceGroupName = "<Specify a name for the Azure resource group>"
52+
## Verify the deployment
13653

137-
# Create an Azure resource group
138-
New-AzResourceGroup $resourceGroupName -location 'East US'
54+
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.
13955

140-
# Deploy the Resource Manager template. Specify the names of deployment itself, resource group, JSON file for the template, JSON file for parameters
141-
New-AzResourceGroupDeployment -Name MyARMDeployment -ResourceGroupName $resourceGroupName -TemplateFile MyEventHub.json -TemplateParameterFile MyEventHub-Parameters.json
142-
```
56+
```azurepowershell-interactive
57+
$projectName = Read-Host -Prompt "Enter the same project name that you used in the last procedure"
58+
$resourceGroupName = "${projectName}rg"
59+
$namespaceName = "${projectName}ns"
14360
144-
## Use Azure CLI to deploy the template
61+
Get-AzEventHub -ResourceGroupName $resourceGroupName -Namespace $namespaceName
14562
146-
## Sign in to Azure
147-
148-
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 ..."
15464
```
15565

156-
Set the current subscription context. Replace `MyAzureSub` with the name of the Azure subscription you want to use:
66+
## Clean up resources
15767

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.
16169

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"
16473
165-
> [!IMPORTANT]
166-
> Specify a name for the Azure resource group in the az group create command. .
74+
Remove-AzResourceGroup -ResourceGroupName $resourceGroupName
16775
168-
```azurecli
169-
# Create an Azure resource group
170-
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 ..."
17477
```
17578

176-
Congratulations! You have used the Azure Resource Manager template to create an Event Hubs namespace, and an event hub within that namespace.
177-
17879
## Next steps
17980

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:
18182

18283
- [.NET Core](event-hubs-dotnet-standard-getstarted-send.md)
18384
- [.NET Framework](event-hubs-dotnet-framework-getstarted-send.md)

0 commit comments

Comments
 (0)