Skip to content

Instantly share code, notes, and snippets.

@ericmaino
Last active June 7, 2017 19:38
Show Gist options
  • Save ericmaino/c486c8eab0938006c6c7542eab426448 to your computer and use it in GitHub Desktop.
Save ericmaino/c486c8eab0938006c6c7542eab426448 to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"eventHubName": {
"type": "string"
}
},
"variables": {
"resourceLocation": "[resourceGroup().location]",
"eventHubName": "[parameters('eventHubName')]",
"eventHubs": [
"docHub",
"activityHub",
"sqlHub"
],
"consumerGroups": [
"docHub/hashing-consumer",
"activityHub/dlt-consumer",
"activityHub/dlt-api-consumer",
"sqlHub/sql-consumer"
],
"eventHubKeys" : [
{
"name" : "Read",
"rights" : ["Listen"]
},
{
"name" : "Write",
"rights" : ["Send"]
},
{
"name" : "ReadWrite",
"rights" : ["Listen", "Send"]
}
]
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces",
"sku": {
"name": "Standard",
"tier": "Standard"
},
"kind": "EventHub",
"name": "[variables('eventHubName')]",
"apiVersion": "2017-04-01",
"location": "[variables('resourceLocation')]",
"tags": {},
"dependsOn": []
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs",
"name": "[concat(variables('eventHubName'), '/', variables('eventHubs')[copyIndex()])]",
"apiVersion": "2017-04-01",
"copy": {
"name": "eventHubLoop",
"count": "[length(variables('eventHubs'))]"
},
"location": "[variables('resourceLocation')]",
"properties": {
"messageRetentionInDays": 1,
"partitionCount": 2,
"partitionIds": [
"0",
"1"
]
},
"dependsOn": [
"[variables('eventHubName')]"
]
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
"name": "[concat(variables('eventHubName'), '/', variables('consumerGroups')[copyIndex()])]",
"apiVersion": "2017-04-01",
"copy": {
"name": "consumerGroups",
"count": "[length(variables('consumerGroups'))]"
},
"location": "[variables('resourceLocation')]",
"dependsOn": [
"[variables('eventHubName')]",
"eventHubLoop"
]
},
{
"apiVersion": "2017-04-01",
"name": "[concat(variables('eventHubName'), '/', variables('eventHubKeys')[copyIndex()].name)]",
"type": "Microsoft.EventHub/namespaces/authorizationRules",
"copy": {
"name": "eventHubKeyLoop",
"count": "[length(variables('eventHubs'))]"
},
"location": "[resourceGroup().location]",
"properties": {
"Rights": "[variables('eventHubKeys')[copyIndex()].rights]"
},
"dependsOn": [
"[variables('eventHubName')]"
]
}
],
"outputs": {
"Result": {
"type": "object",
"value": {
"name" : "[variables('eventHubName')]",
"endPoint" : "[reference(variables('eventHubName')).serviceBusEndpoint]",
"readKey" : "[listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubName'), variables('eventHubKeys')[0].name), '2015-08-01').primaryKey]",
"writeKey" : "[listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubName'), variables('eventHubKeys')[1].name), '2015-08-01').primaryKey]",
"readWriteKey" : "[listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubName'), variables('eventHubKeys')[2].name), '2015-08-01').primaryKey]"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment