-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Create a VM with multiple NICs and RDP accessable #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Create a VM with multiple NICs and RDP accessable | ||
|
|
||
| <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F201-1-vm-loadbalancer-2-nics%2Fazuredeploy.json" target="_blank"> | ||
| <img src="http://azuredeploy.net/deploybutton.png"/> | ||
| </a> | ||
|
|
||
| This template allows you to create a Virtual Machines with multiple (2) network interfaces (NICs), and RDP connectable with a configured load balancer and an inbound NAT rule. More NICs can easily be added with this template. This template also deploys a Storage Account, Virtual Network, Public IP address, and 2 Network Interfaces (front-end and back-end).| 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., | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,305 @@ | ||
| { | ||
| "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", | ||
| "contentVersion": "1.0.0.0", | ||
| "parameters": { | ||
| "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" | ||
| } | ||
| }, | ||
| "vmNamePrefix": { | ||
| "type": "string", | ||
| "defaultValue": "myVM", | ||
| "metadata": { | ||
| "description": "Prefix to use for VM names" | ||
| } | ||
| }, | ||
| "imagePublisher": { | ||
| "type": "string", | ||
| "defaultValue": "MicrosoftWindowsServer", | ||
| "metadata": { | ||
| "description": "Image Publisher" | ||
| } | ||
| }, | ||
| "imageOffer": { | ||
| "type": "string", | ||
| "defaultValue": "WindowsServer", | ||
| "metadata": { | ||
| "description": "Image Offer" | ||
| } | ||
| }, | ||
| "imageSKU": { | ||
| "type": "string", | ||
| "defaultValue": "2012-R2-Datacenter", | ||
| "metadata": { | ||
| "description": "Image SKU" | ||
| } | ||
| }, | ||
| "lbName": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can become a variable to reduce number of parameters
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the 3 image parameters to variables |
||
| "type": "string", | ||
| "defaultValue": "myLB", | ||
| "metadata": { | ||
| "description": "Load Balancer name" | ||
| } | ||
| }, | ||
| "nic1NamePrefix": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can become a variable to reduce number of parameters
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the 3 image parameters to variables |
||
| "type": "string", | ||
| "defaultValue": "nic1", | ||
| "metadata": { | ||
| "description": "Network Interface 1 name prefix" | ||
| } | ||
| }, | ||
| "nic2NamePrefix": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can become a variable to reduce number of parameters
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the nic1 and nic2 parameters to variables |
||
| "type": "string", | ||
| "defaultValue": "nic2", | ||
| "metadata": { | ||
| "description": "Network Interface 2 name prefix" | ||
| } | ||
| }, | ||
| "publicIPAddressName": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can become a variable to reduce number of parameters
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the nic1 and nic2 parameters to variables |
||
| "type": "string", | ||
| "defaultValue": "myPublicIP", | ||
| "metadata": { | ||
| "description": "Public IP Name" | ||
| } | ||
| }, | ||
| "vnetName": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can become a variable to reduce number of parameters
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the nic1 and nic2 parameters to variables |
||
| "type": "string", | ||
| "defaultValue": "myVNET", | ||
| "metadata": { | ||
| "description": "VNET name" | ||
| } | ||
| }, | ||
| "vmSize": { | ||
| "type": "string", | ||
| "defaultValue": "Standard_D1", | ||
| "metadata": { | ||
| "description": "Size of the VM" | ||
| } | ||
| } | ||
| }, | ||
| "variables": { | ||
| "storageAccountType": "Standard_LRS", | ||
| "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'))]", | ||
| "frontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]", | ||
| "lbPoolID": "[concat(variables('lbID'),'/backendAddressPools/BackendPool1')]" | ||
| }, | ||
| "resources": [ | ||
| { | ||
| "type": "Microsoft.Storage/storageAccounts", | ||
| "name": "[parameters('storageAccountName')]", | ||
| "apiVersion": "2015-05-01-preview", | ||
| "location": "[resourceGroup().location]", | ||
| "properties": { | ||
| "accountType": "[variables('storageAccountType')]" | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "type": "Microsoft.Network/publicIPAddresses", | ||
| "name": "[parameters('publicIPAddressName')]", | ||
| "location": "[resourceGroup().location]", | ||
| "properties": { | ||
| "publicIPAllocationMethod": "[variables('publicIPAddressType')]", | ||
| "dnsSettings": { | ||
| "domainNameLabel": "[parameters('dnsNameforLBIP')]" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "type": "Microsoft.Network/virtualNetworks", | ||
| "name": "[parameters('vnetName')]", | ||
| "location": "[resourceGroup().location]", | ||
| "properties": { | ||
| "addressSpace": { | ||
| "addressPrefixes": [ | ||
| "[variables('addressPrefix')]" | ||
| ] | ||
| }, | ||
| "subnets": [ | ||
| { | ||
| "name": "[variables('subnetName')]", | ||
| "properties": { | ||
| "addressPrefix": "[variables('subnetPrefix')]" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "type": "Microsoft.Network/networkInterfaces", | ||
| "name": "[parameters('nic1NamePrefix')]", | ||
| "location": "[resourceGroup().location]", | ||
| "dependsOn": [ | ||
| "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]", | ||
| "[concat('Microsoft.Network/loadBalancers/', parameters('lbName'))]" | ||
| ], | ||
| "properties": { | ||
| "ipConfigurations": [ | ||
| { | ||
| "name": "ipconfig1", | ||
| "properties": { | ||
| "privateIPAllocationMethod": "Dynamic", | ||
| "subnet": { | ||
| "id": "[variables('subnetRef')]" | ||
| }, | ||
| "loadBalancerBackendAddressPools": [ | ||
| { | ||
| "id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]" | ||
| } | ||
| ], | ||
| "loadBalancerInboundNatRules": [ | ||
| { | ||
| "id": "[concat(variables('lbID'),'/inboundNatRules/RDP-VM0')]" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "type": "Microsoft.Network/networkInterfaces", | ||
| "name": "[parameters('nic2NamePrefix')]", | ||
| "location": "[resourceGroup().location]", | ||
| "dependsOn": [ | ||
| "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]" | ||
| ], | ||
| "properties": { | ||
| "ipConfigurations": [ | ||
| { | ||
| "name": "ipconfig1", | ||
| "properties": { | ||
| "privateIPAllocationMethod": "Dynamic", | ||
| "subnet": { | ||
| "id": "[variables('subnetRef')]" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "name": "[parameters('lbName')]", | ||
| "type": "Microsoft.Network/loadBalancers", | ||
| "location": "[resourceGroup().location]", | ||
| "dependsOn": [ | ||
| "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]" | ||
| ], | ||
| "properties": { | ||
| "frontendIPConfigurations": [ | ||
| { | ||
| "name": "LoadBalancerFrontEnd", | ||
| "properties": { | ||
| "publicIPAddress": { | ||
| "id": "[variables('publicIPAddressID')]" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "backendAddressPools": [ | ||
| { | ||
| "name": "BackendPool1" | ||
| } | ||
| ], | ||
| "inboundNatRules": [ | ||
| { | ||
| "name": "RDP-VM0", | ||
| "properties": { | ||
| "frontendIPConfiguration": { | ||
| "id": "[variables('frontEndIPConfigID')]" | ||
| }, | ||
| "protocol": "tcp", | ||
| "frontendPort": 50001, | ||
| "backendPort": 3389, | ||
| "enableFloatingIP": false | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "apiVersion": "2015-05-01-preview", | ||
| "type": "Microsoft.Compute/virtualMachines", | ||
| "name": "[parameters('vmNamePrefix')]", | ||
| "location": "[resourceGroup().location]", | ||
| "dependsOn": [ | ||
| "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", | ||
| "[concat('Microsoft.Network/networkInterfaces/', parameters('nic1NamePrefix'))]", | ||
| "[concat('Microsoft.Network/networkInterfaces/', parameters('nic2NamePrefix'))]" | ||
| ], | ||
| "properties": { | ||
| "hardwareProfile": { | ||
| "vmSize": "[parameters('vmSize')]" | ||
| }, | ||
| "osProfile": { | ||
| "computername": "[parameters('vmNamePrefix')]", | ||
| "adminUsername": "[parameters('adminUsername')]", | ||
| "adminPassword": "[parameters('adminPassword')]" | ||
| }, | ||
| "storageProfile": { | ||
| "imageReference": { | ||
| "publisher": "[parameters('imagePublisher')]", | ||
| "offer": "[parameters('imageOffer')]", | ||
| "sku": "[parameters('imageSKU')]", | ||
| "version": "latest" | ||
| }, | ||
| "osDisk": { | ||
| "name": "osdisk", | ||
| "vhd": { | ||
| "uri": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/vhds/','osdisk', '.vhd')]" | ||
| }, | ||
| "caching": "ReadWrite", | ||
| "createOption": "FromImage" | ||
| } | ||
| }, | ||
| "networkProfile": { | ||
| "networkInterfaces": [ | ||
| { | ||
| "properties": { | ||
| "primary": true | ||
| }, | ||
| "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nic1NamePrefix'))]" | ||
| }, | ||
| { | ||
| "properties": { | ||
| "primary": false | ||
| }, | ||
| "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nic2NamePrefix'))]" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "itemDisplayName": "Create a VM with multiple NICs and RDP accessable", | ||
| "description": "This template allows you to create a Virtual Machines with multiple (2) network interfaces (NICs), and RDP connectable with a configured load balancer and an inbound NAT rule. More NICs can easily be added with this template. This template also deploys a Storage Account, Virtual Network, Public IP address, and 2 Network Interfaces (front-end and back-end).", | ||
| "summary": "Create a VM with multiple network interfaces and RDP accessable", | ||
| "githubUsername": "colincole", | ||
| "dateUpdated": "2015-05-26" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this a template about multi-NICs, all these image parameters can become variables so the user doesn't have to enter many parameters to get this going
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the 3 image parameters to variables