I have a custom ARM template which deploys an EventHub Namespace with a child EventHub, which in turn has two AuthorizationRules and one ConsumerGroup as children. The validation passes but I get a deployment error. It seems the Azure Resource Manager starts by trying to deploy the Authorization Rules before the namespace even exist, even though I added the required "dependsOn" properties, but then the deployment goes on from start to finish and successfully deploys every resource. It could be tolerable if I only deployed it from the portal, but when I deploy this template programmatically, I get an error even though the deployment was "successful" and my rollback mechanism triggers.
Here are links to the errors given by the portal :
Here is my ARM Template (comments are there only to help you find resources):
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"namespaceName": {
"type": "string"
},
"eventHubName": {
"type": "string"
}
},
"variables": {
"SharedAccessKeyName": "Event-Dispatcher-Send-Access-Key",
"ReadOnlySharedAccessKeyName": "Plugin-Listen-Access-Key",
"ConsumerGroup": "plugin"
},
"resources": [
{
// Event Hub Namespace
"type": "Microsoft.EventHub/namespaces",
"apiVersion": "2018-01-01-preview",
"name": "[parameters('namespaceName')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard",
"tier": "Standard",
"capacity": 1
},
"properties": {
"zoneRedundant": false,
"isAutoInflateEnabled": false,
"maximumThroughputUnits": 0,
"kafkaEnabled": true
},
"resources": [
{
// Event Hub
"name": "[concat(parameters('namespaceName'), '/', parameters('eventHubName'))]",
"type": "Microsoft.EventHub/namespaces/eventhubs",
"apiVersion": "2017-04-01",
"location": "[resourceGroup().location]",
"properties": {
"messageRetention": 1
},
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaceName'))]"
],
"resources": [
{
// Shared Access Key
"name": "[concat(parameters('namespaceName'), '/', parameters('eventHubName'), '/', variables('SharedAccessKeyName'))]",
"type": "Microsoft.EventHub/namespaces/eventhubs/authorizationRules",
"apiVersion": "2017-04-01",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaceName'))]",
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaceName'), parameters('eventHubName'))]"
],
"properties": {
"rights": [
"Send",
"Listen"
]
}
},
{
// Read-only Shared Access Key
"name": "[concat(parameters('namespaceName'), '/', parameters('eventHubName'), '/', variables('ReadOnlySharedAccessKeyName'))]",
"type": "Microsoft.EventHub/namespaces/eventhubs/authorizationRules",
"apiVersion": "2017-04-01",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaceName'))]",
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaceName'), parameters('eventHubName'))]"
],
"properties": {
"rights": [
"Listen"
]
}
},
{
// Consumer Groups
"name": "[concat(parameters('namespaceName'), '/', parameters('eventHubName'), '/', variables('ConsumerGroup'))]",
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
"apiVersion": "2017-04-01",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaceName'))]",
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaceName'), parameters('eventHubName'))]"
],
"properties": {}
}
]
}
]
}
],
"outputs": {
"SharedAccessKey": {
"type": "string",
"value": "[listKeys(concat(parameters('namespaceName'), '/', parameters('eventHubName'), '/', variables('SharedAccessKeyName')), '2017-04-01').primaryKey.value]"
},
"SharedAccessKeyName": {
"type": "string",
"value": "[variables('SharedAccessKeyName')]"
},
"ReadOnlySharedAccessKey": {
"type": "string",
"value": "[listKeys(concat(parameters('namespaceName'), '/', parameters('eventHubName'), '/', variables('ReadOnlySharedAccessKeyName')), '2017-04-01').primaryKey.value]"
},
"ReadOnlySharedAccessKeyName": {
"type": "string",
"value": "[variables('ReadOnlySharedAccessKeyName')]"
},
"ConsumerGroup": {
"type": "string",
"value": "[variables('ConsumerGroup')]"
}
}
}
Thank you.