无法使用Azure VM创建映像
问题描述:
我需要概括并捕获Linux虚拟机。无法使用Azure VM创建映像
我使用ARM模板部署了VM。在ARM模板,我用存储在存储账户下面让VHD
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"name": "[parameters('virtualMachineName')]",
"createOption": "fromImage",
"vhd": {
"uri": "[concat(concat(reference(resourceId(variables('resourceGroupName'), 'Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2015-06-15').primaryEndpoints['blob'], 'vhds/'), parameters('virtualMachineName'), concat(uniqueString(resourceGroup().id), '.vhd'))]"
}
},
"dataDisks": []
},
现在我下面这个document创建以及图像和虚拟机。
当我执行下面的命令,我得到错误
az image create --resource-group myResourceGroup --name myImage --source myVM
The storage account containing blob https://testvmstorage.blob.core.windows.net/vhds/testvmyrg5wfer6xbcg.vhd is or has been encrypted. Copy the blob to an unencrypted storage account before importing.
答
当你的存储帐户密码,你会得到错误日志。你可以在Azure Portal上检查它。
现在,如果您想要VHD创建映像,您需要创建一个非加密帐户并将VHD复制到它。你可以使用Azcopy在容器之间复制VHD。下面只是一个例子:
AzCopy /Source:https://shuidisks446.blob.core.windows.net/vhds /Dest:https://shuidiag102.blob.core.windows.net/vhds /SourceKey:sGqtdFHQWQWYyf2tRWGF5jkeAEubTp13AVaeTM25QogxXE+K0Ezq1ulcs18qGVPhCEp6ULdLLbKVa7fMbUvYZg== /DestKey:iCjeS+eegjkSJXHjH2UqCkqXnUPiCGvxaOG0Ad2LoPgUnvBoWl9wQJtC1jc//lOj4CF7khpLQe791P4QeyTY6Q== /Pattern:shui20161222141315.vhd
的VHD转移到新的存储帐户后,您可以使用VHD创建快照,然后用快照创建图像。
注意:您无法直接使用VHD创建图像。
您可以使用以下命令。
az snapshot create -g shui2 -n shuisna --source https://shui2.blob.core.windows.net/vhds/shui20170607110945.vhd
az image create -g shui2 -n shuiimage --source shuisna --os-type linux
你为什么不去做它说的? – 4c74356b41