As mentioned in this 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.
You can follow the 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();
Note that
.storeAt(storageAccount.name(), "diskvhds", "datadisk1vhd.vhd")
means .storeAt(<your account name>, <container name>, <blob name>)