Added lb template from old repo
This commit is contained in:
Родитель
6c90e7ccc9
Коммит
8d76970b41
|
@ -0,0 +1,28 @@
|
|||
# Create 2 Virtual Machines under a Load balancer and configures Load Balancing rules for the VMs
|
||||
|
||||
<a href="https://azuredeploy.net/" target="_blank">
|
||||
<img src="http://azuredeploy.net/deploybutton.png"/>
|
||||
</a>
|
||||
|
||||
This template allows you to create 2 Virtual Machines under a Load balancer and configure a load balancing rule on Port 80. This template also deploys a Storage Account, Virtual Network, Public IP address, Availability Set and Network Interfaces.
|
||||
|
||||
In this template, we use the resource loops capability to create the network interfaces and virtual machines
|
||||
|
||||
Below are the parameters that the template expects
|
||||
|
||||
| Name | Description |
|
||||
|:--- |:---|
|
||||
| storageAccountName | Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed. |
|
||||
| adminUsername | Username for the Virtual Machines |
|
||||
| adminPassword | Password for the Virtual Machine |
|
||||
| dnsNameForLBIP | Unique DNS Name for the Public IP used to access the Virtual Machine. |
|
||||
| subscriptionId | Subscription ID where the template will be deployed |
|
||||
| vmSourceImageName | Source Image Name for the VM. Example: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_5-LTS-amd64-server-20140927-en-us-30GB |
|
||||
| region | location where the resources will be deployed |
|
||||
| vnetName | Name of Virtual Network |
|
||||
| vmSize | Size of the Virtual Machine |
|
||||
| vmNamePrefix | NamePrefix for Virtual Machines |
|
||||
| publicIPAddressName | Name of Public IP Address Name |
|
||||
| nicNamePrefix | NamePrefix for Network Interfaces |
|
||||
| lbName | Name for the load balancer |
|
||||
| backendPort | The Back End Port that needs to be opened on the Virtual Machine Instance. For example: 3389 for RDP, 22 for SSH etc., |
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"region": {
|
||||
"value": "West US"
|
||||
},
|
||||
"storageAccountName": {
|
||||
"value" : "coudf87"
|
||||
},
|
||||
"adminUsername": {
|
||||
"value" : "cloudguy"
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": "abc_123!"
|
||||
},
|
||||
"dnsNameforLBIP": {
|
||||
"value": "coudf87"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,331 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Location of resources"
|
||||
}
|
||||
},
|
||||
"storageAccountName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name of storage account"
|
||||
}
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Admin username"
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Admin password"
|
||||
}
|
||||
},
|
||||
"dnsNameforLBIP": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "DNS for Load Balancer IP"
|
||||
}
|
||||
},
|
||||
"backendPort": {
|
||||
"type": "int",
|
||||
"defaultValue": 3389,
|
||||
"metadata": {
|
||||
"description": "Backend port"
|
||||
}
|
||||
},
|
||||
"vmNamePrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "myVM",
|
||||
"metadata": {
|
||||
"description": "Prefix to use for VM names"
|
||||
}
|
||||
},
|
||||
"vmSourceImageName": {
|
||||
"type": "string",
|
||||
"defaultValue": "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201412.01-en.us-127GB.vhd"
|
||||
},
|
||||
"lbName": {
|
||||
"type": "string",
|
||||
"defaultValue": "myLB",
|
||||
"metadata": {
|
||||
"description": "Load Balancer name"
|
||||
}
|
||||
},
|
||||
"nicNamePrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "nic",
|
||||
"metadata": {
|
||||
"description": "Network Interface name prefix"
|
||||
}
|
||||
},
|
||||
"publicIPAddressName": {
|
||||
"type": "string",
|
||||
"defaultValue": "myPublicIP",
|
||||
"metadata": {
|
||||
"description": "Public IP Name"
|
||||
}
|
||||
},
|
||||
"vnetName": {
|
||||
"type": "string",
|
||||
"defaultValue": "myVNET",
|
||||
"metadata": {
|
||||
"description": "VNET name"
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "Size of the VM"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"availabilitySetName": "myAvSet",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet-1",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('vnetName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables ('subnetName'))]",
|
||||
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]",
|
||||
"lbID": "[resourceId('Microsoft.Network/loadBalancers',parameters('lbName'))]",
|
||||
"numberOfInstances": 2,
|
||||
"nicId1": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('nicNamePrefix'), 0))]",
|
||||
"nicId2": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('nicNamePrefix'), 1))]",
|
||||
"frontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/LBFE')]",
|
||||
"backEndIPConfigID1": "[concat(variables('nicId1'),'/ipConfigurations/ipconfig1')]",
|
||||
"backEndIPConfigID2": "[concat(variables('nicId2'),'/ipConfigurations/ipconfig1')]",
|
||||
"sourceImageName": "[concat('/', subscription().subscriptionId,'/services/images/',parameters('vmSourceImageName'))]",
|
||||
"lbPoolID": "[concat(variables('lbID'),'/backendAddressPools/LBBE')]",
|
||||
"lbProbeID": "[concat(variables('lbID'),'/probes/tcpProbe')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[parameters('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/availabilitySets",
|
||||
"name": "[variables('availabilitySetName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": { }
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[parameters('publicIPAddressName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameforLBIP')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[parameters('vnetName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(parameters('nicNamePrefix'), copyindex())]",
|
||||
"location": "[parameters('location')]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
},
|
||||
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat('Microsoft.Network/loadBalancers/',parameters('lbName'),'/backendAddressPools/LBBE')]"
|
||||
}
|
||||
],
|
||||
"loadBalancerInboundNatRules": [
|
||||
{
|
||||
"id": "[concat('Microsoft.Network/loadBalancers/',parameters('lbName'),'/inboundNatRule/RDP-VM', copyindex())]"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"name": "[parameters('lbName')]",
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"nicLoop",
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"frontendIPConfigurations": [
|
||||
{
|
||||
"name": "LBFE",
|
||||
"properties": {
|
||||
"publicIPAddress": {
|
||||
"id": "[variables('publicIPAddressID')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"backendAddressPools": [
|
||||
{
|
||||
"name": "LBBE"
|
||||
|
||||
}
|
||||
],
|
||||
"inboundNatRules": [
|
||||
{
|
||||
"name": "RDP-VM1",
|
||||
"properties": {
|
||||
"frontendIPConfiguration":
|
||||
{
|
||||
"id": "[variables('frontEndIPConfigID')]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPort": 50001,
|
||||
"backendPort": 3389,
|
||||
"enableFloatingIP": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "RDP-VM2",
|
||||
"properties": {
|
||||
"frontendIPConfiguration":
|
||||
{
|
||||
"id": "[variables('frontEndIPConfigID')]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPort": 50002,
|
||||
"backendPort": 3389,
|
||||
"enableFloatingIP": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"loadBalancingRules": [
|
||||
{
|
||||
"name": "LBRule",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[variables('frontEndIPConfigID')]"
|
||||
},
|
||||
"backendAddressPool": {
|
||||
"id": "[variables('lbPoolID')]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPort": 80,
|
||||
"backendPort": 80,
|
||||
"enableFloatingIP": false,
|
||||
"idleTimeoutInMinutes": 5,
|
||||
"probe": {
|
||||
"id": "[variables('lbProbeID')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{
|
||||
"name": "tcpProbe",
|
||||
"properties": {
|
||||
"protocol": "tcp",
|
||||
"port": 80,
|
||||
"intervalInSeconds": "5",
|
||||
"numberOfProbes": "2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyindex())]",
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicNamePrefix'), copyindex())]",
|
||||
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"availabilitySet": {
|
||||
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computername": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"sourceImage": {
|
||||
"id": "[variables('sourceImageName')]"
|
||||
},
|
||||
"destinationVhdsContainer": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('nicNamePrefix'),copyindex()))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"itemDisplayName": "2 VMs in a Load Balancer and load balancing rules",
|
||||
"description": "This template allows you to create 2 Virtual Machines under a Load balancer and configure a load balancing rule on Port 80. This template also deploys a Storage Account, Virtual Network, Public IP address, Availability Set and Network Interfaces. In this template, we use the resource loops capability to create the network interfaces and virtual machines",
|
||||
"summary": "2 VMs in a Load Balancer and Load Balancer rules",
|
||||
"githubUsername": "ypitsch",
|
||||
"dateUpdated": "2015-04-28"
|
||||
}
|
Загрузка…
Ссылка в новой задаче