用Json Template在Azure上创建Cisco CSR路由器
Azure的ARM模式可以通过Json的模板创建VM。本文以Cisco的CSR的image为例,介绍如何用Json的创建VM。
一、Cisco CSR的Image
首先把Cisco CSR的image复制到一个存储账户中:
https://xxxx.blob.core.chinacloudapi.cn/image/CSR_3_16_4aS_CCO.vhd
创建VM的vhd文件也需要在这个存储账户中。
二、获得Json模板
在Github上找到From user image create VM的Json模板:
https://github.com/Azure/azure-quickstart-templates/tree/master/101-vm-from-user-image
把azuredeploy.json文件保存到本地:
为d:\from_image.json文件。由于Global Azure的Disk目前已经prefer使用Management Disk了,Github上的template已经改成MD的template。
下面是采用普通存储账户的Json Template:
{
"$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 is 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 will 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 is the OS that your VM will 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 will 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(resourceId(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('userImageStorageAccountResourceGroupName'), 'Microsoft.Storage/storageAccounts/', parameters('userImageStorageAccountName')), variables('apiVersion')).primaryEndpoints.blob)]"
}
}
}
}
]
}
三、通过模板创建Cisco CSR虚拟机
1. 登录Azure China的Portal
2. 在New中搜索template
如上图所示,点击Template Deployment。这里需要注意的是,目前必须是英文版本才可以使用这个功能。
3. 导入template
把刚刚的Json Template上传。
4. 填写相应的Parameters
根据实际值,填写相应的参数。需要注意的是Resource Group和Storage Account都要和image所在的Storage Account相同。
4. Legal Terms
把Legal Terms相应的内容填写完整:
然后点击create,创建VM。
四、登录创建的Cisco CSR router
Connecting to 42.159.203.233:...
Connection established.
To escape to local shell, press Ctrl+Alt+].
hengweicisco#sh runn
Building configuration...
Current configuration : bytes
!
! Last configuration change at :: UTC Mon Apr
!
version 15.5
service timestamps debug datetime msec
service timestamps log datetime msec
no platform punt-keepalive disable-kernel-core
platform console virtual
!
hostname hengweicisco
!
boot-start-marker
boot-end-marker
!
logging persistent size filesize immediate
!
aaa new-model
!
aaa authentication login default local
aaa authorization exec default local none
!
aaa session-id common
......
用Json Template在Azure上创建Cisco CSR路由器的更多相关文章
- 使用Json Template在Azure China创建ARM类型的虚拟机
前面几篇文章介绍过Azure的两种VM的模式,包括ASM和ARM.并且介绍了如何用Azure CLI和PowerShell创建虚拟机.本文将介绍如何采用Json的Template来创建基于ARM的VM ...
- 在Azure上通过Powershell创建多Interface的Cisco CSR路由器
前面通过Json的Template在Azure上创建了Cisco的CSR路由器.但那个Json的template只支持1块网卡.如果需要多网卡的Cisco CSR路由器,可以改上篇文章中提到的Json ...
- (视频) 《快速创建网站》2.1 在Azure上创建网站及网站运行机制
现在让我们开始一天的建站之旅. 本文是<快速创建网站>系列的第2篇,如果你还没有看过之前的内容,建议你点击以下目录中的章节先阅读其他内容再回到本文. 访问本系列目录,请点击:http:// ...
- (视频)《快速创建网站》2.1 在Azure上创建网站及网站运行机制
现在让我们开始一天的建站之旅. 本文是<快速创建网站>系列的第2篇,如果你还没有看过之前的内容,建议你点击以下目录中的章节先阅读其他内容再回到本文. 1. 网站管理平台WordPress和 ...
- 在Windows Azure上创建ASP.NET MVC网站
本篇体验在Windows Azure上创建ASP.NET MVC网站. →登录到Windows Azure管理门户 →点击左下方的"新建" →点击"自定义创建" ...
- 如何在Azure上创建和部署云服务
Azure 管理门户提供两种方法可用来创建和部署一个云服务:快速创建和自定义创建. 本主题说明如何使用快速创建方法来创建新的云服务,然后使用上传来上载和部署一套在 Azure 的云服务.当您使用此方法 ...
- 在 Azure 上创建和链接 MySQL 数据库
本快速入门介绍了如何使用 Azure 门户创建并连接 MySQL 数据库.在本教程中完成的所有操作均符合 1 元试用条件. 开始之前如果您还没有 Azure 账户,可以申请 1 元试用账户 步骤1:创 ...
- 在 Azure 上创建和链接 Azure SQL 数据库
本快速入门介绍了如何在 Azure 门户中创建并连接 Azure SQL 数据库.在本教程中完成的所有操作均符合 1 元试用条件. 开始之前 如果您还没有 Azure 账户,可以申请 1 元试用账户. ...
- Azure上采用Json Template从已有的VHD创建VM
从已有的VHD创建VM是使用Azure中经常要操作的内容. 本文将介绍如何采用Json Template从已经有的VHD创建VM. 一.准备VHD 在我的Azure账户中选择一台VM,如下图: 查看其 ...
随机推荐
- HA 脑裂原理
HA 脑裂原理 “裂脑”,乃一个形象的术语,系HA系统危机情景. 引子:“裂脑”是治疗“癫痫”病的一种手术.医生们认为癫痫病发作是由于大脑“异常放电”所至.为了阻止“异常放电”波及整个大脑(左.右半脑 ...
- verilog中一些基本的门电路如pmos和nmos等
最近在分析波形的时候,发现某个PAD模型的行为与想象的不一致,就进入stdcell里面看了下,主要是pmos和nmos相关的东西,暂列如下: 开关级基元14种 是实际的MOS关的抽象表示,分电阻型(前 ...
- 20145230 《Java程序设计》第8周学习总结
20145230 <Java程序设计>第8周学习总结 教材学习内容 NIO与NIO2 NIO使用频道(Channel)来衔接数据节点,在处理数据时,NIO可以设定缓冲区(Buffer)容量 ...
- 什么是make config,make menuconfig,make oldconfig,make xconfig,make defconfig,make gconfig?【转】
本文转载自;https://blog.csdn.net/baweiyaoji/article/details/52876701 在进行内核配置,或者是对一些软件的配置和编译中,常常会遇到: make ...
- Centos7.4 Nginx反向代理+负载均衡配置
Ningx是一款高性能的HTTP和反向代理服务器,配置起来也比较简单. 测试环境: 172.16.65.190 Nginx-反向代理 172.16.65.191 Ningx-Web 172.16.65 ...
- 字符串处理sdut 2411
题目:http://www.sdutacm.org/sdutoj/problem.php?action=showproblem&problemid=2411 关于字符串处理的题,此题坑点很多w ...
- PAT1022. Digital Library (30)
两个坑. 一个是一直用的malloc不行了.因为malloc分配的是固定大小,之前做的题没遇到过是因为一般string都不长(malloc分配string为24个Byte),这次直接报段错误,呢们了半 ...
- QT 使用QPainter 绘制图形 和 世界变换 world transform
1. 绘制椭圆 饼状型 贝塞尔曲线 绘制图像重写方法 void paintEvent(QPaintEvent *event)即可. void Widget::paintEvent(QPaintEve ...
- shell学习之杂项
? 表示任意一个字符. > 重写 >> 追加 &> 将错误信息一并写入 Ctrl+Z 暂停 fg 恢复 jobs 查看所有已暂停任务 bg 丢到后台 env 查看系统环 ...
- CSDN_博客__WapPc
CSDN 博客 手机上的网址 和 PC上的网址,对应关系: 1. 举个例子: 手机上的网址: http://m.blog.csdn.net/article/details?id=7910239 PC ...