-
Notifications
You must be signed in to change notification settings - Fork 581
/
Copy pathQuickstart_PSsample1.ps1
26 lines (18 loc) · 1.33 KB
/
Quickstart_PSsample1.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Step 1 – Login to your Azure subscription
Login-AzureRmAccount
# Optional – you need this if you do not have Event Hubs module already installed
Install-Module AzureRM.EventHub -Force
# Step 2 – Create the following resources
# Create a resource group, the following example uses "eventhubsResourceGroup" in East US region
New-AzureRmResourceGroup -Name eventhubsResourceGroup -Location eastus
# Create an Event Hubs namespace
New-AzureRmEventHubNamespace -ResourceGroupName eventhubsResourceGroup -NamespaceName <namespace_name> -Location eastus
# Get the connection string required to connect the clients to your event hub
$ehconnectionstring = Get-AzureRmEventHubKey -ResourceGroupName eventhubsResourceGroup -NamespaceName <namespace_name> -EventHubName <eventhub_name> -Name RootManageSharedAccessKey
Write-Host "event hubs connection string = " $ehconnectionstring
# Create storage account for Event Processor Host
# create a standard general-purpose storage account
New-AzureRmStorageAccount -ResourceGroupName eventhubsResourceGroup -Name <storage_account_name> -Location eastus -SkuName Standard_LRS
# retrieve the first storage account key for EPH client to connect
$storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroup -Name $storageAccountName).Value[0]
Write-Host "storage account key 1 = " $storageAccountKey