【问题标题】:Unable to create image using Azure VM无法使用 Azure VM 创建映像
【发布时间】:2017-06-06 10:15:53
【问题描述】:

我需要概括和捕获一个 linux 虚拟机。

我使用 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 virtual-machine azure-storage azure-blob-storage azure-cli


【解决方案1】:

当您的存储帐户加密时,您将收到错误日志。您可以在 Azure 门户上查看它。

现在,如果要在 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-20
    • 2017-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多