vdc/Modules/EventHub/deploy.json

340 строки
13 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"namespaceName": {
"type": "string",
"metadata": {
"description": "Required. The name of the EventHub namespace"
}
},
"eventHubName": {
"type": "string",
"metadata": {
"description": "Required. The name of the EventHub"
}
},
"messageRetentionInDays": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"maxValue": 7,
"metadata": {
"description": "Optional. How long to retain the data in EventHub"
}
},
"partitionCount": {
"type": "int",
"defaultValue": 4,
"minValue": 2,
"maxValue": 32,
"metadata": {
"description": "Optional. Number of partitions chosen"
}
},
"skuName": {
"type": "string",
"defaultValue": "Standard",
"metadata": {
"description": "Optional. EventHub Plan sku name"
}
},
"skuTier": {
"type": "string",
"defaultValue": "Standard",
"metadata": {
"description": "Optional. EventHub Plan account tier"
}
},
"skuCapacity": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "Optional. EventHub Plan scale-out capacity of the resource"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Optional. Location for all Resources"
}
},
"diagnosticStorageAccountId": {
"type": "string",
"metadata": {
"description": "Required. Resource identifier of the Diagnostic Storage Account"
}
},
"logsRetentionInDays": {
"type": "int",
"defaultValue": 30,
"minValue": 0,
"maxValue": 365,
"metadata": {
"description": "Optional. Specifies the number of days that logs will be kept for, a value of 0 will retain data indefinitely"
}
},
"cuaId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered"
}
},
"tagValues": {
"type": "object",
"defaultValue": {},
"metadata": {
"description": "Optional. Azure Resource Tags object."
}
},
"diagnosticStorageAccountId": {
"type": "string",
"metadata": {
"description": "Required. Diagnostic Storage Account Id for enabling the diagnostic settings."
}
},
"workspaceId": {
"type": "string",
"metadata": {
"description": "Required. Resource identifier of Log Analytics."
}
},
"logsRetentionInDays": {
"type": "int",
"defaultValue": 30,
"minValue": 0,
"maxValue": 365,
"metadata": {
"description": "Optional. Specifies the number of days that logs will be kept for, a value of 0 will retain data indefinitely"
}
},
"networkAcls": {
"type": "object",
"defaultValue": {},
"metadata": {
"description": "Optional. Service endpoint object information"
}
},
"vNetId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Optional. Virtual Network Id to lock down the Event Hub."
}
}
},
"variables": {
"namespaceName": "[parameters('namespaceName')]",
"namespaceResourceId": "[resourceId('Microsoft.EventHub/Namespaces',parameters('namespaceName'))]",
"namespaceApiVersion": "2017-04-01",
"diagnosticStorageAccountId": "[parameters('diagnosticStorageAccountId')]",
"defaultSASKeyName": "RootManageSharedAccessKey",
"authRuleResourceId": "[resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('namespaceName'), variables('defaultSASKeyName'))]",
"pidName": "[concat('pid-', parameters('cuaId'))]"
},
"resources": [
{
"condition": "[not(empty(parameters('cuaId')))]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2018-02-01",
"name": "[variables('pidName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{
"type": "Microsoft.EventHub/namespaces",
"apiVersion": "[variables('namespaceApiVersion')]",
"name": "[parameters('namespaceName')]",
"location": "[parameters('location')]",
"tags": "[if(empty(parameters('tagValues')), json('null'), parameters('tagValues'))]",
"sku": {
"name": "[parameters('skuName')]",
"tier": "[parameters('skuTier')]",
"capacity": "[parameters('skuCapacity')]"
},
"properties": {
"zoneRedundant": false,
"isAutoInflateEnabled": false,
"maximumThroughputUnits": 0,
"kafkaEnabled": false
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces/providers/diagnosticSettings",
"apiVersion": "2017-05-01-preview",
"name": "[concat(variables('namespaceName'), '/','Microsoft.Insights/service')]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('namespaceResourceId')]"
],
"properties": {
"storageAccountId": "[variables('diagnosticStorageAccountId')]",
"workspaceId": "[parameters('workspaceId')]",
"metrics": [
{
"category": "AllMetrics",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
}
],
"logs": [
{
"category": "ArchiveLogs",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
},
{
"category": "OperationalLogs",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
},
{
"category": "AutoScaleLogs",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
},
{
"category": "KafkaCoordinatorLogs",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
},
{
"category": "EventHubVNetConnectionEvent",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
},
{
"category": "CustomerManagedKeyUserLogs",
"enabled": true,
"retentionPolicy": {
"days": "[parameters('logsRetentionInDays')]",
"enabled": true
}
}
]
}
}
]
},
{
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
"apiVersion": "[variables('namespaceApiVersion')]",
"name": "[concat(parameters('namespaceName'),'/RootManageSharedAccessKey')]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('namespaceResourceId')]"
],
"properties": {
"rights": [
"Listen",
"Manage",
"Send"
]
}
},
{
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
"apiVersion": "[variables('namespaceApiVersion')]",
"name": "[concat(parameters('namespaceName'),'/SendListenAccess')]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('namespaceResourceId')]"
],
"properties": {
"rights": [
"Listen",
"Send"
]
}
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs",
"apiVersion": "[variables('namespaceApiVersion')]",
"name": "[concat(parameters('namespaceName'), '/',parameters('eventHubName'))]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('namespaceResourceId')]"
],
"properties": {
"messageRetentionInDays": "[parameters('messageRetentionInDays')]",
"partitionCount": "[parameters('partitionCount')]",
"status": "Active"
}
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
"apiVersion": "[variables('namespaceApiVersion')]",
"name": "[concat(parameters('namespaceName'), '/',parameters('eventHubName'), '/$Default')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaceName'), parameters('eventHubName'))]",
"[variables('namespaceResourceId')]"
],
"properties": {}
}
],
"outputs": {
"namespaceName": {
"type": "string",
"value": "[variables('namespaceName')]",
"metadata": {
"description": "The Name of the EventHub Namespace"
}
},
"namespaceResourceId": {
"type": "string",
"value": "[variables('namespaceResourceId')]",
"metadata": {
"description": "The Resource Id of the EventHub Namespace"
}
},
"namespaceResourceGroup": {
"type": "string",
"value": "[resourceGroup().name]",
"metadata": {
"description": "The name of the Resource Group with the EventHub Namespace"
}
},
"namespaceConnectionString": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('namespaceApiVersion')).primaryConnectionString]",
"metadata": {
"description": "The connection string of the EventHub Namespace"
}
},
"sharedAccessPolicyPrimaryKey": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('namespaceApiVersion')).primaryKey]",
"metadata": {
"description": "The shared access policy primary key for the EventHub Namespace"
}
}
}
}