Azure创建隐藏版本VM实例

这两天有童鞋抓狂的问之前在Azure Resource Manager Portal上还有Centos 7.1实例,怎么突然就下架啦。这可怎么办,别着急看了下面的介绍,一切就都妥了。

NOTE:本文下述内容均以AZURE CLI 1.0为例,同理在AZURE Power Shell中,以及通过resource template也可以实现相同效果。

在azure.cn小伙伴们可以容易查看目前azure中国区所支持的Linux版本:https://www.azure.cn/documentation/articles/virtual-machines-linux-list/。童鞋们会发现Centos在主页上列出的支持版本有6.8,7.2,7.3,没有7.1的支持及其他6.X版本没有的节奏啊。难不成只能去自己Build镜像来搞啦?其实是有办法的,让我们来看一下。

1. 通过Azure CLI登陆Azure

azure login -u username -p password

2. 扒一扒Azure支持哪些镜像

Azure的镜像命名及分类按照如下规则,发行商(Publisher),产品名称(Offer),产品ID(SKU),产品版本信息(Version),产品唯一资源标识(Urn)。那么如何获得这些信息呢?

获取发行商列表:azure vm image list-publishers --location chinanorth

获取XX发行商产品名称列表:azure vm image list-offers --publisher Openlogic --location chinanorth

获取XX发行商XX产品名称产品ID列表:azure vm image list-skus --publisher Openlogic --offer Centos --location chinanorth

获取XX发行商XX产品名称XX产品ID Image列表:azure vm image list --publisher OpenLogic --offer Centos --sku 7.1 --location chinanorth

原理搞清楚了,那我们扒扒看

azure vm image list-publishers --location chinanorth

root@MININT-4PGV4Q1:~# azure vm image list-publishers
info: Executing command vm image list-publishers
Location: chinanorth
+ Getting virtual machine and/or extension image publishers (Location: "chinanorth")
data: Publisher Location
data: ------------------------------------------ ----------
data: AsiaInfo.DeepSecurity chinanorth
data: AzureChinaMarketplace chinanorth
data: Canonical chinanorth
data: CoreOS chinanorth
data: credativ chinanorth
data: Microsoft.Azure.Diagnostics chinanorth
data: Microsoft.Azure.Extensions chinanorth
data: Microsoft.Azure.RecoveryServices chinanorth
data: Microsoft.Azure.Security chinanorth
data: Microsoft.AzureCAT.AzureEnhancedMonitoring chinanorth
data: Microsoft.AzureSecurity.JITAccess chinanorth
data: Microsoft.Compute chinanorth
data: Microsoft.HpcPack chinanorth
data: Microsoft.OSTCExtensions chinanorth
data: Microsoft.OSTCExtensions.Edp chinanorth
data: Microsoft.OSTCExtensions1 chinanorth
data: Microsoft.Powershell chinanorth
data: Microsoft.Powershell.Test chinanorth
data: Microsoft.SqlServer.Management chinanorth
data: Microsoft.VisualStudio.Azure.RemoteDebug chinanorth
data: MicrosoftAzureSiteRecovery chinanorth
data: MicrosoftOSTC chinanorth
data: MicrosoftRServer chinanorth
data: MicrosoftSQLServer chinanorth
data: MicrosoftWindowsServer chinanorth
data: MicrosoftWindowsServerHPCPack chinanorth
data: MSOpenTech.Extensions chinanorth
data: OpenLogic chinanorth
data: SUSE chinanorth
data: TrendMicro.DeepSecurity chinanorth
info: vm image list-publishers command OK

azure vm image list-offers --publisher Openlogic --location chinanorth

info: Executing command vm image list-offers
+ Getting virtual machine image offers (Publisher: "Openlogic" Location:"chinanorth")
data: Publisher Offer Location
data: --------- ------ ----------
data: Openlogic CentOS chinanorth
info: vm image list-offers command OK

azure vm image list-skus --publisher Openlogic --offer Centos --location chinanorth

info: Executing command vm image list-skus

+ Getting virtual machine image skus (Publisher:"Openlogic" Offer:"Centos" Location:"chinanorth")
data: Publisher Offer sku Location
data: --------- ------ --- ----------
data: Openlogic Centos 6.5 chinanorth
data: Openlogic Centos 6.6 chinanorth
data: Openlogic Centos 6.7 chinanorth
data: Openlogic Centos 6.8 chinanorth
data: Openlogic Centos 6.9 chinanorth
data: Openlogic Centos 7.0 chinanorth
data: Openlogic Centos 7.1 chinanorth
data: Openlogic Centos 7.2 chinanorth
data: Openlogic Centos 7.3 chinanorth
info: vm image list-skus command OK

azure vm image list --publisher OpenLogic --offer Centos --sku 7.1 --location chinanorth

info: Executing command vm image list

+ Getting virtual machine images (Publisher:"OpenLogic" Offer:"Centos" Sku: "7.1" Location:"chinanorth")
data: Publisher Offer Sku OS Version Location Urn
data: --------- ------ --- ----- ------------ ---------- ---------------------------------
data: OpenLogic Centos 7.1 Linux 7.1.20150731 chinanorth OpenLogic:Centos:7.1:7.1.20150731
data: OpenLogic Centos 7.1 Linux 7.1.20160329 chinanorth OpenLogic:Centos:7.1:7.1.20160329
info: vm image list command OK

忽然发现原来7.1的镜像是有的,怎么把他搞起来?方法如下:

azure vm quick-create \
--resource-group resourcename \
--name vmname \
--location chinanorth \
--os-type Linux \
--admin-username azureuser \
--ssh-publickey-file ~/.ssh/id_rsa.pub \
--image-urn OpenLogic:Centos:7.1:7.1.20160329

好啦喝杯水回来准备访问吧!

posted @ 2017-05-26 00:09  wekang  阅读(431)  评论(1编辑  收藏  举报