简体   繁体   English

Azure:复制虚拟机:没有storageProfile

[英]Azure: Copy a VM: No storageProfile

I'm using the information here to copy a VM on Azure. 我正在使用此处的信息在Azure上复制VM。 I'm unable to get past the first step as my storage profile is coming back empty. 我的存储配置文件又变空了,我无法越过第一步。 I get nothing from the command below. 我从下面的命令中什么也没得到。 If I remove the query, it displays my VM info. 如果删除查询,它将显示我的VM信息。 Querying for just storageProfile also doesn't print anything. 仅查询storageProfile也不会打印任何内容。

az vm show -n myVM -g myRG --query "storageProfile.osDisk.unmanagedDisk.id"

My VM has a blob based VHD. 我的VM具有基于Blob的VHD。 Wondering if I'm barking up the wrong tree. 想知道我是否在树错树皮。 Pardon my ignorance as I'm quite new to Azure and the amount of information out there is a bit overwhelming. 请原谅我的无知,因为我是Azure的新手,而那里的信息量却让人不知所措。

My VM has a blob based VHD. 我的VM具有基于Blob的VHD。

According to your description, your VM create with Azure blob, unmanaged disk. 根据您的描述,您的VM使用Azure blob(非托管磁盘)创建。 Unmanaged disk VM information like this, there is no unmanaged property: 这样的非托管磁盘VM信息, 没有非托管属性:

"osDisk": {
      "caching": "ReadWrite",
      "createOption": "fromImage",
      "diskSizeGb": null,
      "encryptionSettings": null,
      "image": null,
      "managedDisk": null,
      "name": "jasonvm",
      "osType": "Linux",
      "vhd": {
        "uri": "https://vmdisks909.blob.core.windows.net/vhds/jasonvm20170727093048.vhd"
      }
    }

So we can use this script to show the VHD uri information: 因此,我们可以使用此脚本显示VHD uri信息:

az vm show -g vm -n jasonvm --query "storageProfile.osDisk.vhd.uri" -o tsv

Also, if you want to copy this VHD to another Azure storage account, we can use this script: 另外,如果要将此VHD复制到另一个Azure存储帐户,我们可以使用以下脚本:

# Copy blob from source account to destination account (destcontainer must exist)
az storage blob copy start \
    --account-name destaccountname \
    --account-key destaccountkey \
    --destination-blob destfile.vhd \
    --destination-container destcontainer \
    --source-uri https://sourceaccountname.blob.core.windows.net/sourcecontainer/sourcefile.vhd

More information about copy blob to another container, please refer to this article . 有关将blob复制到另一个容器的更多信息,请参阅本文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM