Skip to content

Instantly share code, notes, and snippets.

@rnkhouse
Last active September 6, 2018 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnkhouse/bc59ef75c12a9da194965d8081784c6a to your computer and use it in GitHub Desktop.
Save rnkhouse/bc59ef75c12a9da194965d8081784c6a to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "String",
"metadata": {
"description": "Admin username"
}
},
"adminPassword": {
"type": "SecureString",
"metadata": {
"description": "Admin password"
}
},
"dnsNameforIPv4LbIP": {
"type": "String",
"metadata": {
"description": "DNS prefix for IPv4 IP Address of the load balancer. It must be lowercase and match the regex: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$."
}
},
"dnsNameforIPv6LbIP": {
"type": "String",
"metadata": {
"description": "DNS prefix for IPv6 IP Address of the load balancer. It must be lowercase and match the regex: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$."
}
}
},
"variables": {
"vmNamePrefix": "myIPv6VM",
"nicNamePrefix": "IPv6Nic",
"availabilitySetName": "myIPv6AvSet",
"addressPrefix": "10.50.0.0/16",
"subnetName": "myIPv4Subnet",
"subnetPrefix": "10.50.0.0/24",
"vnetName": "myIPv4VNet",
"ipv4PrivateIPAddressType": "Dynamic",
"ipv6PrivateIPAddressType": "Dynamic",
"numberOfInstances": 1,
"ipv6PublicIPAddressName": "myIPv6PublicIP",
"ipv4PublicIPAddressName": "myIPv4PublicIP",
"ipv4PublicIPAddressType": "Dynamic",
"ipv6PublicIPAddressType": "Dynamic",
"lbName": "myIPv4IPv6LB",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]",
"ipv4FrontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEndIPv4')]",
"ipv6FrontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEndIPv6')]",
"ipv4LbBackendPoolID": "[concat(variables('lbID'),'/backendAddressPools/BackendPoolIPv4')]",
"ipv6LbBackendPoolID": "[concat(variables('lbID'),'/backendAddressPools/BackendPoolIPv6')]",
"ipv4ipv6lbProbeName": "tcpProbeIPv4IPv6",
"ipv4ipv6lbProbeID": "[concat(variables('lbID'),'/probes/', variables('ipv4ipv6lbProbeName'))]"
},
"resources": [
{
"type": "Microsoft.Compute/availabilitySets",
"name": "[variables('availabilitySetName')]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"properties": {
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 2,
"managed": true
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('ipv4PublicIPAddressName')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "[variables('ipv4PublicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsNameforIPv4LbIP')]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('ipv6PublicIPAddressName')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAddressVersion": "IPv6",
"publicIPAllocationMethod": "[variables('ipv6PublicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsNameforIPv6LbIP')]"
}
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('vnetName')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicNamePrefix'), copyindex())]",
"apiVersion": "2018-01-01",
"location": "[resourceGroup().location]",
"copy": {
"name": "nicLoop",
"count": "[variables('numberOfInstances')]"
},
"properties": {
"ipConfigurations": [
{
"name": "ipv4IPConfig",
"properties": {
"privateIPAddressVersion": "IPv4",
"privateIPAllocationMethod": "[variables('ipv4PrivateIPAddressType')]",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('vnetName'), variables('subnetName'))]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[variables('ipv4LbBackendPoolID')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(variables('lbID'),'/inboundNatRules/RDP-VM', copyindex())]"
}
]
}
},
{
"name": "ipv6IPConfig",
"properties": {
"privateIPAddressVersion": "IPv6",
"privateIPAllocationMethod": "[variables('ipv6PrivateIPAddressType')]",
"loadBalancerBackendAddressPools": [
{
"id": "[variables('ipv6LbBackendPoolID')]"
}
]
}
}
]
},
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]"
]
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"frontendIPConfigurations": [
{
"name": "LoadBalancerFrontEndIPv4",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('ipv4PublicIPAddressName'))]"
}
}
},
{
"name": "LoadBalancerFrontEndIPv6",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('ipv6PublicIPAddressName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "BackendPoolIPv4"
},
{
"name": "BackendPoolIPv6"
}
],
"inboundNatRules": [
{
"name": "RDP-VM0",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv4FrontEndIPConfigID')]"
},
"protocol": "tcp",
"frontendPort": 50001,
"backendPort": 3389,
"enableFloatingIP": false
}
},
{
"name": "my-ssh",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv4FrontEndIPConfigID')]"
},
"protocol": "tcp",
"frontendPort": 22,
"backendPort": 22,
"enableFloatingIP": false
}
},
{
"name": "zen-ipv4",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv4FrontEndIPConfigID')]"
},
"protocol": "tcp",
"frontendPort": 9033,
"backendPort": 9033,
"enableFloatingIP": false
}
},
{
"name": "zen-ipv6",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv6FrontEndIPConfigID')]"
},
"protocol": "tcp",
"frontendPort": 9033,
"backendPort": 9033,
"enableFloatingIP": false
}
}
],
"loadBalancingRules": [
{
"name": "LBRuleIPv4",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv4FrontEndIPConfigID')]"
},
"backendAddressPool": {
"id": "[variables('ipv4LbBackendPoolID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[variables('ipv4ipv6lbProbeID')]"
}
}
},
{
"name": "LBRuleIPv6",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('ipv6FrontEndIPConfigID')]"
},
"backendAddressPool": {
"id": "[variables('ipv6LbBackendPoolID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 8080,
"probe": {
"id": "[variables('ipv4ipv6lbProbeID')]"
}
}
}
],
"probes": [
{
"name": "[variables('ipv4ipv6lbProbeName')]",
"properties": {
"protocol": "Tcp",
"port": 80,
"intervalInSeconds": 5,
"numberOfProbes": 2
}
}
]
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('ipv4PublicIPAddressName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', variables('ipv6PublicIPAddressName'))]"
]
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmNamePrefix'), copyindex())]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"copy": {
"name": "virtualMachineLoop",
"count": "[variables('numberOfInstances')]"
},
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "Standard_D3_v2_Promo"
},
"osProfile": {
"computerName": "[concat(variables('vmNamePrefix'), copyIndex())]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "16.04-LTS",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicNamePrefix'),copyindex()))]"
}
]
}
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicNamePrefix'), copyindex())]",
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment