Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"defaultValue": "proxyVm",
"metadata": {
"description": "Name of the VM"
}
},
"vmSku": {
"type": "string",
"defaultValue": "Standard_DS3_v2",
"metadata": {
"description": "VM SKU. Be aware of NIC count limitations."
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "VM admin username, certain standard values are not allowed."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for aVM admin. Please chose a secure random password with at least 16 characters."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"nicCount": {
"type": "int",
"defaultValue": 4,
"minValue": 1,
"maxValue": 20,
"metadata": {
"description": "Numbers of NICs and PIPs to be deployed."
}
}
},
"variables": {
"subnetName": "subnet01",
"virtualNetworkName": "[concat(parameters('vmName'), '-vnet')]",
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "19.04",
"version": "19.04.201907241",
"vnetPrefix": "10.0.0.0/24",
"subnetPrefix": "10.0.0.0/24"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"apiVersion": "2019-04-01",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vnetPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat(parameters('vmName'), copyIndex(), '-pip')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"copy": {
"name": "proxyVmPipCopy",
"count": "[parameters('nicCount')]"
},
"properties": {
"publicIPAllocationMethod": "Static"
}
},
{
"name": "[concat(parameters('vmName'), copyIndex(), '-nic')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2017-06-01",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', parameters('vmName'), copyIndex(), '-pip')]"
],
"copy": {
"name": "proxyVmNicCopy",
"count": "[parameters('nicCount')]"
},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"primary": "[if(greater(copyIndex(), 0), 'false', 'true')]",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]"
},
"privateIPAllocationMethod": "Dynamic",
"publicIpAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', concat(parameters('vmName'), copyIndex(), '-pip'))]"
}
}
}
]
}
},
{
"apiVersion": "2019-03-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "ProxyVm",
"location": "[parameters('location')]",
"dependsOn": ["proxyVmNicCopy"],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSku')]"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('publisher')]",
"offer": "[variables('offer')]",
"sku": "[variables('sku')]",
"version": "[variables('version')]"
},
"osDisk": {
"name": "[concat(parameters('vmName'), '_OSDisk')]",
"caching": "ReadOnly",
"createOption": "FromImage"
}
},
"networkProfile": {
"copy": [{
"name": "networkInterfaces",
"count": "[parameters('nicCount')]",
"input": {
"properties": {
"primary": "[if(greater(copyIndex('networkInterfaces'), 0), 'false', 'true')]"
},
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'), copyIndex('networkInterfaces'), '-nic'))]"
}
}]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.