azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

Unable to create VM using specialized custom image

Open rajeshbshinde opened this issue 9 years ago • 1 comments

I am using Java SDK to create an VM using specialised VHD image. The API that I am using is azure.virtualMachines().define(vmName) .withRegion(region) .withExistingResourceGroup(rgName) .withNewPrimaryNetwork(primaryNetwork) .withPrimaryPrivateIpAddressDynamic() .withoutPrimaryPublicIpAddress() .withSpecializedOsUnmanagedDisk(VHDUrl, OperatingSystemTypes.WINDOWS) .withSize(VirtualMachineSizeTypes.STANDARD_DS1_V2).create();

The VHD URL is https://cwpautostorageaccount.blob.core.windows.net/system/Microsoft.Compute/Images/mytemplates/template-osDisk.ef82d408-5feb-4814-9455-ec0af8a9c8fd.vhd

I have raised a ticket to Azure support and they asked me to open issue in github. Using above API I am unable to create VM and support engineer informed me that we are receiving below error message:


SubStatus Bad Request (HTTP Status Code: 400) SubscriptionId d37402a8-d8c8-4448-8fe4-2a3e08dc6296 ResourceName juzhutestvm1 Error.Code InvalidParameter Error.Message The blob name in URL https://cwpautostorageaccount.blob.core.windows.net/system/Microsoft.Compute/Images/mytemplates/template-osDisk.ef82d408-5feb-4814-9455-ec0af8a9c8fd.vhd contains a slash. This is presently not supported for disks.


But we can create VM using same image if I try to create it with Windows Powershell.

rajeshbshinde avatar Apr 14 '17 05:04 rajeshbshinde

For specialized images, you need to call withStoredWindowsImage or withStoredLinuxImage. Please refer to this issue for a more detailed explanation: https://github.com/Azure-Samples/compute-java-manage-vm/issues/10.

jianghaolu avatar Apr 25 '17 17:04 jianghaolu