{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "location": { "type": "string", "defaultValue": "westus" }, "environmentPostfix": { "type": "string", "defaultValue": "qa" }, "vnetname": { "type": "string", "defaultValue": "hmrorvnetqa" }, "subnetname": { "type": "string", "defaultValue": "dmzsubnet" }, "numberOfvftpVM": { "type": "int", "defaultValue": 1, "maxValue": 5 }, "vftpVMAdmin": { "type": "string" }, "vftpsshKeyData": { "type": "string", "metadata": { "description": "SSH rsa public key file as a string." } }, "ipaddressrange": { "type": "string", "defaultValue": "11.0.2.0/24" } }, "variables": { "vmApiVersion": "2016-03-30", "networkApiVersion": "2016-03-30", "storageApiVersion": "2015-06-15", "vnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetname'))]", "vftpsubnetRef": "[concat(variables('vnetID'),'/subnets/', parameters('subnetname'))]", "baseIP": "[split(parameters('ipaddressrange'), '/')[0]]", "ipValues": "[split(variables('baseIP'), '.')]", "vnetfirst2": "[concat(variables('ipValues')[0], '.', variables('ipValues')[1], '.')]", "subnetFirst3": "[concat(variables('vnetfirst2'), variables('ipValues')[2])]", "ip1": "[concat(variables('subnetFirst3'), '.', add(int(variables('ipValues')[3]), 4))]", "ip2": "[concat(variables('subnetFirst3'), '.', add(int(variables('ipValues')[3]), 5))]", "ip3": "[concat(variables('subnetFirst3'), '.', add(int(variables('ipValues')[3]), 6))]", "fileUris": "https://raw.githubusercontent.com/srakesh28/azure-ubuntu-ror-postgress/master/empty_script.sh", "commandToExecute": "sh empty_script.sh", "addresses": [ "[variables('ip1')]", "[variables('ip2')]", "[variables('ip3')]" ], "remoteNodeIPArray": ["0.0.0.0", "1.1.1.1", "2.2.2.2"], "alladdresses": "[concat(variables('addresses'), variables('remoteNodeIPArray'))]", "storageAccountType": "Standard_LRS", "vftpVmSize": "Standard_D1_V2", "as_vftp": "[concat(variables('vftpprefix'), 'as', parameters('environmentPostfix'))]", "vftpprefix": "vftp", "vmname": "[concat(variables('vftpprefix'), 'vm', parameters('environmentPostfix'))]", "vftpStorageAccount": "[concat(substring(uniqueString(resourceGroup().id, variables('vmname')),5), variables('vftpprefix'), 'sa')]", "vftpdiagnosticsStorageAccount": "[concat(substring(uniqueString(resourceGroup().id, variables('vmname')),5), variables('vftpprefix'), 'diagsa')]", "vftpsshKeyPath": "[concat('/home/',parameters('vftpVMAdmin'),'/.ssh/authorized_keys')]", "imageReferences": { "vftp": { "publisher": "bitnami", "offer": "nodejs", "sku": "4-3", "version": "latest" } } }, "resources": [{ "type": "Microsoft.Storage/storageAccounts", "name": "[concat(variables('vftpstorageaccount'), copyIndex())]", "apiVersion": "[variables('storageApiVersion')]", "location": "[parameters('location')]", "tags": { "displayName": "vftpstorageaccounts" }, "copy": { "name": "vftpStorageLoop", "count": "[parameters('numberOfvftpVM')]" }, "properties": { "accountType": "[variables('storageAccountType')]" } }, { "type": "Microsoft.Storage/storageAccounts", "name": "[variables('vftpdiagnosticsStorageAccount')]", "apiVersion": "[variables('storageApiVersion')]", "location": "[parameters('location')]", "tags": { "displayName": "vftpdiagnosticstorage" }, "properties": { "accountType": "Standard_LRS" } }, { "type": "Microsoft.Compute/availabilitySets", "name": "[variables('as_vftp')]", "apiVersion": "[variables('vmApiVersion')]", "location": "[parameters('location')]", "properties": { "platformUpdateDomainCount": 6, "platformFaultDomainCount": 3 }, "tags": { "displayName": "availabilityset_vftp" }, "dependsOn": [] }, { "type": "Microsoft.Compute/virtualMachines", "name": "[concat(variables('vmname'), copyIndex())]", "location": "[parameters('location')]", "apiVersion": "[variables('vmApiVersion')]", "copy": { "name": "vftpvmLoop", "count": "[parameters('numberOfvftpVM')]" }, "tags": { "displayName": "vftpvms" }, "dependsOn": [ "vftpStorageLoop", "[resourceId('Microsoft.Compute/availabilitySets', variables('as_vftp'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('vmname'),'nic', copyindex())]" ], "properties": { "availabilitySet": { "id": "[resourceId('Microsoft.Compute/availabilitySets', variables('as_vftp'))]" }, "hardwareProfile": { "vmSize": "[variables('vftpVmSize')]" }, "osProfile": { "computerName": "[concat(variables('vmname'),copyIndex())]", "adminUsername": "[parameters('vftpVMAdmin')]", "linuxConfiguration": { "disablePasswordAuthentication": true, "ssh": { "publicKeys": [{ "path": "[variables('vftpsshKeyPath')]", "keyData": "[parameters('vftpsshKeyData')]" }] } } }, "storageProfile": { "imageReference": "[variables('imagereferences').vftp]", "osDisk": { "name": "vftposdisk", "vhd": { "uri": "[concat('http://',variables('vftpStorageAccount'), copyIndex(),'.blob.core.windows.net/vhds/','vftposdisk', copyIndex(), '.vhd')]" }, "caching": "ReadWrite", "createOption": "FromImage" } }, "networkProfile": { "networkInterfaces": [{ "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('vmname'),'nic', copyindex()))]" }] } }, "plan": { "name": "4-3", "publisher": "bitnami", "product": "nodejs" } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('vmname'), copyIndex(), '/install_vftp')]", "apiVersion": "[variables('vmApiVersion')]", "location": "[parameters('location')]", "dependsOn": [ "vftpvmLoop" ], "copy": { "name": "scriptCopyLoop", "count": "[parameters('numberOfvftpVM')]" }, "tags": { "displayName": "vftpvmscript" }, "properties": { "publisher": "Microsoft.Azure.Extensions", "type": "CustomScript", "typeHandlerVersion": "2.0", "autoUpgradeMinorVersion": true, "settings": { "fileUris": [ "https://raw.githubusercontent.com/srakesh28/azure-ubuntu-ror-postgress/master/empty_script.sh" ], "commandToExecute": "sh empty_script.sh" } } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('vmname'), copyIndex(), '/diagext')]", "apiVersion": "[variables('vmApiVersion')]", "location": "[parameters('location')]", "dependsOn": [ "vftpvmLoop" ], "copy": { "name": "vftpvmdiagextensionLoop", "count": "[parameters('numberOfvftpVM')]" }, "tags": { "displayName": "vftpvmsdiagext" }, "properties": { "publisher": "Microsoft.OSTCExtensions", "type": "LinuxDiagnostic", "typeHandlerVersion": "2.3", "autoUpgradeMinorVersion": true, "settings": { "perfCfg": [{ "query": "SELECT UsedMemory,AvailableMemory FROM SCX_MemoryStatisticalInformation", "table": "Memory" }, { "query": "SELECT PercentProcessorTime FROM SCX_ProcessorStatisticalInformation", "table": "_Total" }] }, "protectedSettings": { "storageAccountName": "[variables('vftpdiagnosticsStorageAccount')]", "storageAccountKey": "[listkeys(variables('vftpdiagnosticsStorageAccount'), variables('storageApiVersion')).key1]", "storageAccountEndPoint": "https://core.windows.net" } } }, { "apiVersion": "[variables('vmApiVersion')]", "type": "Microsoft.Network/networkInterfaces", "name": "[concat(variables('vmname'),'nic', copyindex())]", "location": "[parameters('location')]", "copy": { "name": "vftpnicLoop", "count": "[parameters('numberOfvftpVM')]" }, "dependsOn": [], "tags": { "displayName": "vftpNICs" }, "properties": { "ipConfigurations": [{ "name": "ipconfigvftp", "properties": { "privateIPAllocationMethod": "Static", "privateIPAddress": "[variables('addresses')[copyIndex()]]", "subnet": { "id": "[variables('vftpsubnetRef')]" } } }] } } ], "outputs": { "LBAddress": { "type": "array", "value": "[variables('addresses')]" } } }