更新azure色scaleset – 从预置图像切换到自定义图像

我在azure中部署了一个scaleset,我需要通过信任的方式来改变底层的debian-image到一个自定义的图像。 我发现了一些不太适合我的好资源:

  • https://msftstack.wordpress.com/2016/05/17/how-to-upgrade-an-azure-vm-scale-set-without-shutting-it-down/
  • https://github.com/gbowerman/vmsstools

这两篇文章都提到要么更新底层的股票形象到一个更新的版本,或更改为自定义图像的URI。 但我需要从库存图像更改为自定义图像。 这涉及到更改json模板

storageProfile : { "imageReference" : { publisher : [variables('imagePublisher')], offer : [variables('imageOffer')], sku : [variables('sku')], version : [variables('imageVersion')] }, osDisk : { name : [concat(variables('vmssName'), 'osdisk')], vhdContainers : [ [concat('https://', variables('uniqueStringArray')[0], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[1], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[2], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[3], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[4], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))] ], caching : ReadOnly, createOption : FromImage }} 

像这样的东西:

 osDisk : { name : [concat(variables('vmssName'), 'osdisk')], vhdContainers : [ [concat('https://', variables('uniqueStringArray')[0], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[1], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[2], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[3], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))], [concat('https://', variables('uniqueStringArray')[4], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))] ], caching : ReadOnly, createOption : FromImage, "osType" : "Linux", uri : https : //storageaccount.blob.core.windows.net/tstclstrvhd/my.vhd 

}

有什么办法做到这一点? 我可以用不同的图像重新部署一个缩放集吗?

感谢和问候,蒂莫

更新:好吧,我设法复制vhd现在。

  1. 通过CLI取消分配scaleset的VM:azure vmssvm deallocate
  2. 使用azure-cli复制blob:azure存储blob副本开始 – 最初帐户密钥xxx – 最初帐户名xxx

我很好奇图像中有什么。 是否取消分配重置图像? 我所有的定制消失了吗?

目前不支持将VMSS模型从平台映像更改为自定义映像(将来可能会随着模型更改的打开而更改)。

一种最小化停机时间的方法是创build新的比例集,然后更改负载均衡器设置(即手动forms的VIP交换,例如从一个LB中分离IP地址,将其与指向新的规模集)。

Re:停止释放,deallocate不会重置映像,所以VHD将会是OSclosures时的状态。 然后,您可以按照以下步骤进行设置: https : //msftstack.wordpress.com/2016/06/20/how-to-convert-an-azure-virtual-machine-to-a-vm-规模设置/ – 注意,你需要在捕捉它之前概括图像(请参阅该页面上的注释)。