Skip to content

Instantly share code, notes, and snippets.

@jtaubensee
Created May 27, 2016 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtaubensee/343d3e9b93788ddb41b444033e878684 to your computer and use it in GitHub Desktop.
Save jtaubensee/343d3e9b93788ddb41b444033e878684 to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serviceBusNamespaceName": {
"type": "string",
"metadata": {
"description": "Name of the EventHub namespace"
}
},
"serviceBusEventHubName": {
"type": "string",
"metadata": {
"description": "Name of the Event Hub"
}
},
"serviceBusConsumerGroupName": {
"type": "string",
"metadata": {
"description": "Name of the Consumer Group"
}
},
"serviceBusApiVersion": {
"type": "string",
"defaultValue": "2015-08-01",
"metadata": {
"description": "Service Bus ApiVersion used by the template"
}
},
"eventHubAuthRule": {
"type": "string",
"metadata": {
"description": "Name of the SAS Rule"
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"ehVersion": "[parameters('serviceBusApiVersion')]",
"defaultSASKeyName": "RootManageSharedAccessKey",
"authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', parameters('serviceBusNamespaceName'), variables('defaultSASKeyName'))]"
},
"resources": [
{
"apiVersion": "[variables('ehVersion')]",
"name": "[parameters('serviceBusNamespaceName')]",
"type": "Microsoft.ServiceBus/Namespaces",
"location": "[variables('location')]",
"kind": "EventHub",
"sku": {
"name": "StandardSku",
"tier": "Standard"
},
"resources": [
{
"apiVersion": "[variables('ehVersion')]",
"name": "[parameters('serviceBusEventHubName')]",
"type": "EventHubs",
"dependsOn": [
"[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
],
"properties": {
"path": "[parameters('serviceBusEventHubName')]"
},
"resources": [
{
"apiVersion": "[variables('ehVersion')]",
"name": "[parameters('serviceBusConsumerGroupName')]",
"type": "ConsumerGroups",
"dependsOn": [
"[parameters('serviceBusEventHubName')]"
],
"properties": {}
},
{
"apiVersion": "[variables('ehVersion')]",
"name": "[parameters('eventHubAuthRule')]",
"type": "authorizationRules",
"dependsOn": [
"[parameters('serviceBusEventHubName')]"
],
"properties": {
"Rights": ["Send"]
}
}
]
}
]
}
],
"outputs": {
"NamespaceConnectionString": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('ehVersion')).primaryConnectionString]"
},
"SharedAccessPolicyPrimaryKey": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('ehVersion')).primaryKey]"
}
}
}
@jtaubensee
Copy link
Author

This is the authRule part:

                    {
                        "apiVersion": "[variables('ehVersion')]",
                        "name": "[parameters('eventHubAuthRule')]",
                        "type": "authorizationRules",
                        "dependsOn": [
                            "[parameters('serviceBusEventHubName')]"
                        ],
                        "properties": {
                            "Rights": ["Send"]
                        }
                    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment