Tag not monitored by Microsoft.
Failed VM Create operation using custom image via Python API
Function to get information for a custom image
def getCustomImageInfo(compute_client, imageName=None, imageId=None):
images = compute_client.images.list()
for image in images:
if imageId:
if image.id.lower() == imageId.lower():
return { 'imageId' : image.id }
if imageName:
if image.name == imageName:
return { 'imageId' : image.id }
return None
def create_vm_parameters(nic_id, vm_reference, os, datacenter, vmname, diskType, username, password, size, sshkey, availset_info,
zone, ssh_port):
"""Create the VM parameters structure.
"""
'storage_profile': {
'image_reference': {
'id': vm_reference.get('imageId') if 'imageId' in vm_reference and vm_reference['imageId'] is not None else None,
'publisher': vm_reference.get('publisher'),
'offer': vm_reference.get('offer'),
'sku': vm_reference.get('sku'),
'version': vm_reference.get('version')
},
'os_disk': os_disk,
},
'network_profile': {
'network_interfaces': [{
'id': nic_id,
}]
},
I used the above python code to create a VM using custom image.
I created a custom image named "customUbuntu" using azure compute galleries for Ubuntu18 Linux OS with the following input for Publisher :: Offer :: SKU: canonical :: 0001-com-ubuntu-pro-bionic :: pro-18_04-lts
I then with the help of Azure Python API call, fired the script to create a virtual machine using custom image named passed "customUbuntu" but it failed with the following errors:
Could you please check what is the error for Ubuntu18 custom image only which we are using to create VM whereas same script works completely well for the OL8.8 custom image when used. while all other things remained same.
06/07/2024 08:22:12 AM ERROR: 2302809:140426394220032: log.py:43: VM not yet complete to start: Azure Error: VMMarketplaceInvalidInput
Message: Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/5e954148-641b-4785-98f9-2d794e8
ef0a5
/resourceGroups/Automation-RMM/providers/Microsoft.Compute/virtualMachines/bg-u22-az6'.
06/07/2024 08:22:32 AM ERROR: 2302809:140426394220032: log.py:43: VM not yet complete to start: Azure Error: VMMarketplaceInvalidInput
Message: Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. essage: Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request.
VM: '/subscriptions/5e954148-641b-4785-98f9-2d794e8ef0a5/
/resourceGroups/Automation-RMM/providers/Microsoft.Compute/virtualMachines/bg-
u22-az6'.