Azure:为 Azure 创建新的 UN 托管磁盘时无法指定存储帐户。
Azure: Cannot specify storage account while creating a new UN - managed disk for azure.
我正在尝试创建一个非托管存储磁盘并将其附加到 Azure。创建磁盘时无法指定存储帐户。
vm.update().defineUnmanagedDataDisk(diskLabel)
.withNewVhd(lun)
.withLun(lun)
.withCaching(CachingTypes.NONE)
.attach()
.apply();
根本原因是 Azure 不支持将非托管磁盘附加到使用托管磁盘的 VM。
如果您的 VM 使用托管磁盘,您只能附加额外的托管数据磁盘。此外,你只能将非托管数据磁盘附加到在存储帐户中使用非托管磁盘的 VM。换句话说,Azure 不支持同时将托管磁盘和非托管磁盘附加到 VM。
如本文所述official document:
In an unmanaged disk, you manage the storage accounts that you use to
store the virtual hard disk (VHD) files that correspond to your VM
disks. VHD files are stored as page blobs in Azure storage accounts.
您可以关注tutorial to upload VHD file to your Storage Account,then use .storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
to specify the storage account.Please refer to the source code from here.
VirtualMachine virtualMachine = computeManager.virtualMachines()
.define(VMNAME)
.withRegion(REGION)
.withExistingResourceGroup(RG_NAME)
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIPAddressDynamic()
.withoutPrimaryPublicIPAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withRootUsername("Foo12")
.withRootPassword("abc!@#F0orL")
.withUnmanagedDisks()
.defineUnmanagedDataDisk("disk1")
.withNewVhd(100)
.withLun(2)
.storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
.attach()
.defineUnmanagedDataDisk("disk2")
.withNewVhd(100)
.withLun(3)
.storeAt(storageAccount.name(), "diskvhds", "datadisk2vhd.vhd")
.attach()
.withSize(VirtualMachineSizeTypes.STANDARD_DS2_V2)
.withOSDiskCaching(CachingTypes.READ_WRITE)
.create();
注意
.storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
表示.storeAt(<your account name>, <container name>, <blob name>)
我正在尝试创建一个非托管存储磁盘并将其附加到 Azure。创建磁盘时无法指定存储帐户。
vm.update().defineUnmanagedDataDisk(diskLabel)
.withNewVhd(lun)
.withLun(lun)
.withCaching(CachingTypes.NONE)
.attach()
.apply();
根本原因是 Azure 不支持将非托管磁盘附加到使用托管磁盘的 VM。
如果您的 VM 使用托管磁盘,您只能附加额外的托管数据磁盘。此外,你只能将非托管数据磁盘附加到在存储帐户中使用非托管磁盘的 VM。换句话说,Azure 不支持同时将托管磁盘和非托管磁盘附加到 VM。
如本文所述official document:
In an unmanaged disk, you manage the storage accounts that you use to store the virtual hard disk (VHD) files that correspond to your VM disks. VHD files are stored as page blobs in Azure storage accounts.
您可以关注tutorial to upload VHD file to your Storage Account,then use .storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
to specify the storage account.Please refer to the source code from here.
VirtualMachine virtualMachine = computeManager.virtualMachines()
.define(VMNAME)
.withRegion(REGION)
.withExistingResourceGroup(RG_NAME)
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIPAddressDynamic()
.withoutPrimaryPublicIPAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withRootUsername("Foo12")
.withRootPassword("abc!@#F0orL")
.withUnmanagedDisks()
.defineUnmanagedDataDisk("disk1")
.withNewVhd(100)
.withLun(2)
.storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
.attach()
.defineUnmanagedDataDisk("disk2")
.withNewVhd(100)
.withLun(3)
.storeAt(storageAccount.name(), "diskvhds", "datadisk2vhd.vhd")
.attach()
.withSize(VirtualMachineSizeTypes.STANDARD_DS2_V2)
.withOSDiskCaching(CachingTypes.READ_WRITE)
.create();
注意
.storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
表示.storeAt(<your account name>, <container name>, <blob name>)