当前位置: 首页 > news >正文

在线做java题目的网站/网站定制开发

在线做java题目的网站,网站定制开发,建设投资基金管理有限公司网站,镇江市丹徒区疫情最新消息前面几篇文章介绍过Azure的两种VM的模式,包括ASM和ARM。并且介绍了如何用Azure CLI和PowerShell创建虚拟机。本文将介绍如何采用Json的Template来创建基于ARM的VM。 当然采用Json Template的方式创建虚拟机是几种方式中最好的,这样可以便于批量部署、Jso…

前面几篇文章介绍过Azure的两种VM的模式,包括ASM和ARM。并且介绍了如何用Azure CLI和PowerShell创建虚拟机。本文将介绍如何采用Json的Template来创建基于ARM的VM。

当然采用Json Template的方式创建虚拟机是几种方式中最好的,这样可以便于批量部署、Json文件可以重用。

ARM的Template的格式采用的是Json的格式。其需要的几个部分如下:

需要定义的有:parameters,variables,resources和outputs。但只有resources是必须的。

由于Template的内容比较复杂,一般都采用复制已有的Template Jason文件修改的方式。

目前,在Github上有大量的Azure ARM Jason Template,可以下载修改使用。

具体的网址在:

https://github.com/Azure/azure-quickstart-templates

比如我们要创建一台CentOS 6.5的Linux虚拟机。在上面的链接中,没有相应的template。我们通过一台Ubuntu的Template进行修改。

首先下载两个Jason文件:

https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-linux/azuredeploy.json

https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-linux/azuredeploy.parameters.json

第一个文件是部署文件,第二个文件是参数文件。

我们首先看部署文件:

一、修改parameter中的内容

