|
| 1 | +{ |
| 2 | + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", |
| 3 | + "contentVersion": "1.0.0.0", |
| 4 | + "parameters": { |
| 5 | + "EnvironmentTag": { |
| 6 | + "type": "string" |
| 7 | + } |
| 8 | + }, |
| 9 | + "variables": { |
| 10 | + "keyVaultApiVersion": "2015-06-01", |
| 11 | + "keyVaultName": "[concat('ca-devcache-', parameters('environmentTag'))]", |
| 12 | + |
| 13 | + "eventHubApiVersion": "2015-08-01", |
| 14 | + "namespaceName": "[concat('ca-devcache-', parameters('environmentTag'), '-namespace')]", |
| 15 | + "eventHubName": "[concat('ca-devcache-', parameters('environmentTag'), '-hub')]", |
| 16 | + "eventHubSendConnectionStringKeyName": "eventHubSendConnectionString", |
| 17 | + "eventHubReceiveConnectionStringKeyName": "eventHubReceiveConnectionString", |
| 18 | + "sendRuleName": "sendRule", |
| 19 | + "receiveRuleName": "receiveRule", |
| 20 | + "sendAuthRuleResourceId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('namespaceName'), variables('eventHubName'), variables('sendRuleName'))]", |
| 21 | + "receiveAuthRuleResourceId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('namespaceName'), variables('eventHubName'), variables('receiveRuleName'))]", |
| 22 | + |
| 23 | + "storageApiVersion": "2016-01-01", |
| 24 | + "consumerCoordinationStorage": "[concat('cadevcache', parameters('environmentTag'), 'storage')]", |
| 25 | + "storageSecretKeyName": "storageConnection" |
| 26 | + }, |
| 27 | + "resources": [ |
| 28 | + { |
| 29 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 30 | + "name": "[variables('namespaceName')]", |
| 31 | + "type": "Microsoft.EventHub/Namespaces", |
| 32 | + "tags": { "displayName": "Event Hub namespace & hub" }, |
| 33 | + "location": "[resourceGroup().location]", |
| 34 | + "sku": { |
| 35 | + "name": "Standard", |
| 36 | + "tier": "Standard", |
| 37 | + "capacity": 20 |
| 38 | + }, |
| 39 | + "resources": [ |
| 40 | + { |
| 41 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 42 | + "name": "[variables('eventHubName')]", |
| 43 | + "type": "EventHubs", |
| 44 | + "dependsOn": [ |
| 45 | + "[concat('Microsoft.EventHub/namespaces/', variables('namespaceName'))]" |
| 46 | + ], |
| 47 | + "properties": { |
| 48 | + "path": "[variables('eventHubName')]", |
| 49 | + "MessageRetentionInDays": "1", |
| 50 | + "PartitionCount": 20 |
| 51 | + }, |
| 52 | + "resources": [ |
| 53 | + { |
| 54 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 55 | + "name": "devcacheConsumers", |
| 56 | + "type": "ConsumerGroups", |
| 57 | + "dependsOn": [ |
| 58 | + "[variables('eventHubName')]" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "type": "authorizationRules", |
| 63 | + "name": "[variables('receiveRuleName')]", |
| 64 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 65 | + "properties": { |
| 66 | + "rights": [ |
| 67 | + "Listen" |
| 68 | + ] |
| 69 | + }, |
| 70 | + "resources": [], |
| 71 | + "dependsOn": [ |
| 72 | + "[variables('eventHubName')]" |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "type": "authorizationRules", |
| 77 | + "name": "[variables('sendRuleName')]", |
| 78 | + "apiVersion": "[variables('eventHubApiVersion')]", |
| 79 | + "properties": { |
| 80 | + "rights": [ |
| 81 | + "Send" |
| 82 | + ] |
| 83 | + }, |
| 84 | + "resources": [], |
| 85 | + "dependsOn": [ |
| 86 | + "[variables('eventHubName')]" |
| 87 | + ] |
| 88 | + } |
| 89 | + ] |
| 90 | + } |
| 91 | + ] |
| 92 | + }, |
| 93 | + { |
| 94 | + "type": "Microsoft.Storage/storageAccounts", |
| 95 | + "name": "[variables('consumerCoordinationStorage')]", |
| 96 | + "tags": { "displayName": "Consumer coordination storage" }, |
| 97 | + "apiVersion": "[variables('storageApiVersion')]", |
| 98 | + "location": "[resourceGroup().location]", |
| 99 | + "sku": { |
| 100 | + "name": "Standard_LRS" |
| 101 | + }, |
| 102 | + "kind": "Storage", |
| 103 | + "properties": {} |
| 104 | + }, |
| 105 | + { |
| 106 | + "type": "Microsoft.KeyVault/vaults/secrets", |
| 107 | + "apiVersion": "[variables('keyVaultApiVersion')]", |
| 108 | + "name": "[concat(variables('keyVaultName'), '/', variables('consumerCoordinationStorage'))]", |
| 109 | + "tags": { "displayName": "Storage secret entry in key vault" }, |
| 110 | + "properties": { |
| 111 | + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('consumerCoordinationStorage')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value]" |
| 112 | + }, |
| 113 | + "dependsOn": [ |
| 114 | + "[concat('Microsoft.Storage/storageAccounts/', variables('consumerCoordinationStorage'))]" |
| 115 | + ] |
| 116 | + }, |
| 117 | + { |
| 118 | + "type": "Microsoft.KeyVault/vaults/secrets", |
| 119 | + "apiVersion": "[variables('keyVaultApiVersion')]", |
| 120 | + "name": "[concat(variables('keyVaultName'), '/', variables('eventHubSendConnectionStringKeyName'))]", |
| 121 | + "tags": { "displayName": "Event hub send connection string secret entry in key vault" }, |
| 122 | + "properties": { |
| 123 | + "value": "[listkeys(variables('sendAuthRuleResourceId'), variables('eventHubApiVersion')).primaryConnectionString]" |
| 124 | + }, |
| 125 | + "dependsOn": [ |
| 126 | + "[concat('Microsoft.EventHub/namespaces/', variables('namespaceName'))]" |
| 127 | + ] |
| 128 | + }, |
| 129 | + { |
| 130 | + "type": "Microsoft.KeyVault/vaults/secrets", |
| 131 | + "apiVersion": "[variables('keyVaultApiVersion')]", |
| 132 | + "name": "[concat(variables('keyVaultName'), '/', variables('eventHubReceiveConnectionStringKeyName'))]", |
| 133 | + "tags": { "displayName": "Event hub receive connection string secret entry in key vault" }, |
| 134 | + "properties": { |
| 135 | + "value": "[listkeys(variables('receiveAuthRuleResourceId'), variables('eventHubApiVersion')).primaryConnectionString]" |
| 136 | + }, |
| 137 | + "dependsOn": [ |
| 138 | + "[concat('Microsoft.EventHub/namespaces/', variables('namespaceName'))]" |
| 139 | + ] |
| 140 | + } |
| 141 | + ], |
| 142 | + "outputs": {} |
| 143 | +} |
0 commit comments