0

我需要概括並捕獲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. 
+1

你爲什麼不去做它說的? – 4c74356b41

回答

1

當你的存儲帳戶密碼,你會得到錯誤日誌。你可以在Azure Portal上檢查它。 enter image description here

現在,如果您想要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