0

I want to create Linux VM from a disk in azure using python.

I have referred the azure-sdk-for-python, but i did not find the solution for this. Can anyone explain me the procedure please.

I have found this when I searched on google :

image_name = '{}-osImage'.format(vmname)

async_create = self.compute_client.images.create_or_update( resource_group, image_name,

    {
            'location': location,
            'storage_profile': {
                 'os_disk': {
                        'os_type': 'Linux',
                        'os_state': "Generalized",
                        'blob_uri': image,
                        'caching': "ReadWrite",
                 }
             }
    })

managed_image_ref = async_create.result()

image_reference = ImageReference(id = managed_image_ref.id)

storage_profile = StorageProfile(image_reference = image_reference)

I know this :
1. One can create VM from an image
2. For creating VM from disk, one has to do it using VHD.
But I do not know how to proceed in this (especially using python).
I am new to azure and do not know much about the VHDs. So please explain me the flow also.

5

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.