VM create fails with is osDisk error: msrestazure.azure_exceptions.CloudError: Changing property 'osDisk.image.uri' is not allowed.
Code snippet is as follows:
storage_profile=azure.mgmt.compute.models.StorageProfile(
os_disk=azure.mgmt.compute.models.OSDisk(
caching=azure.mgmt.compute.models.CachingTypes.none,
create_option=azure.mgmt.compute.models.DiskCreateOptionTypes.from_image,
name=OS_DISK_NAME,
os_type='Linux',
vhd=azure.mgmt.compute.models.VirtualHardDisk(
uri='https://{0}.blob.core.windows.net/vhds/{1}.vhd'.format(
STORAGE_NAME,
OS_DISK_NAME,
),
),
image=azure.mgmt.compute.models.VirtualHardDisk(
uri='https://xxxxxxxxx.blob.core.windows.net/vm-images/Centos67-Azure.vhd'
),
)
image is defined in the python API and the URi defined works fine with the Azure CLI
API azure==2.0.0rc3
If it helps this is the transaction being sent to azure:
url: hps://management.azure.com/subscriptions/b97ddb69-f825-48b4-9e19-48eb3b4c8267/resourceGroups/dev-eu-vnet9-rg/providers/Microsoft.Compute/virtualMachines/centos67-api
header parameters: {'accept-language': 'en-US', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-client-request-id': 'f65196f4-0e3b-11e6-a61b-b499baffc71a'}
body content: {'properties': {'storageProfile': {'osDisk': {'osType': 'Linux', 'createOption': 'fromImage', 'name': 'centos67-api', 'caching': 'None', 'vhd': {'uri': 'https://deveuvnet9rg9944.blob.core.windows.net/vhds/centos67-api.vhd'}, 'image': {'uri': 'https://deveuvnet9rg9944.blob.core.windows.net/vm-images/Centos67-Azure.vhd'}}}, 'hardwareProfile': {'vmSize': 'Standard_DS1'}, 'osProfile': {'adminUsername': 'cloud_user', 'computerName': 'centos67-api', 'adminPassword': 'xxxxxxxx'}, 'networkProfile': {'networkInterfaces': [{'id': '/subscriptions/b97ddb69-f825-48b4-9e19-48eb3b4c8267/resourceGroups/dev-eu-vnet9-rg/providers/Microsoft.Network/networkInterfaces/centos67-api'}]}}, 'location': 'eastus'}
Traceback (most recent call last): File "./azure_client.py", line 220, in result.wait() # async operation File "/usr/lib/python2.7/site-packages/msrestazure/azure_operation.py", line 639, in wait raise self._exception msrestazure.azure_exceptions.CloudError: Changing property 'osDisk.image.uri' is not allowed.
image
of theosDisk
for thestorageProfile
. – Peter Pan