Create a Cisco CSR Router on Azure with JSON template

Source: Internet
Author: User

Azure's arm mode allows you to create VMs from templates in JSON. This article takes the image of Cisco's CSR as an example of how to create a VM with JSON.

One, the image of the Cisco CSR

First copy the image of the Cisco CSR into a storage account:

Https://xxxx.blob.core.chinacloudapi.cn/image/CSR_3_16_4aS_CCO.vhd

The VHD file that created the VM also needs to be in this storage account.

Second, get the JSON template

Find the JSON template from the user image create VM on GitHub:

Https://github.com/Azure/azure-quickstart-templates/tree/master/101-vm-from-user-image

Save Azuredeploy.json file to Local:

Https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-from-user-image/azuredeploy.json

As a D:\from_image.json file. Since global Azure disk is now prefer using management disk, the template on GitHub has been changed to the MD template.

The following is a JSON Template with an ordinary storage account:

{  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",  "ContentVersion": "1.0.0.0",  "Parameters": {    "Customvmname": {      ' Type ': ' String ',      "Metadata": {        "description": "This is the name of the Your VM"      }    },    "Userimagestorageaccountname": {      ' Type ': ' String ',      "Metadata": {        "description": "This was the name of the Your storage account"      }    },    "Userimagestorageaccountresourcegroupname": {      ' Type ': ' String ',      "Metadata": {        "description": "Resource Group of the existing storage account"      }    },    "Osdiskvhduri": {      ' Type ': ' String ',      "Metadata": {        "description": "Uri of the Your user image"      }    },    "Dnslabelprefix": {      ' Type ': ' String ',      "Metadata": {        "description": "DNS Label for the public IP." Must be lowercase. It should match with the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$ or it would raise an error. "      }    },    "Adminusername": {      ' Type ': ' String ',      "Metadata": {        "description": "User Name for the Virtual machine"      }    },    "AdminPassword": {      "Type": "SecureString",      "Metadata": {        "description": "Password for the Virtual machine"      }    },    "OsType": {      ' Type ': ' String ',      "Allowedvalues": [        "Windows",        "Linux"      ],      "Metadata": {        "description": "This was the OS that your VM would be running"      }    },    "Vmsize": {      ' Type ': ' String ',      "Metadata": {        "description": "This is the size of your VM"      }    },    "Neworexistingvnet": {      "Allowedvalues": ["New", "existing" ],      ' Type ': ' String ',      "Metadata": {        "description": "Select if this template needs a new vnet or would reference an existing VNet"      }    },    "Neworexistingvnetname": {      ' Type ': ' String ',      "DefaultValue": "",      "Metadata": {        "description": "New or Existing VNet Name"      }    },    "Neworexistingsubnetname": {      ' Type ': ' String ',      "Metadata": {        "description": "New or Existing subnet Name"      }    },    "Existingvnetresourcegroupname": {      ' Type ': ' String ',      "Metadata": {        "description": "Resource Group of the existing VNET"      }    }  },  "Variables": {    "Publicipaddressname": "[Concat (Parameters (' Customvmname '), ' IP ')]",    "VmName": "[Parameters (' Customvmname ')]",    "Nicname": "[Concat (Parameters (' Customvmname '), ' Nic ')]",    "Publicipaddresstype": "Dynamic",    "Apiversion": "2015-06-15",    "Templatelink": "[Concat (' https://raw.githubusercontent.com/singhkay/azure-quickstart-templates/master/101- vm-from-user-image/', parameters (' neworexistingvnet '), ' Vnet.json ')] "  },  "Resources": [    {            "Apiversion": "2015-01-01",            "Name": "Vnet-template",            "Type": "Microsoft.resources/deployments",            "Properties": {                "Mode": "Incremental",                "Templatelink": {                    "uri": "[Variables (' Templatelink ')]",                    "ContentVersion": "1.0.0.0"                },                "Parameters": {                    "Virtualnetworkname": {                        "Value": "[Parameters (' Neworexistingvnetname ')]"                    },                    "Subnetname": {                        "Value": "[Parameters (' Neworexistingsubnetname ')]"                    },                    "Existingvnetresourcegroupname": {                        "Value": "[Parameters (' Existingvnetresourcegroupname ')]"                    }                }            }        },    {      "Apiversion": "[Variables (' apiversion ')]",      "Type": "Microsoft.network/publicipaddresses",      "Name": "[Variables (' Publicipaddressname ')]",      "Location": "[ResourceGroup (). Location]",      "Properties": {        "Publicipallocationmethod": "[Variables (' Publicipaddresstype ')]",        "Dnssettings": {          "Domainnamelabel": "[Parameters (' Dnslabelprefix ')]"        }      }    },    {      "Apiversion": "2016-03-30",      "Type": "Microsoft.network/networkinterfaces",      "Name": "[Variables (' Nicname ')]",      "Location": "[ResourceGroup (). Location]",      "DependsOn": [        "[Concat (' microsoft.network/publicipaddresses/', variables (' Publicipaddressname ')]",        "Microsoft.resources/deployments/vnet-template"      ],      "Properties": {        "Ipconfigurations": [          {            "Name": "IPCONFIG1",            "Properties": {              "Privateipallocationmethod": "Dynamic",              "PublicIPAddress": {                "id": "[ResourceId (' microsoft.network/publicipaddresses ', variables (' Publicipaddressname ')]"              },              "Subnet": {                "id": "[Reference (' Vnet-template '). Outputs.subnet1Ref.value]"              }            }          }        ]      }    },    {      "Apiversion": "[Variables (' apiversion ')]",      "Type": "Microsoft.compute/virtualmachines",      "Name": "[Variables (' VmName ')]",      "Location": "[ResourceGroup (). Location]",      "DependsOn": [        "[Concat (' microsoft.network/networkinterfaces/', variables (' Nicname ')]"      ],      "Properties": {        "Hardwareprofile": {          "Vmsize": "[Parameters (' Vmsize ')]"        },        "Osprofile": {          "ComputerName": "[Variables (' VmName ')]",          "Adminusername": "[Parameters (' Adminusername ')]",          "AdminPassword": "[Parameters (' AdminPassword ')]"        },        "Storageprofile": {          "Osdisk": {            "Name": "[Concat (Variables (' vmName '), '-osdisk ')]",            "OsType": "[Parameters (' OsType ')]",            "Caching": "ReadWrite",            "Createoption": "FromImage",            "Image": {              "uri": "[Parameters (' Osdiskvhduri ')]"            },            "VHD": {              "uri": "[Concat (Reference (Parameters (' Userimagestorageaccountresourcegroupname '), ' microsoft.storage/ storageaccounts/', parameters (' Userimagestorageaccountname ')), variables (' apiversion ')). Primaryendpoints.blob, ' Vhds/', variables (' VmName '), Uniquestring (ResourceGroup (). id), ' osdisk.vhd ')] "            }          }        },        "Networkprofile": {          "Networkinterfaces": [            {              "id": "[ResourceId (' Microsoft.network/networkinterfaces ', variables (' Nicname ')]"            }          ]        },        "Diagnosticsprofile": {          "Bootdiagnostics": {            "Enabled": "True",            "Storageuri": "[Concat (Reference (resourceId (' Parameters '), ' microsoft.storage/storageaccounts/', parameters (' Userimagestorageaccountname ')), variables (' apiversion ')). PRIMARYENDPOINTS.BLOB)] "          }        }      }    }  ]}

Iii. creating a Cisco CSR Virtual machine from a template

1. Sign in to Azure China portal

2. Search for template in new

Click Template Deployment, as shown. It is important to note that this feature must be available in the English language version at this time.

3. Import Template

Upload the JSON template you just made.

4. Fill in the appropriate parameters

According to the actual value, fill in the corresponding parameters. It is important to note that both the resource group and the storage account are the same as the storage account where the image resides.

4. Legal Terms

Complete the relevant legal terms content:

Then click Create, and the VM is created.

IV. Login-created Cisco CSR router

Connecting to42.159.203.233: A... Connection established. To escape to local shell, press Ctrl+alt+].hengweicisco#SHrunnbuilding configuration ... Current configuration:1294bytes!! Last configuration change atTen: +: AboutUTC Mon APR -  .!version15.5Service Timestamps debug datetime msecservice timestamps log datetime MSECNO platform Punt-keepalive disable-kernel-coreplatform Console Virtual!hostnameHengweicisco!Boot-start-Markerboot-end-Marker!Logging Persistent size1000000FileSize8192Immediate!AAA New-Model!AAA AuthenticationLogindefault LOCALAAA authorization exec default local none!AAA Session-IDCommon
......

Create a Cisco CSR Router on Azure with JSON template

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.