From a1867784eb881ff87f6143765a094c548b9a570b Mon Sep 17 00:00:00 2001 From: "Vitarella Matthew (0614712)" Date: Tue, 28 Sep 2021 15:19:40 -0400 Subject: [PATCH] Adding a private template that doesn't create a public IP --- src/machines/kibana-resources-private.json | 212 +++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 src/machines/kibana-resources-private.json diff --git a/src/machines/kibana-resources-private.json b/src/machines/kibana-resources-private.json new file mode 100644 index 00000000..d6956b1d --- /dev/null +++ b/src/machines/kibana-resources-private.json @@ -0,0 +1,212 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "metadata": { + "description": "Location where resources will be provisioned" + } + }, + "namespace": { + "type": "string", + "metadata": { + "description": "The unique namespace for the Kibana VM" + } + }, + "networkSettings": { + "type": "object", + "metadata": { + "description": "Network settings" + } + }, + "credentials": { + "type": "secureObject", + "metadata": { + "description": "Credentials information block" + } + }, + "osSettings": { + "type": "object", + "metadata": { + "description": "Platform and OS settings" + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_A1", + "metadata": { + "description": "Size of the Kibana VM" + } + }, + "acceleratedNetworking": { + "type": "string", + "defaultValue": "No", + "allowedValues": [ + "Yes", + "No" + ], + "metadata": { + "description": "Whether to enable accelerated networking for Kibana, which enables single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance. Valid only for specific VM SKUs" + } + }, + "elasticTags": { + "type": "object", + "defaultValue": { + "provider": "648D2193-0CE0-4EFB-8A82-AF9792184FD9" + }, + "metadata": { + "description": "Unique identifiers to allow the Azure Infrastructure to understand the origin of resources deployed to Azure. You do not need to supply a value for this." + } + } + }, + "variables": { + "namespace": "[parameters('namespace')]", + "subnetId": "[resourceId(parameters('networkSettings').resourceGroup, 'Microsoft.Network/virtualNetworks/subnets', parameters('networkSettings').name, parameters('networkSettings').subnet.name)]", + "securityGroupName": "[concat(variables('namespace'), '-nsg')]", + "nicName": "[concat(variables('namespace'), '-nic')]", + "password_osProfile": { + "computername": "[parameters('namespace')]", + "adminUsername": "[parameters('credentials').adminUsername]", + "adminPassword": "[parameters('credentials').password]" + }, + "sshPublicKey_osProfile": { + "computername": "[parameters('namespace')]", + "adminUsername": "[parameters('credentials').adminUsername]", + "linuxConfiguration": { + "disablePasswordAuthentication": "true", + "ssh": { + "publicKeys": [ + { + "path": "[concat('/home/', parameters('credentials').adminUsername, '/.ssh/authorized_keys')]", + "keyData": "[parameters('credentials').sshPublicKey]" + } + ] + } + } + }, + "osProfile": "[variables(concat(parameters('credentials').authenticationType, '_osProfile'))]" + }, + "resources": [ + { + "apiVersion": "2019-04-01", + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[variables('securityGroupName')]", + "location": "[parameters('location')]", + "tags": { + "provider": "[toUpper(parameters('elasticTags').provider)]" + }, + "properties": { + "securityRules": [ + { + "name": "SSH", + "properties": { + "description": "Allows inbound SSH traffic from anyone", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "[parameters('osSettings').managementPort]", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 100, + "direction": "Inbound" + } + }, + { + "name": "Kibana", + "properties": { + "description": "Allows inbound Kibana traffic from anyone", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "5601", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 200, + "direction": "Inbound" + } + } + ] + } + }, + { + "apiVersion": "2019-04-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[parameters('location')]", + "tags": { + "provider": "[toUpper(parameters('elasticTags').provider)]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityGroups', variables('securityGroupName'))]" + ], + "properties": { + "primary": true, + "enableAcceleratedNetworking": "[equals(parameters('acceleratedNetworking'), 'Yes')]", + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('securityGroupName'))]" + } + } + }, + { + "apiVersion": "2019-03-01", + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('namespace')]", + "location": "[parameters('location')]", + "tags": { + "provider": "[toUpper(parameters('elasticTags').provider)]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": "[variables('osProfile')]", + "storageProfile": { + "imageReference": "[parameters('osSettings').imageReference]", + "osDisk": { + "name": "[concat(variables('namespace'), '-osdisk')]", + "managedDisk": { + "storageAccountType": "Standard_LRS" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" + } + ] + } + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(variables('namespace'), '/script')]", + "apiVersion": "2019-03-01", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines', parameters('namespace'))]" + ], + "properties": "[parameters('osSettings').extensionSettings.kibana]" + } + ] + } + ], + "outputs": {} +}