1 把Ubuntu版本改成CentOS版本:

    "ubuntuOSVersion": {"type": "string","defaultValue": "14.04.2-LTS","allowedValues": ["12.04.5-LTS","14.04.2-LTS","15.10"],

 

改成

    "CentOSVersion": {"type": "string","defaultValue": "6.5","allowedValues": ["6.5","6.6","7.0","7.1"],

 

2 把metadata的描述更改

"metadata": {"description": "The Ubuntu version for the VM. This will pick a fully patched image of this given Ubuntu version. Allowed values: 12.04.5-LTS, 14.04.2-LTS, 15.10."
}

 

改为:

"metadata": {"description": "The CentOS version for the VM. This will pick a fully patched image of this given CentOS version. Allowed values: 6.5, 6.6, 7.0, 7.1."
}

 

二、修改variables中的内容

原始的变量定义如下:

  "variables": {"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]","dataDisk1VhdName": "datadisk1","imagePublisher": "Canonical","imageOffer": "UbuntuServer","OSDiskName": "osdiskforlinuxsimple","nicName": "myVMNic","addressPrefix": "10.0.0.0/16","subnetName": "Subnet","subnetPrefix": "10.0.0.0/24","storageAccountType": "Standard_LRS","publicIPAddressName": "myPublicIP","publicIPAddressType": "Dynamic","vmStorageAccountContainerName": "vhds","vmName": "MyUbuntuVM","vmSize": "Standard_D1","virtualNetworkName": "MyVNET","vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]","subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]","apiVersion": "2015-06-15"},

 

更改为:

  "variables": {"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]","dataDisk1VhdName": "datadisk1","imagePublisher": "OpenLogic","imageOffer": "CentOS","OSDiskName": "osdiskforlinuxsimple","nicName": "myVMNic","addressPrefix": "10.0.0.0/16","subnetName": "Subnet","subnetPrefix": "10.0.0.0/24","storageAccountType": "Standard_LRS","publicIPAddressName": "myPublicIP","publicIPAddressType": "Dynamic","vmStorageAccountContainerName": "vhds","vmName": "MyCentOSVM","vmSize": "Standard_A1","virtualNetworkName": "MyVNET","vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]","subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]","apiVersion": "2015-06-15"},

 

修改完部署文件后,修改参数文件:

参数文件如下:

{"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#","contentVersion": "1.0.0.0","parameters": {"adminUsername": {"value": "azureUser"},"adminPassword": {"value": "GEN-PASSWORD"},"dnsLabelPrefix": {"value": "GEN-UNIQUE"},"ubuntuOSVersion": {"value": "14.04.2-LTS"}}
}

 

更改为:

{"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#","contentVersion": "1.0.0.0","parameters": {"adminUsername": {"value": "hengwei"},"adminPassword": {"value": "abc@123456"},"dnsLabelPrefix": {"value": "hwvm"},"CentOSVersion": {"value": "6.5"}}
}

 

 

并把两个文件上传到Github上,链接如下:

https://raw.githubusercontent.com/hengv/Hengwei/Azure/101-simple-linux/azuredeploy.json

https://raw.githubusercontent.com/hengv/Hengwei/Azure/101-simple-linux/azuredeploy.parameters.json

下面可以通过PowerShell命令通过Jason Template创建VM了:

New-AzureRmResourceGroup -Name hw01 -Location chinaeast

ResourceGroupName : hw01
Location          : chinaeast
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/xxxxxxxx/resourceGroups/hw01 
New-AzureRmResourceGroupDeployment -Name hwvm01 -ResourceGroupName hw01 -TemplateUri https://raw.githubusercontent.com/hengv/Hengwei/Azure/101-simple-linux/azuredeploy.json -TemplateParameterUri https://raw.githubusercontent.com/hengv/Hengwei/Azure/101-simple-linux/azuredeploy.parameters.json -Mode Incremental

DeploymentName          : hwvm01
ResourceGroupName       : hw01
ProvisioningState       : Succeeded
Timestamp               : 2016/7/1 14:09:58
Mode                    : Incremental
TemplateLink            : Uri            : https://raw.githubusercontent.com/hengv/Hengwei/Azure/101-simple-linux/azuredeploy.jsonContentVersion : 1.0.0.0Parameters              : Name             Type                       Value     ===============  =========================  ==========adminUsername    String                     hengwei   adminPassword    SecureString                         dnsLabelPrefix   String                     hwvm      centOSVersion    String                     6.5       Outputs                 : Name             Type                       Value     ===============  =========================  ==========hostname         String                     hwvm.chinaeast.cloudapp.azure.comsshCommand       String                     ssh hengwei@hwvm.chinaeast.cloudapp.azure.comDeploymentDebugLogLevel : 

 

创建成功。

再通过下面的命令查看:

get-azurermvmRequestId                         : afe8fb47-4e2f-434f-aa40-4d230a549598
StatusCode                        : OK
ResourceGroupName                 : HW01
Id                                : /subscriptions/xxxxxxxx/resourceGroups/HW01/providers/Microsoft.Compute/virtualMachines/MyCentOSVM
Name                              : MyCentOSVM
Type                              : Microsoft.Rest.Azure.AzureOperationResponse`1[Microsoft.Rest.Azure.IPage`1[Microsoft.Azure.Management.Compute.Models.VirtualMachine]]
Location                          : chinaeast
Tags                              : {}
DiagnosticsProfile                : BootDiagnostics                 : Enabled                       : TrueStorageUri                    : https://eyyvnizdwsddusalinuxvm.blob.core.chinacloudapi.cn/
HardwareProfile                   : VmSize                          : Standard_A1
NetworkProfile                    : NetworkInterfaces[0]            : Id                            : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic
OSProfile                         : ComputerName                    : MyCentOSVMAdminUsername                   : hengweiLinuxConfiguration              : DisablePasswordAuthentication : False
ProvisioningState                 : Succeeded
StorageProfile                    : ImageReference                  : Publisher                     : OpenLogicOffer                         : CentOSSku                           : 6.5Version                       : latestOsDisk                          : OsType                        : LinuxName                          : osdiskVhd                           : Uri                         : https://eyyvnizdwsddusalinuxvm.blob.core.chinacloudapi.cn/vhds/osdiskforlinuxsimple.vhdCaching                       : ReadWriteCreateOption                  : FromImageDataDisks[0]                    : Lun                           : 0Name                          : datadisk1Vhd                           : Uri                         : https://eyyvnizdwsddusalinuxvm.blob.core.chinacloudapi.cn/vhds/datadisk1.vhdCaching                       : NoneCreateOption                  : EmptyDiskSizeGB                    : 100
DataDiskNames[0]                  : datadisk1
NetworkInterfaceIDs[0]            : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic 
Get-AzureRmNetworkInterfaceName                 : myVMNic
ResourceGroupName    : hw01
Location             : chinaeast
Id                   : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic
Etag                 : W/"1e379401-4980-42c6-ba83-9e26f19133bd"
ResourceGuid         : c4e50ac6-fdb1-416c-a5b2-d71baace6b55
ProvisioningState    : Succeeded
Tags                 : 
VirtualMachine       : {"Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Compute/virtualMachines/MyCentOSVM"}
IpConfigurations     : [{"Name": "ipconfig1","Etag": "W/\"1e379401-4980-42c6-ba83-9e26f19133bd\"","Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic/ipConfigurations/ipconfig1","PrivateIpAddress": "10.0.0.4","PrivateIpAllocationMethod": "Dynamic","Subnet": {"Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/virtualNetworks/MyVNET/subnets/Subnet"},"PublicIpAddress": {"Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/publicIPAddresses/myPublicIP"},"ProvisioningState": "Succeeded","LoadBalancerBackendAddressPools": [],"LoadBalancerInboundNatRules": [],"ApplicationGatewayBackendAddressPools": []}]
DnsSettings          : {"DnsServers": [],"AppliedDnsServers": []}
EnableIPForwarding   : False
NetworkSecurityGroup : null
Primary              : True 
Get-AzureRmPublicIpAddressName                     : myPublicIP
ResourceGroupName        : hw01
Location                 : chinaeast
Id                       : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/publicIPAddresses/myPublicIP
Etag                     : W/"0d4e57f8-25a1-4bf7-bec9-e98785ed8179"
ResourceGuid             : f8216ff0-06a6-478b-8270-f18fc717c0f7
ProvisioningState        : Succeeded
Tags                     : 
PublicIpAllocationMethod : Dynamic
IpAddress                : 42.159.235.75
IdleTimeoutInMinutes     : 4
IpConfiguration          : {"Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic/ipConfigurations/ipconfig1"}
DnsSettings              : {"DomainNameLabel": "hwvm","Fqdn": "hwvm.chinaeast.cloudapp.chinacloudapi.cn" 

 

Get-AzureRmVirtualNetworkName              : MyVNET
ResourceGroupName : hw01
Location          : chinaeast
Id                : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/virtualNetworks/MyVNET
Etag              : W/"888d8b21-091b-4f40-b2ba-284f16c0f641"
ResourceGuid      : a69ef02a-728e-4212-8c2a-7a7c0f4bb881
ProvisioningState : Succeeded
Tags              : 
AddressSpace      : {"AddressPrefixes": ["10.0.0.0/16"]}
DhcpOptions       : null
Subnets           : [{"Name": "Subnet","Etag": "W/\"888d8b21-091b-4f40-b2ba-284f16c0f641\"","Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/virtualNetworks/MyVNET/subnets/Subnet","AddressPrefix": "10.0.0.0/24","IpConfigurations": [{"Id": "/subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Network/networkInterfaces/myVMNic/ipConfigurations/ipconfig1"}],"ProvisioningState": "Succeeded"}] 
Get-AzureRmStorageAccountResourceGroupName   : hw01
StorageAccountName  : eyyvnizdwsddusalinuxvm
Id                  : /subscriptions/xxxxxxxx/resourceGroups/hw01/providers/Microsoft.Storage/storageAccounts/eyyvnizdwsddusalinuxvm
Location            : chinaeast
Sku                 : Microsoft.Azure.Management.Storage.Models.Sku
Kind                : Storage
Encryption          : 
AccessTier          : 
CreationTime        : 2016/7/1 14:07:14
CustomDomain        : 
LastGeoFailoverTime : 
PrimaryEndpoints    : Microsoft.Azure.Management.Storage.Models.Endpoints
PrimaryLocation     : chinaeast
ProvisioningState   : Succeeded
SecondaryEndpoints  : 
SecondaryLocation   : 
StatusOfPrimary     : Available
StatusOfSecondary   : 
Tags                : {}
Context             : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext 

 

转载于:https://www.cnblogs.com/hengwei/p/5634380.html

http://www.lbrq.cn/news/1089541.html

相关文章:

  • 网络建设方案怎么做/惠州seo网站排名
  • 盖州网站建设/社群营销平台有哪些
  • 做网站买什么香港服务器吗/百度竞价托管外包代运营
  • 如何做淘宝客有没有免费的网站/制作企业网站
  • 深圳餐饮网站设计/制作网站要花多少钱
  • 下城区做网站/页面优化的方法
  • 福田网站建设信科网络/网络媒体软文案例
  • 两个域名指向同一个网站怎么做/怎么查百度竞价关键词价格
  • wordpress淘客宝主题/鄞州seo服务
  • 做网站别人输账号代码/免费外链发布平台
  • 公安局网站备案流程/线上营销
  • 秦皇岛建网站多少钱/重庆seo推广外包
  • 承德住房和城乡建设局网站关闭了/seo常用工具
  • 提供微网站制作电话/论坛如何做seo
  • 淘宝网购物/seo关键字排名优化
  • 阿里巴巴网站上面产品描述一般怎么做的/数据统计网站
  • 网站开发关于安全问题/优化师培训机构
  • 做网店在素材网站找的图侵权吗/全网营销
  • 长春 网站建设网络推广网页设计/windows10优化工具
  • 网站规划与建设的案例分析/今日刚刚发生的国际新闻
  • 有没有专门做外贸的网站/百度推广代理
  • 海南住房建设厅定额网站/网络网站推广优化
  • 网络营销策划总结/杭州网站优化推荐
  • 厦门建设局怎么进/湖南seo优化价格
  • 用divid做网站代码/手机怎么创建网站
  • 做网站必须要有数据库/太原关键词优化服务
  • 做网站开发多少钱/免费创建属于自己的网站
  • javaee做网站建设/长沙快速排名优化
  • 网站建设售后完善/seo网站关键词优化快速官网
  • 微信开发公众平台公司/seo薪资水平
  • AWD的攻击和防御手段
  • flink查看taskManager日志
  • 2025中国GEO优化白皮书:AI搜索优化趋势+行业数据报告
  • 2025年02月11日 Go生态洞察:Go 1.24 发布亮点全面剖析
  • 【Spring WebFlux】为什么 Spring 要拥抱响应式
  • 【RDMA】Adapters PRM Mellanox Adapters Programmer’s Reference mellanox网卡编程手册0.52