Created
February 3, 2016 03:22
-
-
Save stmps/db75dc1b364410faf9e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "location": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "Deployment location" | |
| } | |
| }, | |
| "virtualNetworkName": { | |
| "type": "string", | |
| "defaultValue": "CSR_Network", | |
| "metadata": { | |
| "description": "VNet name" | |
| } | |
| }, | |
| "virtualNetworkExistingRGName": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Identifies whether to use new or existing Storage Account" | |
| } | |
| }, | |
| "virtualNetworkAddressPrefix": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Virtual Network Address prefix" | |
| } | |
| }, | |
| "vnetNewOrExisting": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Identifies whether to use new or existing Virtual Network" | |
| } | |
| }, | |
| "Subnet1Prefix": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Subnet 1 Prefix" | |
| } | |
| }, | |
| "Subnet1Name": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Subnet 1 Name" | |
| } | |
| }, | |
| "subnet1StartAddress": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "Subnet 1 Starting IP Address" | |
| } | |
| }, | |
| "Subnet2Prefix": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Subnet 2 Prefix" | |
| } | |
| }, | |
| "Subnet2Name": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Subnet 2 Name" | |
| } | |
| }, | |
| "subnet2StartAddress": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "Subnet 1 Starting IP Address" | |
| } | |
| }, | |
| "adminUsername": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Username for the Virtual Machine." | |
| } | |
| }, | |
| "adminPassword": { | |
| "type": "securestring", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Password for the Virtual Machine." | |
| } | |
| }, | |
| "sshPublicKey": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "SSH Key for the virtual machines" | |
| } | |
| }, | |
| "authenticationType": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "allowedValues": [ | |
| "password", | |
| "sshPublicKey" | |
| ], | |
| "metadata": { | |
| "description": "Authentication Type to chose for the Virtual Machines" | |
| } | |
| }, | |
| "vmName": { | |
| "type": "string", | |
| "defaultValue": "CSR", | |
| "metadata": { | |
| "description": "Name for the Virtual Machine." | |
| } | |
| }, | |
| "newStorageAccountName": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "Unique Name for Storage Account where the Virtual Machine's disks will be placed." | |
| } | |
| }, | |
| "storageAccountType": { | |
| "type": "string", | |
| "defaultValue": "Standard_LRS", | |
| "allowedValues": [ | |
| "Standard_LRS" | |
| ], | |
| "metadata": { | |
| "description": "The type of storage account created." | |
| } | |
| }, | |
| "storageAccountNewOrExisting": { | |
| "type": "string", | |
| "defaultValue": "new", | |
| "allowedValues": [ | |
| "new", | |
| "existing" | |
| ], | |
| "metadata": { | |
| "description": "Identifies whether to use new or existing Storage Account" | |
| } | |
| }, | |
| "storageAccountExistingRG": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Resource Group containing existing storage account" | |
| } | |
| }, | |
| "publicIPAddressName": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Name of the Public IP Address" | |
| } | |
| }, | |
| "publicIPDnsName": { | |
| "type": "string", | |
| "defaultValue": "csrdns", | |
| "metadata": { | |
| "description": "Unique DNS Prefix for the Public IP used to access the Virtual Machine." | |
| } | |
| }, | |
| "publicIPNewOrExisting": { | |
| "type": "string", | |
| "defaultValue": "new", | |
| "allowedValues": [ | |
| "new", | |
| "existing" | |
| ], | |
| "metadata": { | |
| "description": "Indicates whether the Public IP is new or existing" | |
| } | |
| }, | |
| "publicIPExistingRGName": { | |
| "type": "string", | |
| "defaultValue": "", | |
| "metadata": { | |
| "description": "Resource Group containing existing public IP" | |
| } | |
| }, | |
| "baseUrl": { | |
| "type": "string", | |
| "metadata": { | |
| "artifactsBaseUrl": "", | |
| "description": "URL to acquire other templates" | |
| }, | |
| "defaultValue": "https://gallery.azure.com/artifact/20151001/cisco.cisco-csr-basic-templatecsr-azure-byol-two-nic.1.0.3/Artifacts" | |
| }, | |
| "vmSize": { | |
| "type": "string", | |
| "defaultValue": "Standard_D2", | |
| "allowedValues": [ | |
| "Standard_D2" | |
| ], | |
| "metadata": { | |
| "description": "Size of the Virtual Machine" | |
| } | |
| } | |
| }, | |
| "variables": { | |
| "imagePublisher": "cisco", | |
| "imageOffer": "cisco-csr-1000v", | |
| "imageSKU": "csr-azure-byol", | |
| "OSDiskName": "[concat(parameters('vmName'),'-disk')]", | |
| "vmStorageAccountContainerName": "vhds", | |
| "vnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", | |
| "subnet1Ref": "[concat(variables('vnetID'),'/subnets/', parameters('Subnet1Name'))]", | |
| "subnet2Ref": "[concat(variables('vnetID'),'/subnets/', parameters('Subnet2Name'))]", | |
| "nsgname": "[concat(parameters('vmName'),'-SSH-SecurityGroup')]", | |
| "apiVer": "2015-06-15", | |
| "publicIPAddressType": "Dynamic", | |
| "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", | |
| "storageAccountSetupURL": "[concat(parameters('baseUrl'),'/storageAccount-',parameters('storageAccountNewOrExisting'),'.json')]", | |
| "publicIPSetupURL": "[concat(parameters('baseUrl'),'/publicip-',parameters('publicIPNewOrExisting'),'.json')]", | |
| "virtualNetworkSetupURL": "[concat(parameters('baseUrl'),'/vnet-',parameters('vnetNewOrExisting'),'.json')]", | |
| "osProfile": "[variables(concat('osprofile',parameters('authenticationType')))]", | |
| "osProfilesshPublicKey": { | |
| "computername": "[parameters('vmName')]", | |
| "adminUsername": "[parameters('adminUsername')]", | |
| "linuxConfiguration": { | |
| "disablePasswordAuthentication": "true", | |
| "ssh": { | |
| "publicKeys": [ | |
| { | |
| "path": "[variables('sshKeyPath')]", | |
| "keyData": "[parameters('sshPublicKey')]" | |
| } | |
| ] | |
| } | |
| } | |
| }, | |
| "osProfilepassword": { | |
| "computername": "[parameters('vmName')]", | |
| "adminUsername": "[parameters('adminUsername')]", | |
| "adminPassword": "[parameters('adminPassword')]" | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "name": "SettingUpStorageAccount", | |
| "type": "Microsoft.Resources/deployments", | |
| "apiVersion": "2015-01-01", | |
| "properties": { | |
| "mode": "Incremental", | |
| "templateLink": { | |
| "uri": "[variables('storageAccountSetupURL')]", | |
| "contentVersion": "1.0.0.0" | |
| }, | |
| "parameters": { | |
| "location": { | |
| "value": "[parameters('location')]" | |
| }, | |
| "storageAccountType": { | |
| "value": "[parameters('storageAccountType')]" | |
| }, | |
| "storageAccountName": { | |
| "value": "[parameters('newStorageAccountName')]" | |
| }, | |
| "storageAccountExistingRG": { | |
| "value": "[parameters('storageAccountExistingRG')]" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "[variables('apiVer')]", | |
| "type": "Microsoft.Network/publicIPAddresses", | |
| "name": "[parameters('publicIPAddressName')]", | |
| "location": "[parameters('location')]", | |
| "properties": { | |
| "publicIPAllocationMethod": "Dynamic", | |
| "dnsRecord": { | |
| "fqdn": "[parameters('publicIPDnsName')]" | |
| } | |
| } | |
| }, | |
| { | |
| "name": "SettingUpPublicIP", | |
| "type": "Microsoft.Resources/deployments", | |
| "apiVersion": "2015-01-01", | |
| "properties": { | |
| "mode": "Incremental", | |
| "templateLink": { | |
| "uri": "[variables('publicIPSetupURL')]", | |
| "contentVersion": "1.0.0.0" | |
| }, | |
| "parameters": { | |
| "location": { | |
| "value": "[parameters('location')]" | |
| }, | |
| "publicIPAddressName": { | |
| "value": "[parameters('publicIPAddressName')]" | |
| }, | |
| "publicIPAddressType": { | |
| "value": "[variables('publicIPAddressType')]" | |
| }, | |
| "publicIPNewOrExisting": { | |
| "value": "[parameters('publicIPNewOrExisting')]" | |
| }, | |
| "dnsPrefix": { | |
| "value": "[parameters('publicIPDnsName')]" | |
| }, | |
| "publicIpRGName": { | |
| "value": "[parameters('publicIPExistingRGName')]" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "[variables('apiVer')]", | |
| "type": "Microsoft.Network/networkSecurityGroups", | |
| "name": "[concat(parameters('vmName'),'-SSH-SecurityGroup')]", | |
| "location": "[parameters('location')]", | |
| "properties": { | |
| "securityRules": [ | |
| { | |
| "name": "SSH-Rule", | |
| "properties": { | |
| "description": "Allow SSH", | |
| "protocol": "Tcp", | |
| "sourcePortRange": "*", | |
| "destinationPortRange": "22", | |
| "sourceAddressPrefix": "Internet", | |
| "destinationAddressPrefix": "*", | |
| "access": "Allow", | |
| "priority": 100, | |
| "direction": "Inbound" | |
| } | |
| }, | |
| { | |
| "name": "UDP-Rule1", | |
| "properties": { | |
| "description": "Allow UDP", | |
| "protocol": "UDP", | |
| "sourcePortRange": "*", | |
| "destinationPortRange": "500", | |
| "sourceAddressPrefix": "Internet", | |
| "destinationAddressPrefix": "*", | |
| "access": "Allow", | |
| "priority": 101, | |
| "direction": "Inbound" | |
| } | |
| }, | |
| { | |
| "name": "UDP-Rule2", | |
| "properties": { | |
| "description": "Allow UDP", | |
| "protocol": "UDP", | |
| "sourcePortRange": "*", | |
| "destinationPortRange": "4500", | |
| "sourceAddressPrefix": "Internet", | |
| "destinationAddressPrefix": "*", | |
| "access": "Allow", | |
| "priority": 102, | |
| "direction": "Inbound" | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "name": "SettingUpVirtualNetwork", | |
| "type": "Microsoft.Resources/deployments", | |
| "apiVersion": "2015-01-01", | |
| "dependsOn": [ | |
| "[concat('Microsoft.Network/routeTables/', parameters('Subnet1Name'),'-CSR-RouteTable')]", | |
| "[concat('Microsoft.Network/routeTables/', parameters('Subnet2Name'),'-CSR-RouteTable')]" | |
| ], | |
| "properties": { | |
| "mode": "Incremental", | |
| "templateLink": { | |
| "uri": "[variables('virtualNetworkSetupURL')]", | |
| "contentVersion": "1.0.0.0" | |
| }, | |
| "parameters": { | |
| "virtualNetworkName": { | |
| "value": "[parameters('virtualNetworkName')]" | |
| }, | |
| "location": { | |
| "value": "[parameters('location')]" | |
| }, | |
| "virtualNetworkAddressPrefix": { | |
| "value": "[parameters('virtualNetworkAddressPrefix')]" | |
| }, | |
| "Subnet1Name": { | |
| "value": "[parameters('Subnet1Name')]" | |
| }, | |
| "Subnet1Prefix": { | |
| "value": "[parameters('Subnet1Prefix')]" | |
| }, | |
| "Subnet2Name": { | |
| "value": "[parameters('Subnet2Name')]" | |
| }, | |
| "Subnet2Prefix": { | |
| "value": "[parameters('Subnet2Prefix')]" | |
| }, | |
| "vnetExistingRGName": { | |
| "value": "[parameters('virtualNetworkExistingRGName')]" | |
| }, | |
| "routeTable1Name": { | |
| "value": "[concat(parameters('Subnet1Name'),'-CSR-RouteTable')]" | |
| }, | |
| "routeTable2Name": { | |
| "value": "[concat(parameters('Subnet2Name'),'-CSR-RouteTable')]" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Network/routeTables", | |
| "name": "[concat(parameters('Subnet1Name'),'-CSR-RouteTable')]", | |
| "apiVersion": "[variables('apiVer')]", | |
| "location": "[parameters('location')]", | |
| "properties": { | |
| "routes": [ | |
| { | |
| "name": "Route-Subnet2-To-CSR", | |
| "properties": { | |
| "addressPrefix": "[parameters('Subnet2Prefix')]", | |
| "nextHopType": "VirtualAppliance", | |
| "nextHopIpAddress": "[parameters('subnet1StartAddress')]" | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Network/routeTables", | |
| "name": "[concat(parameters('Subnet2Name'),'-CSR-RouteTable')]", | |
| "apiVersion": "[variables('apiVer')]", | |
| "location": "[parameters('location')]", | |
| "properties": { | |
| "routes": [ | |
| { | |
| "name": "Route-Subnet1-To-CSR", | |
| "properties": { | |
| "addressPrefix": "[parameters('Subnet1Prefix')]", | |
| "nextHopType": "VirtualAppliance", | |
| "nextHopIpAddress": "[parameters('subnet2StartAddress')]" | |
| } | |
| }, | |
| { | |
| "name": "Default-Route-To-CSR", | |
| "properties": { | |
| "addressPrefix": "0.0.0.0/0", | |
| "nextHopType": "VirtualAppliance", | |
| "nextHopIpAddress": "[parameters('subnet2StartAddress')]" | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "apiVersion": "[variables('apiVer')]", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "name": "[concat(parameters('vmName'),'-Nic0')]", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "[concat('Microsoft.Resources/deployments/', 'SettingUpVirtualNetwork')]", | |
| "[concat('Microsoft.Network/networkSecurityGroups/',variables('nsgname'))]", | |
| "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]" | |
| ], | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "ipconfig1", | |
| "properties": { | |
| "privateIPAllocationMethod": "Static", | |
| "privateIPAddress": "[parameters('subnet1StartAddress')]", | |
| "subnet": { | |
| "id": "[reference('Microsoft.Resources/deployments/SettingUpVirtualNetwork', '2015-01-01').outputs.subnet1Ref.value]" | |
| }, | |
| "publicIPAddress": { | |
| "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]" | |
| } | |
| } | |
| } | |
| ], | |
| "networkSecurityGroup": { | |
| "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgname'))]" | |
| }, | |
| "enableIPForwarding": true | |
| } | |
| }, | |
| { | |
| "apiVersion": "[variables('apiVer')]", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "name": "[concat(parameters('vmName'),'-Nic1')]", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "[concat('Microsoft.Resources/deployments/', 'SettingUpVirtualNetwork')]" | |
| ], | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "ipconfig1", | |
| "properties": { | |
| "privateIPAllocationMethod": "Static", | |
| "privateIPAddress": "[parameters('subnet2StartAddress')]", | |
| "subnet": { | |
| "id": "[reference('Microsoft.Resources/deployments/SettingUpVirtualNetwork', '2015-01-01').outputs.subnet2Ref.value]" | |
| } | |
| } | |
| } | |
| ], | |
| "enableIPForwarding": true | |
| } | |
| }, | |
| { | |
| "apiVersion": "[variables('apiVer')]", | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "name": "[parameters('vmName')]", | |
| "location": "[parameters('location')]", | |
| "plan": { | |
| "name": "csr-azure-byol", | |
| "publisher": "cisco", | |
| "product": "cisco-csr-1000v" | |
| }, | |
| "dependsOn": [ | |
| "[concat('Microsoft.Resources/deployments/', 'SettingUpStorageAccount')]", | |
| "[concat('Microsoft.Network/networkInterfaces/',parameters('vmName'),'-Nic0')]", | |
| "[concat('Microsoft.Network/networkInterfaces/',parameters('vmName'),'-Nic1')]" | |
| ], | |
| "properties": { | |
| "hardwareProfile": { | |
| "vmSize": "[parameters('vmSize')]" | |
| }, | |
| "osProfile": "[variables('osProfile')]", | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[variables('imagePublisher')]", | |
| "offer": "[variables('imageOffer')]", | |
| "sku": "[variables('imageSKU')]", | |
| "version": "latest" | |
| }, | |
| "osDisk": { | |
| "name": "[variables('OSDiskName')]", | |
| "vhd": { | |
| "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds/', variables('OSDiskName'), '.vhd')]" | |
| }, | |
| "caching": "ReadWrite", | |
| "createOption": "FromImage" | |
| } | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "properties": { | |
| "primary": true | |
| }, | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'),'-Nic0'))]" | |
| }, | |
| { | |
| "properties": { | |
| "primary": false | |
| }, | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'),'-Nic1'))]" | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": "true", | |
| "storageUri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net')]" | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment